imod.formats.idf.open_dataset#

imod.formats.idf.open_dataset(globpath, use_cftime=False, pattern=None)[source]#

Open a set of IDFs to a dict of xarray.DataArrays.

Compared to imod.idf.open, this function lets you open multiple parameters at once (for example kh values and starting heads of a model), which will each be a separate entry in a dictionary, with as key the parameter name, and as value the xarray.DataArray.

Parameters
  • globpath (str or Path) – A glob pattern expansion such as 'model/**/*.idf', which recursively finds all IDF files under the model directory. Note that files with the same name (part before the first underscore) wil be combined into a single xarray.DataArray.

  • use_cftime (bool, optional) –

    Use cftime.DatetimeProlepticGregorian instead of np.datetime64[ns] for the time axis.

    Dates are normally encoded as np.datetime64[ns]; however, if dates fall before 1679 or after 2262, they are automatically encoded as cftime.DatetimeProlepticGregorian objects rather than np.datetime64[ns].

  • pattern (str, regex pattern, optional) – If the filenames do match default naming conventions of {name}_{time}_l{layer}, a custom pattern can be defined here either as a string, or as a compiled regular expression pattern. Please refer to the examples for imod.idf.open.

Returns

Dictionary of str (parameter name) to xarray.DataArray. All metadata needed for writing the file to IDF or other formats using imod.rasterio are included in the xarray.DataArray.attrs.

Return type

dictionary