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

feat: define separate collections for each product, define GRIB layers with byte ranges in 'grib:layers' asset metadata #6

Merged
merged 49 commits into from
Jun 20, 2024

Conversation

hrodmn
Copy link
Collaborator

@hrodmn hrodmn commented Jun 13, 2024

After a lengthy discussion in #1 and #3, this is the approach that I have settled on for representing the HRRR data in STAC metadata to start. The grib:layers property for each .grib asset will enable applications to construct coherent xarray datasets from an Item or ItemCollection.

Check out the examples/ folder for example collection and item metadata.

STAC metadata structure

  • One collection per region x product combination
    • regions: conus and alaska
    • products: sfc, prs, nat, and subh
  • Collection-level datacube extension metadata
  • One item per GRIB file in the archive
  • Two assets per item:
    • "grib": actual file containing data
    • "index": .grib2.idx sidecar file with layer-level metadata
  • Within each "grib" asset, a grib:layers property with details about each layer in the .grib2 file
    • details include human-readable description, units, and access information like start_byte, byte_size.
    • this is something that could be generalized across all GRIB datasets but would need to study the GRIB metadata specification in more detail to do it properly
    • storing the byte ranges in STAC would make them accessible to any application that can read STAC metadata without needing to load the .idx files again.

Advantages

  • Applications can make use of the grib:layers property from the grib asset in each item to create layer-specific dsns that the GDAL GRIB driver can read
    • using /vsisubfile: /vsisubfile/{layer['start_byte']}_{layer['byte_size']},/vsicurl/{grib_asset.href}
    • or href://: `vrt:///vsicurl/{grib_asset.href}?bands={layer['grib_message']}
  • Splitting the archive up by region and product makes it possible to define coherent collection-level datacube metadata which should improve the accessibility of the many layers of the dataset for exploratory applications and new users

Disadvantages

  • Storing the byte ranges in STAC metadata is not a typical pattern
    • Creates a redundant copy of information that is already in the .idx file
    • Storing layer-level information in json for each item is inefficient
  • More collections might make it more difficult for new users to become familiar with the contents.

Considerations

  • The discussion in /vsisubfile reads GRIB2 files inconsistently OSGeo/gdal#10214 shows that GDAL can read subsets of data using the vrt syntax with the band index of interest. If we want to leave the byte range data out of the STAC metadata and think harder about whether or not that belongs in STAC, that would be fine. We would still need some layer-level metadata but the byte ranges are not absolutely necessary.

Comment on lines +127 to +142
RENDER_PARAMS = {
Product.sfc: {
"WIND__10_m_above_ground__periodic_max": {
"title": "Wind speed (m/s) 10 m above ground",
"colormap_name": "viridis",
"rescale": [[0, 20]],
"resampling": "nearest",
},
"DSWRF__surface__point_in_time": {
"title": "Downward Short-Wave Radiation Flux (W/m2)",
"colormap_name": "rainbow",
"rescale": [[0, 800]],
"resampling": "nearest",
},
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abarciauskas-bgse @vincentsarago the render parameters are not complete because we will need to specify the layer-specific dsn rather than specify a STAC asset.

@hrodmn hrodmn removed the request for review from sharkinsspatial June 20, 2024 13:29
@hrodmn hrodmn merged commit 67a4ece into main Jun 20, 2024
6 checks passed
hrodmn added a commit that referenced this pull request Jun 20, 2024
…s with byte ranges in 'grib:layers' asset metadata (#6)

* define collection + item + asset structure
* add grib:layers asset property for describing layers within GRIB2 files
hrodmn added a commit that referenced this pull request Jun 20, 2024
…s with byte ranges in 'grib:layers' asset metadata (#6)

* define collection + item + asset structure
* add grib:layers asset property for describing layers within GRIB2 files
hrodmn added a commit that referenced this pull request Jun 20, 2024
…s with byte ranges in 'grib:layers' asset metadata (#6)

* define collection + item + asset structure
* add grib:layers asset property for describing layers within GRIB2 files
hrodmn added a commit that referenced this pull request Jun 20, 2024
…s with byte ranges in 'grib:layers' asset metadata (#6)

* define collection + item + asset structure
* add grib:layers asset property for describing layers within GRIB2 files
hrodmn added a commit that referenced this pull request Jun 20, 2024
…s with byte ranges in 'grib:layers' asset metadata (#6)

* define collection + item + asset structure
* add grib:layers asset property for describing layers within GRIB2 files
hrodmn added a commit that referenced this pull request Jun 21, 2024
…s with byte ranges in 'grib:layers' asset metadata (#6)

* define collection + item + asset structure
* add grib:layers asset property for describing layers within GRIB2 files
hrodmn added a commit that referenced this pull request Jun 21, 2024
…s with byte ranges in 'grib:layers' asset metadata (#6)

* define collection + item + asset structure
* add grib:layers asset property for describing layers within GRIB2 files
hrodmn added a commit that referenced this pull request Jun 24, 2024
…s with byte ranges in 'grib:layers' asset metadata (#6)

* define collection + item + asset structure
* add grib:layers asset property for describing layers within GRIB2 files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants