Converts the xarray attrs into args that can be passed into Iris
(attrs)
| 65 | |
| 66 | |
| 67 | def _get_iris_args(attrs): |
| 68 | """Converts the xarray attrs into args that can be passed into Iris""" |
| 69 | # iris.unit is deprecated in Iris v1.9 |
| 70 | import cf_units |
| 71 | |
| 72 | args = {"attributes": _filter_attrs(attrs, iris_forbidden_keys)} |
| 73 | args.update(_pick_attrs(attrs, ("standard_name", "long_name"))) |
| 74 | unit_args = _pick_attrs(attrs, ("calendar",)) |
| 75 | if "units" in attrs: |
| 76 | args["units"] = cf_units.Unit(attrs["units"], **unit_args) |
| 77 | return args |
| 78 | |
| 79 | |
| 80 | # TODO: Add converting bounds from xarray to Iris and back |
no test coverage detected
searching dependent graphs…