NREL / rex

REsource eXtraction Tool (rex)
https://nrel.github.io/rex
BSD 3-Clause "New" or "Revised" License
20 stars 10 forks source link

`self.datasets` conflict with `self.res.h5` when `self.res.h5` includes groups #181

Closed bnb32 closed 3 months ago

bnb32 commented 3 months ago

If the underlying h5 data in a rex resource includes a group and child dataset e.g. '/meta/latitude' self.datasets will end up including '/meta/latitude' while accessing this dataset through self.res.h5 requires self.res.h5['meta']['latitude'] not self.res.h5['/meta/latitude']. This will thus break self.attrs, self.shapes, and self.dtypes.

The following hotfix: https://github.com/NREL/rex/blob/264c225fbf5574815e4d3120c777382dad096712/rex/resource.py#L929 should be reverted and instead the logic in https://github.com/NREL/rex/blob/264c225fbf5574815e4d3120c777382dad096712/rex/resource.py#L711 should be modified.

ppinchuk commented 3 months ago

After #183, "meta/latitude" correctly shows up in attributes, so .intersection() is not needed.