Skip to content
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

wrong metadata when reading with Cube function #402

Open
Sonicious opened this issue Jun 6, 2024 · 3 comments
Open

wrong metadata when reading with Cube function #402

Sonicious opened this issue Jun 6, 2024 · 3 comments
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed

Comments

@Sonicious
Copy link
Collaborator

using Zarr
using YAXArrays

da = open_dataset("http://data.rsc4earth.de/EarthSystemDataCube/v3.0.2/esdc-8d-0.25deg-1x720x1440-3.0.2.zarr")
da.kndvi.properties["long_name"]

da = Cube("http://data.rsc4earth.de/EarthSystemDataCube/v3.0.2/esdc-8d-0.25deg-1x720x1440-3.0.2.zarr")
da[Variable = At("kndvi")].properties["long_name"]

These two give different results. Is the metadata read differently or do I have an understanding problem about this?

@felixcremer
Copy link
Member

Metadata handling in the Cube funtion is wrong. I think it just copies the metadata of the first cube in the list.
The problem is, we can only assign one metadata object to the whole cube and a dataset can have global metadata and metadata for every cube.

@meggart
Copy link
Member

meggart commented Jun 6, 2024

Yes, I am more and more convinced that the Cube function should be deprecated in favor of a combination of open_dataset and some to_array to make things more explicit. Alternatively we could think about metadata schemes that are some kind of DimArrays themselves so that some metadata entries can differs for different values along a dimension (hereVariable- dimension) so that metadata can be conserved during concatenation of YAXArrays along a new axis. However, this is not something YAXArrays has to define alone, maybe @rafaqz already has a solution for this in DimensionalData we might re-use.

@rafaqz
Copy link
Contributor

rafaqz commented Jun 6, 2024

Yeah, this is stuff that Raster.jl does already with RasterStack/Raster, mostly defined on AbstractDimStack/AbstractDimArray.

A DimStack has its own metadata and a NamedTuple of metadata for all the layers, and those are attached to a DimArray when you index it by name from the DimStack.

@lazarusA lazarusA added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed labels Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants