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

Add a wrapper for wgrib2 in Herbie. #161

Merged
merged 12 commits into from
Mar 11, 2023
Merged

Add a wrapper for wgrib2 in Herbie. #161

merged 12 commits into from
Mar 11, 2023

Conversation

blaylockbk
Copy link
Owner

@blaylockbk blaylockbk commented Jan 28, 2023

TLDR; This pull requests lays the foundation for using the wgrib2 in Herbie by building a wgrib2 wrapper.


wgrib2 is a powerful command line utility for working with GRIB2 files. It is not easily installable on Windows. Still, including this wrapper will let Herbie help someone use wgrib2, if it is installed.

Note: wgrib2 can be installed for linux from conda-forge.

from herbie.wgrib2 import wgrib2

# Print the path to the wgrib2 executable
print(wgrib2.wgrib2)

# Create an inventory of a downloaded GRIB2 file (return inventory as a string).
wgrib2.inventory("/path/to/file.grib2")

# Create a regional subset of a file
wgrib2.region("/path/to/file.grib2", extent=(-100,90,30,40))

# Check if vector quantities are earth or grid relatvie
wgrib2.vector_relative("/path/to/file.grib2")

Class Methods

  • Create an inventory of a downloaded GRIB2 file (returns inventory as a string).
  • Create inventory files for a GRIB2 file (returns nothing, just saves files to disk).
  • Make geographical area subsets (Fixes Add interface to wgrib2 to produce subset #109)
  • Determine if wind vectors are "earth-relative" or "grid-relative"

TODO

  • Use this new wrapper in the Herbie class.
  • Update tests to use the new wrapper.

@blaylockbk blaylockbk added this to the Next Release milestone Jan 28, 2023
@blaylockbk blaylockbk merged commit 7577663 into main Mar 11, 2023
@blaylockbk blaylockbk deleted the add-wgrib2-wrapper branch December 15, 2023 03:49
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.

Add interface to wgrib2 to produce subset
1 participant