nd.vector package

A submodule to deal with vector data.

nd.vector.rasterize(shp, ds, columns=None, encode_labels=True, crs=None, date_field=None, date_fmt=None)[source]

Rasterize a vector dataset to match a reference raster.

  • shp (str or geopandas.geodataframe.GeoDataFrame) – Either the filename of a shapefile or an iterable

  • ds (xarray.Dataset) – The reference dataset to match the raster shape.

  • columns (list of str, optional) – List of column names to read.

  • encode_labels (bool, optional) – If True, convert categorical data to integer values. The corresponding labels are accessible in the metadata. (default: True).

  • crs (str or dict or cartopy.crs.CRS, optional) – The CRS of the vector data.

  • date_field (str, optional) – The name of field containing the timestamp.

  • date_fmt (str, optional) – The date format to parse date_field. Passed to pd.to_datetime().


The rasterized features.

Return type

xarray.Dataset or xarray.DataArray

nd.vector.read_file(path, clip=None)[source]

Read a geospatial vector file.

  • path (str) – The path of the file to read.

  • clip (shapely.geometry, optional) – A geometry to intersect the vector data.


Return type