sertit.rasters.path_xarr_dst¶
- path_xarr_dst(function: Callable) Callable [source]¶
Path, xarray or dataset decorator. Allows a function to ingest:
a path
a xarray
a rasterio dataset
>>> # Create mock function >>> @path_or_dst >>> def fct(dst): >>> read(dst) >>> >>> # Test the two ways >>> read1 = fct("path\to\raster.tif") >>> with rasterio.open("path\to\raster.tif") as dst: >>> read2 = fct(dst) >>> >>> # Test >>> read1 == read2 True
- Parameters
function (Callable) – Function to decorate
- Returns
decorated function
- Return type
Callable