-
Notifications
You must be signed in to change notification settings - Fork 12
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
Support for N axis dimensions mapped to N coordinates #343
Commits on Nov 7, 2022
-
Add support for datasets with N dims mapped to N coord vars
Overview: - `xcdat` APIs previously expected a 1:1 map between axis dimensions and coordinates. For example, the `time` axis dimension would be mapped to `time` coord var. However, datasets can have N dimensions mapped to N coordinate variables - For example, datasets that have N dims mapped to N coord vars include E3SM, which might have a "Z" axis with the dimensions and coords "ilev" and "lev" Feature Updates: - Update bounds accessor methods to operate on the dataset or a variable within the dataset using the new `var_key` kwarg - Update `add_missing_bounds()` to loop over all axes and their coordinate vars and attempt to add bounds for each coordinate var if they do not exist - Update decoding function (`decode_time()`) to decode CF and non-CF compliant time coordiantes as `cftime` objects - Update dataset longitude swapping function (`swap_lon_axis()`) to loop over longitude coords and their bounds to swap them - Update spatial and temporal accessor class methods to refer to the dimension coordinate variable on the `data_var` being operated on, rather than the parent dataset Bug Fixes: - Fix `add_bounds()` not ignoring 0-dim singleton coords in addition to 1-dim singleton coords Refactor: - Refactor `open_dataset()` and `open_mfdataset()` to remove unnecessary preprocessing functions - Rename `get_axis_coord()` to `get_dim_coords()` and `get_axis_dim()` to `get_dim_keys()` - Update fixtures in `fixtures.py` to use `cftime` objects and add `decode_times` to `generate_dataset()` - Extract utility function `_if_multidim_dask_array_then_load()` and reuse in several places in the codebase, usually when manipulating bounds
Configuration menu - View commit details
-
Copy full SHA for 8a30534 - Browse repository at this point
Copy the full SHA 8a30534View commit details -
Refactor redundant calls to
.values
- This improves runtime performance, since `.values` performs type conversions to `np.array()` - Refactor `_get_cftime_coords()` to use `xr.coding.times.decode_cf_datetime()` for decoding CF compliant time units
Configuration menu - View commit details
-
Copy full SHA for 23bcd2d - Browse repository at this point
Copy the full SHA 23bcd2dView commit details -
Refactor decoding times to a lazy operation
- Update `_is_decoded()` to check `.encoding` attributes rather than the object types in the array for performance purposes, since accessing `.values` can involve type conversion
Configuration menu - View commit details
-
Copy full SHA for 2928e6a - Browse repository at this point
Copy the full SHA 2928e6aView commit details -
Add test for decoding with default calendar attr
- Refactor imports and fix docstrings
Configuration menu - View commit details
-
Copy full SHA for c7f0e99 - Browse repository at this point
Copy the full SHA c7f0e99View commit details -
Decode times in
preprocess
foropen_mfdataset()
- This is required for cases where time units are different between files in multi-file datasets, but the offsets are the same. More info in the `_preprocess()` docstring - Add raise ValueError for decoding datasets with time coords without CF attrs set
Configuration menu - View commit details
-
Copy full SHA for 7c8846e - Browse repository at this point
Copy the full SHA 7c8846eView commit details -
Fix incorrect
units
arg passed todecode_cf_datetime()
- Add `decode_time()` test for units in days
Configuration menu - View commit details
-
Copy full SHA for 1e57bc9 - Browse repository at this point
Copy the full SHA 1e57bc9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3a5d4fd - Browse repository at this point
Copy the full SHA 3a5d4fdView commit details -
to interpret common var names - Update tests
Configuration menu - View commit details
-
Copy full SHA for 2920ffc - Browse repository at this point
Copy the full SHA 2920ffcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5431b0e - Browse repository at this point
Copy the full SHA 5431b0eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6591295 - Browse repository at this point
Copy the full SHA 6591295View commit details
Commits on Nov 8, 2022
-
Configuration menu - View commit details
-
Copy full SHA for d5e5ccd - Browse repository at this point
Copy the full SHA d5e5ccdView commit details -
Configuration menu - View commit details
-
Copy full SHA for ad587d4 - Browse repository at this point
Copy the full SHA ad587d4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8575a09 - Browse repository at this point
Copy the full SHA 8575a09View commit details