Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_cf_vars(e, dataset_id, standard_name='sea_water_temperature'):
- """Return the axis of a dataset_id the variable with the `standard_name`."""
- variables = e.get_var_by_attr(
- dataset_id=dataset_id,
- axis=lambda v: v in ['X', 'Y', 'Z', 'T']
- )
- if not len(variables) == 4:
- raise Exception('Expected 4 axis, found {!r}'.format(variables))
- var = e.get_var_by_attr(
- dataset_id=dataset_id,
- standard_name=standard_name
- )
- if len(var) > 1:
- raise Exception('Found more than 1 variable with `standard_name` {}\n{!r}'.format(standard_name, var))
- variables.append(var[0])
- return variables
Add Comment
Please, Sign In to add comment