clip#

geobricks.clip(data, *,
               src_crs=None,
               bounds=None,
               mask=None,
               export_extension=None)

Clip space-time data. clip() is a partial alias of the transform() function.

Parameters#

datastr, pathlib.Path, xarray.Dataset, xarray.DataArray or geopandas.GeoDataFrame

Data to transform. Supported file formats are .tif, .asc, .nc and vector formats supported by geopandas (.shp, .json, …).

src_crsint or str or rasterio.crs.CRS, optional, default None

Coordinate reference system of the source (data). When passed as an integer, src_crs refers to the EPSG code. When passed as a string, src_crs can be OGC WKT string or Proj.4 string.

boundsiterable or None, optional, default None

Boundaries of the target domain as a tuple (x_min, y_min, x_max, y_max).

maskstr, pathlib.Path, shapely.geometry, xarray.DataArray or geopandas.GeoDataFrame, optional, default None

Filepath of mask used to clip the data.

to_filebool, default True

If True and if data is a file, the resulting dataset will be exported to a file with the same name and the suffix ‘_geop4th’.

export_extensionstr, optional

Extension to which the data will be converted and exported. Only used when the specified data is a filepath. It data is a variable and not a file, it will not be exported.

Returns#

Clipped dataxarray.Dataset or geopandas.GeoDataFrame.

The type of the resulting variable is accordingly to the type of input data and to the conversion operations (such as rasterize):

  • all vector data will be output as a geopandas.GeoDataFrame

  • all raster data and netCDF will be output as a xarray.Dataset