Guest User

Untitled

a guest
Feb 25th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. def get_cf_vars(e, dataset_id, standard_name='sea_water_temperature'):
  2. """Return the axis of a dataset_id the variable with the `standard_name`."""
  3. variables = e.get_var_by_attr(
  4. dataset_id=dataset_id,
  5. axis=lambda v: v in ['X', 'Y', 'Z', 'T']
  6. )
  7. if not len(variables) == 4:
  8. raise Exception('Expected 4 axis, found {!r}'.format(variables))
  9. var = e.get_var_by_attr(
  10. dataset_id=dataset_id,
  11. standard_name=standard_name
  12. )
  13. if len(var) > 1:
  14. raise Exception('Found more than 1 variable with `standard_name` {}\n{!r}'.format(standard_name, var))
  15. variables.append(var[0])
  16. return variables
Add Comment
Please, Sign In to add comment