Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gb/bug #182

Merged
merged 3 commits into from
Feb 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added better error message for cant find feature in h5 attrs and adde…
…d pr for cc output
  • Loading branch information
grantbuster committed Feb 2, 2024
commit 89f248f39a08723a76a55568a6cd83cde7fec2e7
14 changes: 12 additions & 2 deletions sup3r/postprocessing/file_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
'units': 's-2',
'dtype': 'int16',
'chunks': (2000, 500)},
'pr': {'scale_factor': 1,
'units': 'kg m-2 s-1',
'dtype': 'float32',
'chunks': (2000, 250)},
}


Expand Down Expand Up @@ -293,8 +297,14 @@ def enforce_limits(features, data):
maxs = []
mins = []
for fn in features:
max = H5_ATTRS[Feature.get_basename(fn)].get('max', np.inf)
min = H5_ATTRS[Feature.get_basename(fn)].get('min', -np.inf)
dset_name = Feature.get_basename(fn)
if dset_name not in H5_ATTRS:
msg = ('Could not find "{dset_name}" in H5_ATTRS dict!')
logger.error(msg)
raise KeyError(msg)

max = H5_ATTRS[dset_name].get('max', np.inf)
min = H5_ATTRS[dset_name].get('min', -np.inf)
logger.debug(f'Enforcing range of ({max}, {min} for "{fn}")')
maxs.append(max)
mins.append(min)
Expand Down
Loading