hydromt.io.open_mfraster#
- hydromt.io.open_mfraster(paths, chunks=None, concat=False, concat_dim='dim0', mosaic=False, mosaic_kwargs=None, **kwargs)[source]#
Open multiple gdal-readable files as single Dataset with geospatial attributes.
Each raster is turned into a DataArray with its name inferred from the filename. By default all DataArray are assumed to be on an identical grid and the output dataset is a merge of the rasters. If
concat
the DataArrays are concatenated alongconcat_dim
returning a Dataset with a single 3D DataArray. Ifmosaic
the DataArrays are concatenated along the the spatial dimensions usingmerge()
.- Parameters:
paths (
str
,list
ofstr/Path/file-like
) – Paths to the rasterio/gdal files. Paths can be provided as list of paths or a path pattern string which is interpreted according to the rules used by the Unix shell. The variable name is derived from the basename minus extension in case a list of paths:<name>.<extension>
and based on the file basename minus pre-, postfix and extension in a path pattern:<prefix><*name><postfix>.<extension>
chunks (
int
,tuple
ordict
, optional) – Chunk sizes along each dimension, e.g., 5, (5, 5) or {‘x’: 5, ‘y’: 5}. If chunks is provided, it used to load the new DataArray into a dask array.concat (
bool
, optional) – If True, concatenate raster alongconcat_dim
. We destinguish the following filenames from which the numerical index and variable name are inferred, where the variable name is based on the first raster.<name>_<index>.<extension>
<name>*<postfix>.<index>
(PCRaster style; requires path pattern)<name><index>.<extension>
<name>.<extension>
(index based on order)concat_dim (
str
, optional) – Dimension name of concatenate index, by default ‘dim0’mosaic (
bool
, optional) – If True create mosaic of several rasters. The variable is named based on variable name infered from the first raster.mosaic_kwargs (
dict
, optional) – Mosaic key_word arguments to unify raster crs and/or resolution. Seehydromt.merge.merge()
for options.**kwargs – key-word arguments are passed to
hydromt.raster.open_raster()
- Returns:
data – The newly created DataSet.
- Return type:
DataSet