erlab.io.utilities¶
Functions
|
Discards attributes that are incompatible with the |
|
Return a list of files in a directory with the given extensions. |
|
Load data from an HDF5 file saved with |
|
Open data from an HDF5 file saved with |
|
Save data in |
|
Save data in |
|
Print raw metadata from a |
- erlab.io.utilities.get_files(directory, extensions=None, contains=None, notcontains=None)[source]¶
Return a list of files in a directory with the given extensions.
- Parameters:
- Returns:
files – List of files in the directory.
- Return type:
- erlab.io.utilities.load_hdf5(filename, **kwargs)[source]¶
Load data from an HDF5 file saved with
save_as_hdf5
.This is a thin wrapper around
xarray.load_dataarray
andxarray.load_dataset
.- Parameters:
**kwargs – Extra arguments to
xarray.load_dataarray
orxarray.load_dataset
.
- Returns:
The loaded data.
- Return type:
- erlab.io.utilities.open_hdf5(filename, **kwargs)[source]¶
Open data from an HDF5 file saved with
save_as_hdf5
.This is a thin wrapper around
xarray.open_dataarray
andxarray.open_dataset
.- Parameters:
**kwargs – Extra arguments to
xarray.open_dataarray
orxarray.open_dataset
.
- Returns:
The opened data.
- Return type:
- erlab.io.utilities.save_as_hdf5(data, filename, igor_compat=True, **kwargs)[source]¶
Save data in
HDF5
format.- Parameters:
data (DataArray | Dataset) –
xarray.DataArray
to save.igor_compat (bool) – (Experimental) Make the resulting file compatible with Igor’s
HDF5OpenFile
for DataArrays with up to 4 dimensions. A convenient Igor procedure is included in the repository. Default isTrue
.**kwargs – Extra arguments to
xarray.DataArray.to_netcdf
: refer to thexarray
documentation for a list of all possible arguments.
- erlab.io.utilities.save_as_netcdf(data, filename, **kwargs)[source]¶
Save data in
netCDF4
format.Discards invalid
netCDF4
attributes and produces a warning.- Parameters:
data (DataArray) –
xarray.DataArray
to save.**kwargs – Extra arguments to
xarray.DataArray.to_netcdf
: refer to thexarray
documentation for a list of all possible arguments.