rex.multi_year_resource.MultiYearH5
- class MultiYearH5(h5_path, years=None, res_cls=<class 'rex.resource.Resource'>, hsds=False, hsds_kwargs=None, **res_cls_kwargs)[source]
Bases:
MultiTimeH5
Class to handle multiple years of h5 Resources
- Parameters:
h5_path (str) – Unix shell style pattern path with * wildcards to multi-file resource file sets. Files must have the same coordinates but can have different datasets or time indexes.
years (list, optional) – List of integer years to access, by default None
res_cls (obj) – Resource class to use to open and access resource data
hsds (bool) – Boolean flag to use h5pyd to handle .h5 ‘files’ hosted on AWS behind HSDS
hsds_kwargs (dict, optional) – Dictionary of optional kwargs for h5pyd, e.g., bucket, username, password, by default None
Methods
close
()Close all h5py.File instances
year_index
(year)Extract time_index for a specific year
Attributes
Global .h5 file attributes sourced from first .h5 file
Available datasets
Available file paths ordered the same way as self.years
open h5 file handler for a single .h5 file
.h5 files data is being sourced from
Available resource datasets
Dataset shape (time, sites)
Multi-year datetime index
Available years ordered the same way as self.files
- property years
Available years ordered the same way as self.files
- Returns:
list – List of dataset present in .h5 files
- property files
Available file paths ordered the same way as self.years
- Returns:
list
- property time_index
Multi-year datetime index
- Returns:
pandas.DatatimeIndex
- year_index(year)[source]
Extract time_index for a specific year
- Parameters:
year (int) – Year to extract time_index for
- Returns:
time_index (pandas.DatetimeIndex) – Resource datetime index for desired year
- property attrs
Global .h5 file attributes sourced from first .h5 file
- Returns:
attrs (dict)
- property datasets
Available datasets
- Returns:
list
- property h5
open h5 file handler for a single .h5 file
- Returns:
h5py.File
- property h5_files
.h5 files data is being sourced from
- Returns:
list
- property resource_datasets
Available resource datasets
- Returns:
list
- property shape
Dataset shape (time, sites)
- Returns:
tuple