Skip to content

Herbie 2024.5.0

Compare
Choose a tag to compare
@blaylockbk blaylockbk released this 04 May 04:48
· 194 commits to main since this release

This release of Herbie has some new features and changes I've been developing and experimenting with, so I hope to hear from you if something isn't working as expected or if you have other ideas.


💣 Deprecation / Changes

I renamed the argument searchString to search. This change only affects you if you are using the keyword argument when calling the inventory or xarray methods. Herbie will now give a warning if you use searchString, so please update your scripts.

 from herbie import Herbie
 H = Herbie('2024-01-01')

- H.inventory(searchString="TMP:2 m")
- H.xarray(searchString="TMP:2 m")

+ H.inventory(r"TMP:2 m")
+ H.xarray(r"TMP:2 m")

The reason for the name change is 1) simplicity and 2) the search string isn't an exact match search but is a regex search. (I would have named it filter, but that is a python built-in and couldn't use that). I should also mention that it is recommended to use the r or raw string representation (i.e. search=r":TMP:\d+ mb") since the string is used as a regular expression.


✨ New Feature: ds.herbie.pick_points xarray accessor

I'm very excited to share this new feature. I created a new xarray accessor to get nearest neighbor point data from a model grid. I've had this on my mind for a long time and am happy with what I have made so far. This uses the Ball Tree algorithm, and thus adds scikit-learn as a new required dependency.

Here is a very simple example getting two values from the HRRR grid:

from herbie import Herbie
import pandas as pd

# Get HRRR 2-m temperature analysis
ds = Herbie('2024-1-1', model='hrrr').xarray("TMP:2 m")


# DataFrame of points to get from model grid
points = pd.DataFrame(
    {
        "longitude": [-100.25, -99.4],
        "latitude": [44.25, 45.4],
    }
)

# Pick points from HRRR grid
ds_points = ds.herbie.pick_points(points)

See more in-depth description and examples in the docs. There are options to get values from $k$ nearest neighbors from the requested point and compute the distance-weighted average of nearby points.

If you give this new feature a try, please let me know if you see any unexpected results.

📄 Documentation

I overhauled the organization of the documentation pages. Hopefully you find them organized a little better. Feel free to contribute to the docs if you see some details missing/misleading/confusing 😄


What's Changed

New Contributors

Full Changelog: 2024.3.1...2024.5.0



Future Changes

I am planning to rename the argument fxx for the forecast lead time to step to match the terminology used by cfgrib.

- Herbie('2023-01-01', model='hrrr', fxx=6)
+ Herbie('2023-01-01', model='hrrr', step=6)

Again, this isn't implemented yet, but I plan to implement it eventually and wanted to let you know. Provide any comments if you have any in #160