sertit.rasters_rio.path_arr_dst¶
- path_arr_dst(function: Callable) Callable [source]¶
Path, xarray, (array, metadata) or dataset decorator. Allows a function to ingest:
a path
a xarray
a rasterio dataset
rasterio open data: (array, meta)
>>> # 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