-
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
[Bug]: coordinate attributes not always retained during group_average operations #529
Comments
In the scenario where a user runs
I believe this scenario is a duplicate of #458 and was resolved by #465, which will be included in |
This works on the |
I opened #534 to cover scenario A. |
@pochedls I just released v0.5.0 patch 1 on conda-forge to fix scenario B. conda/mamba should automatically pull the latest version. If you want to update xcdat in an existing environment, you can run I ran your example for scenario B below and it works with v0.5.0 now. fn = '/p/css03/esgf_publish/CMIP6/CMIP/NCAR/CESM2/amip/r1i1p1f1/Amon/tas/gn/v20190218/tas_Amon_CESM2_amip_r1i1p1f1_gn_195001-201412.nc'
ds = xc.open_dataset(fn)
ds.lon.attrs
ds = ds.sel(time=slice("1950-01-01", "2000-12-30"))
ds = ds.temporal.group_average('tas', freq='year')
ds.bounds.get_bounds("X") |
Also just an FYI @xCDAT/core-developers |
What happened?
Scenario A (xcdat v0.5.0 + xarray >=v2023.3.0)
This scenario affects xcdat v0.5.0 (regardless of xarray version). In this issue, xcdat does not create time_bounds for annually averaged data.
Scenario B (xcdat 0.5.0 and xarray 2023.7.0)
This scenario affects xcdat v0.5.0 (and xcdat v 2023.7.0, but not xcdat v2023.3.0). In this issue, xcdat drops axis attributes after performing a
group_average
operation.This results because the attributes for
ds.lon
are missing (after taking the group average):ds.lon.attrs
(They were not missing before taking the group average)
What did you expect to happen? Are there are possible answers you came across?
In scenario A, I would have expected annual bounds (this isn't that critical, though).
In scenario B, I would have expected
ds.lon.attrs
to persist afterds.temporal.group_average()
operations. Note that this issue has downstream effects (e.g., taking spatial averages which need the lat/lon bounds).Minimal Complete Verifiable Example (MVCE)
No response
Relevant log output
No response
Anything else we need to know?
I'm less worried about Scenario A. Scenario B can actually cause downstream problems.
Environment
xcdat v0.5.0
xarray version v2023.7.0
The text was updated successfully, but these errors were encountered: