Closed lpilz closed 1 year ago
There are a couple things going on:
1) c_grid_axis_shift
should have been dropped along with stagger
...that one's my bad on forgetting! I can get a PR in for that shortly.
2) When I made #93 to adapt #37, I envisioned the Dataset method to be primary and the DataArray secondary. The number of DataArray destaggering related issues that have come up since merging #93 are definitely symptomatic of the DataArray method being an afterthought. That makes me wonder if
3) The dataset[key] = value_as_dataarray
operation can be deceptive based on how you conceptualize the data model. This operation is ends up working like dataset = dataset.merge(value_as_dataarray.to_dataset(), combine_attrs="override")
, meaning that any coordinates (and their attrs) in the datarray end up overriding what already existed in the dataset. Safer options are:
dataset[key] = value_as_dataarray.variable
dataset = dataset.merge(value_as_dataarray, combine_attrs="drop_conflicts")
@lpilz Do you think with #106 and #107 this is sufficiently resolved for the purposes of the v0.0.2 release? Or should we still consider some documentation changes around the DataArray
destaggering lacking robustness?
Yes, I would say it's ready for v0.0.2. Thanks for the detailed reply, I never realized how finicky using DataArrays and Datasets together is, but this is probably due to my xarray-ignorance...
Closing this for now, I guess. If somebody disagrees strongly we can always reopen and discuss this further.
What happened?
I'm still working on updating the tutorial and blogpost and stumbled upon another issue which I can't quite explain. Somehow, destaggering a
data_var
individually and assigning it back changes the attribute of theDataset
coordinates.Minimal Complete Verifiable Example
Relevant log output
No response
Environment
Anything else we need to know?
No response