Dataset.rst accessor#

The Dataset.rst accessor exposes GeoUtils raster methods on xarray.Dataset objects.

It applies operations through DataArray.rst to all compatible raster variables by default, or to those selected with variables.

For the main raster API reference page, see Raster API. Below is the full class description specific to Dataset.rst:

class geoutils.DatasetRasterAccessor(xarray_obj)[source]#

Bases: object

This class defines the Xarray accessor ‘rst’ for rasters in a Dataset.

Dataset methods delegate calculations to the DataArray accessor for all recognized raster variables (default) or for selected ones (by passing variables to an operation), then combine the results to return a Dataset. Other variables and independent coordinates are preserved. Operations raise an error if their new grid would affect an unselected variable.

A raster variable is recognized as a numeric 2D or 3D variable with two spatial dimensions and a CRS. The compatible_variables property maps names to DataArrays for all variables recognized as rasters.

clip(*args, variables=None, **kwargs)[source]#

Clip rasters in the dataset.

See DataArray.rst.clip() for shared arguments.

Parameters:
  • args (Any) – Mask passed to clip().

  • variables (Sequence[str] | None) – Raster variable names to process. All recognized raster variables are used by default.

  • kwargs (Any) – Keyword clipping options.

Return type:

Dataset

Returns:

Dataset containing the clipped raster variables.

property compatible_variables: Mapping[str, DataArray]#

Compatible raster variables as Xarray’s mapping of names to DataArrays.

Use keys() to list their names in Dataset order. The mapping shares the original data without loading file-backed values or computing Dask arrays.

crop(*args, variables=None, **kwargs)[source]#

Crop rasters in the dataset.

See DataArray.rst.crop() for shared arguments.

Parameters:
  • args (Any) – Positional crop arguments.

  • variables (Sequence[str] | None) – Raster variable names to process. All recognized raster variables are used by default.

  • kwargs (Any) – Keyword crop options.

Return type:

Dataset

Returns:

Dataset containing the cropped raster variables.

fill_nodata(*args, variables=None, **kwargs)[source]#

Fill raster gaps in the dataset.

See DataArray.rst.fill_nodata() for shared arguments.

Parameters:
  • args (Any) – Positional gap-filling options.

  • variables (Sequence[str] | None) – Raster variable names to process. All recognized raster variables are used by default.

  • kwargs (Any) – Keyword gap-filling options.

Return type:

Dataset

Returns:

Dataset with filled raster values.

filter(*args, variables=None, **kwargs)[source]#

Filter raster values in the dataset.

See DataArray.rst.filter() for shared arguments.

Parameters:
  • args (Any) – Filter method and positional options.

  • variables (Sequence[str] | None) – Raster variable names to process. All recognized raster variables are used by default.

  • kwargs (Any) – Keyword filter options.

Return type:

Dataset

Returns:

Dataset with filtered values and unchanged coordinates.

icrop(*args, variables=None, **kwargs)[source]#

Crop raster rows and columns in the dataset.

See DataArray.rst.icrop() for shared arguments.

Parameters:
  • args (Any) – Pixel bounds passed to icrop().

  • variables (Sequence[str] | None) – Raster variable names to process. All recognized raster variables are used by default.

  • kwargs (Any) – Keyword crop options.

Return type:

Dataset

Returns:

Dataset containing the cropped raster variables.

interp_at_points(points, *args, variables=None, **kwargs)[source]#

Interpolate rasters in the dataset at points.

See DataArray.rst.interp_at_points() for shared arguments.

Parameters:
  • points (Any) – Point DataArray, Dataset, point cloud, or X/Y arrays.

  • args (Any) – Positional interpolation options.

  • variables (Sequence[str] | None) – Raster variable names to process. All recognized raster variables are used by default.

  • kwargs (Any) – Keyword interpolation options.

Return type:

Dataset

Returns:

Dataset with selected raster variables replaced by values on the point dimension.

interp_points(points, *args, variables=None, **kwargs)[source]#

Interpolate rasters in the dataset at points.

Alias of interp_at_points(). See DataArray.rst.interp_points() for shared arguments.

Parameters:
  • points (Any) – Native compatible point input.

  • args (Any) – Positional interpolation options.

  • variables (Sequence[str] | None) – Raster variable names to process. All recognized raster variables are used by default.

  • kwargs (Any) – Keyword interpolation options.

Return type:

Dataset

Returns:

Dataset containing interpolated point values.

reduce_at_points(points, *args, variables=None, **kwargs)[source]#

Reduce raster windows in the dataset at points.

See DataArray.rst.reduce_at_points() for shared arguments.

Parameters:
  • points (Any) – Native point input defining output locations.

  • args (Any) – Reducer and positional window options.

  • variables (Sequence[str] | None) – Raster variable names to process. All recognized raster variables are used by default.

  • kwargs (Any) – Keyword reduction options.

Return type:

Dataset

Returns:

Dataset with reduced raster values on the point dimension.

reproject(*args, variables=None, **kwargs)[source]#

Reproject rasters in the dataset.

See DataArray.rst.reproject() for shared arguments.

Parameters:
  • args (Any) – Positional reprojection arguments.

  • variables (Sequence[str] | None) – Raster variable names to process. All recognized raster variables are used by default.

  • kwargs (Any) – Keyword reprojection arguments.

Return type:

Dataset

Returns:

Dataset with the transformed raster variables.

resample_at_points(points, *args, variables=None, **kwargs)[source]#

Resample rasters in the dataset at points.

See DataArray.rst.resample_at_points() for shared arguments.

Parameters:
  • points (Any) – Native point input defining shared output locations.

  • args (Any) – Resampling operator and positional options.

  • variables (Sequence[str] | None) – Raster variable names to process. All recognized raster variables are used by default.

  • kwargs (Any) – Keyword resampling options.

Return type:

Dataset

Returns:

Dataset with selected raster values sampled on the point dimension.

sieve(*args, variables=None, **kwargs)[source]#

Remove small regions from rasters in the dataset.

See DataArray.rst.sieve() for shared arguments.

Parameters:
  • args (Any) – Positional sieve options.

  • variables (Sequence[str] | None) – Raster variable names to process. All recognized raster variables are used by default.

  • kwargs (Any) – Keyword sieve options.

Return type:

Dataset

Returns:

Dataset containing the sieved rasters.

stats(*args, variables=None, **kwargs)[source]#

Calculate statistics for rasters in the dataset.

Grouping or vector fractional coverage is calculated once for all variables, and statistics are computed at once for all variables with same dimensions.

See DataArray.rst.stats() for shared arguments.

Parameters:
  • args (Any) – Statistics to calculate.

  • variables (Sequence[str] | None) – Raster variable names to process. All recognized raster variables are used by default.

  • kwargs (Any) – Grouping, sampling and reduction options. Use variables instead of values.

Return type:

Any

Returns:

Named statistics, a grouped table, or a grouped table and masks.

translate(*args, variables=None, **kwargs)[source]#

Translate raster grids in the dataset.

See DataArray.rst.translate() for shared arguments.

Parameters:
  • args (Any) – Coordinate offsets passed to translate().

  • variables (Sequence[str] | None) – Raster variable names to process. All recognized raster variables are used by default.

  • kwargs (Any) – Keyword translation options.

Return type:

Dataset

Returns:

Dataset containing the translated rasters.

variogram(*, variables=None, **kwargs)[source]#

Estimate an empirical variogram for each selected raster variable.

Each variable is sampled independently after excluding its missing values. Dask rasters are read in chunks; the returned variograms contain eager NumPy arrays. An integer random_state is reused for each variable, while a supplied generator advances in the selected variable order.

See DataArray.rst.variogram() for shared arguments.

Parameters:
  • variables (Sequence[str] | None) – Raster variable names to analyze. All recognized raster variables are used by default.

  • kwargs (Any) – Pair sampling, estimation and fitting options passed to DataArray.rst.variogram().

Return type:

dict[str, Variogram]

Returns:

Dictionary mapping each selected variable name to its Variogram.