enstools.io.read¶
- enstools.io.read(filenames: Union[List[str], Tuple[str], str, Path, List[Path]], constant=None, merge_same_size_dim=False, members_by_folder=False, member_by_filename=None, decode_times=True, **kwargs)¶
Read multiple input files
- Parameters:
- filenameslist of str or tuple of str or str
names of individual files or filename pattern
- merge_same_size_dimbool
dimensions of the same size but with different names are merged together. This is sometimes useful to merge datasets from different file formats (e.g., grib and netcdf). Default: False.
- members_by_folderbool
interpret files in one subdirectory as data from the same ensemble member. This is useful if the ensemble member number if not stored within the input file. Defaut: False.
- member_by_filenamestr
string containing a regular expression to read to ensemble member from the file names. The first group within this regex has to match an integer. Example: member_by_filename=”_P(\d+).nc” would be able the read the 12 from the file name AROME-EPS_2012110500_P12.nc.
- constantstr
name of a file containing constant variables.
- decode_times: bool
decode the times
- **kwargs
all arguments accepted by xarray.open_dataset() of xarray.open_mfdataset() plus some additional:
- drop_unused: bool
remove unused coordinates. This improves the performance of the merge process. The merge process compares the coordinates from all files with each other.
- in_memory: bool
store the complete arrays in memory. Data is still handled as dask arrays, but not backed by the input files anymore. This works of course only for datasets which fit into memory.
- leadtime_from_filename: bool
COSMO-GRIB1-Files do not contain exact times. If this argument is set, then the timestamp is calculated from the init time and the lead time from the file name.
- Returns:
- xarray.Dataset
in-memory representation of the content of the input file(s)