Skip to content

Commit 2a42206

Browse files
committed
update migration guide
1 parent f7827e0 commit 2a42206

1 file changed

Lines changed: 26 additions & 9 deletions

File tree

docs/v2/migration-guide.rst

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ Create a Herbie Object
8383
8484
from herbie.v2 import Herbie
8585
86-
H = Herbie.HRRR("2025-01-01", step=12)
86+
H = Herbie.HRRR(
87+
"2025-01-01",
88+
step=12
89+
)
8790
8891
----
8992

@@ -112,7 +115,10 @@ The ``fxx`` parameter has been renamed to ``step``.
112115
113116
from datetime import timedelta
114117
115-
H = HRRR("2025-01-01", step=timedelta(hours=6))
118+
H = HRRR(
119+
"2025-01-01",
120+
step=timedelta(hours=6)
121+
)
116122
117123
----
118124

@@ -129,8 +135,14 @@ Inventories are now **Polars DataFrames**, which support fast expression-based f
129135
130136
H.inventory("TMP:2 m")
131137
138+
.. code-block:: python
139+
140+
H.inventory(r"TMP:/d+ mb")
141+
132142
.. grid-item-card:: v2
133143

144+
Same regex search strings work from v1, but you may also use Polars expressions to filter the inventory enabling more flexible filtering.
145+
134146
.. code-block:: python
135147
136148
inv = H.inventory()
@@ -139,11 +151,15 @@ Inventories are now **Polars DataFrames**, which support fast expression-based f
139151
pl.col("variable") == "TMP"
140152
)
141153
142-
Benefits:
154+
inv.filter(
155+
[
156+
pl.col("variable") == "TMP",
157+
pl.col("level").str.ends_with("mb"),
158+
]
159+
160+
)
143161
144-
- Faster performance
145-
- Flexible filtering
146-
- Access to source metadata
162+
The dataframe also includes the source path to the index file, which make the new FastHerbie features possible.
147163

148164
----
149165

@@ -200,18 +216,19 @@ Checking Data Availability
200216

201217
.. grid-item-card:: v1
202218

203-
Source checking was mostly implicit.
219+
Source checking was mostly implicit. File existence was checked when the Herbie object was created.
204220

205221
.. grid-item-card:: v2
206222

207-
You can explicitly resolve sources:
223+
Herbie only checks for file existence when you ask to retrieve data (i.e., using the inventory, download, or xarray methods). You may also explicitly resolve sources to inspect them yourself:
208224

209225
.. code-block:: python
210226
211227
# Default resolution
228+
# Look for first available file
212229
H.resolve()
213230
214-
# Check a specific source
231+
# Check existence at a specific source
215232
H.resolve("google")
216233
217234
# Check all sources

0 commit comments

Comments
 (0)