raster_tools.dataarray_to_raster#
- raster_tools.dataarray_to_raster(xdata, xmask=None, crs=None)[source]#
Create a Raster from a DataArray object.
The null value is pulled from xdata using rioxarray.
- Parameters
xdata (xarray.DataArray) – The object to make a Raster from.
xmask (xarray.DataArray, optional) – The matching mask to use with the xdata object when creating the raster Dataset. Must have boolean dtype. The default is to generate a mask from xdata based on the value returned by xdata.rio.nodata.
crs (int, str, rasterio.CRS, optional) – The CRS to use when creating the result. The default is to take the CRS from xdata, if present.
- Returns
raster – The resulting Raster.
- Return type