Examples of seachString #105
-
Can you point me to a place that has the variable search strings I'd need to retrieve data? For example, if I want surface wind speed from the GFS, what exactly does that look like? I found this example: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Essentially, the searchString argument defines a regex search string done on the GRIB2 inventory file to find where the variables you want are located in the file. For U and V winds at 10 m, you can set searchString=":(?:U|V)GRD:10 m above ground" Here's an example with GFS from herbie import Herbie
H = Herbie('2022-01-01', model='gfs') To show the inventory file as a dataframe, you can do H.read_idx() this produces a dataframe for each of the rows in the index file In fact, you can use that command to try out different search strings until you get what you want H.read_idx(searchString=":(?:U|V)GRD:10 m above ground") This filters the dataframe to show only the rows containing 10 m winds When your search string finds the variables you want, you can read the data with xarray like this... ds = H.xarray(searchString=":(?:U|V)GRD:10 m above ground")
ds produces the xarray dataset For temperature, you can do this ds = H.xarray(searchString=":TMP:2 m above ground")
ds.t2m which gives you the xarray dataAarray of temperature |
Beta Was this translation helpful? Give feedback.
Essentially, the searchString argument defines a regex search string done on the GRIB2 inventory file to find where the variables you want are located in the file.
Look at this page for more examples of what to set "searchString" to
🪂 Subset with searchString
For U and V winds at 10 m, you can set
Here's an example with GFS
To show the inventory file as a dataframe, you can do
this produces a dataframe for each of the rows in the index file
In fact, you can use that command to try out different search strings until you get what you want