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

Update DataCube Extension to the latest version (support in assets) #856

Closed
m-mohr opened this issue Jul 25, 2022 · 2 comments · Fixed by #1269
Closed

Update DataCube Extension to the latest version (support in assets) #856

m-mohr opened this issue Jul 25, 2022 · 2 comments · Fixed by #1269
Assignees
Labels
enhancement extension Implement a STAC extension in PySTAC
Milestone

Comments

@m-mohr
Copy link
Contributor

m-mohr commented Jul 25, 2022

The data cube extension is available in 2.1.0 and now supports fields also in assets. It would be nice to support this.


Original post:

I'm trying to use the DataCube extension in PySTAC, but I'm struggling:

        asset = Asset.from_dict({...})
        item.add_asset("netcdf", asset)
        dc = DatacubeExtension.ext(asset, add_if_missing=True)
        for key, dim in dataset.dimensions.items():
            dc.dimensions[dim.name] = AdditionalDimension({...})
        for key, var in dataset.variables.items():
            dc.variables[var.name] = Variable({...})

I'm getting: <AssetDatacubeExtension Item id=tests/data-files/OR_GLM-L2-LCFA_G16_s20203662359400_e20210010000004_c20210010000030.ncdoes not have required property cube:dimensions

How is it meant to be used? Is this a bug?

@m-mohr m-mohr changed the title Use of the DataCube extension for assets? Update DataCube Extension to 2.1.0 (support in assets) Jul 26, 2022
@m-mohr m-mohr added enhancement extension Implement a STAC extension in PySTAC and removed question labels Jul 26, 2022
@duckontheweb duckontheweb added this to the 1.7 milestone Jul 27, 2022
@m-mohr m-mohr changed the title Update DataCube Extension to 2.1.0 (support in assets) Update DataCube Extension to the latest version (support in assets) Nov 9, 2022
@constantinius
Copy link

@m-mohr It looks like this is also an issue when used with Collections and Items. I also found out how it seems like it is meant to be used: the dimensions should be treated as immutable, and must be set to the DatacubeExtension as a whole, and not added piece wise. This works for me (both for Asset and Item):

datacube: DatacubeExtension

dimensions = {}

dimension = HorizontalSpatialDimension({
    ...
})
dimensions[name] = dimension

datacube.dimensions = dimensions

I think it is way to easy to get this wrong. At least some documentation is missing in how to use it the intended way.

@gadomski gadomski modified the milestones: 1.7, 1.8 Jan 31, 2023
@gadomski gadomski removed this from the 1.8 milestone May 4, 2023
@gadomski
Copy link
Member

Datacube is now at v2.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement extension Implement a STAC extension in PySTAC
Projects
No open projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

4 participants