hydromt.DataArray.raster.from_numpy#

static DataArray.raster.from_numpy(data, transform, nodata=None, attrs=None, crs=None)#

Transform a 2D/3D numpy array into a DataArray with geospatial attributes.

The data dimensions should have the y and x on the second last and last dimensions.

Parameters:
  • data (numpy.array, 2-dimensional) – values to parse into DataArray

  • transform (affine transform) – Two dimensional affine transform for 2D linear mapping

  • nodata (float or int, optional) – nodata value

  • attrs (dict, optional) – additional attributes

  • crs (int, dict, or str, optional) – Coordinate Reference System. Accepts EPSG codes (int or str); proj (str or dict) or wkt (str)

Returns:

da – xarray.DataArray with geospatial information

Return type:

RasterDataArray