11# Accessing Hydro Forecast Data
22
3- ** One Hour Short Range (All)**
3+ ## Short Range (All)
4+
45``` python
56import time
67import xarray as xr
3132# > streamflow (init_time, forecast_time, feature_id) float64 400MB 0.17 ...
3233```
3334
35+ ## Short Range (Subset)
3436``` python
3537import time
3638import xarray as xr
@@ -49,7 +51,6 @@ reaches = [
4951 24423427
5052]
5153
52- # --- Short Range ---
5354uri = " https://data.lynker-spatial.com/nwm/short_range/2025090214.zarr"
5455start = time.time()
5556ds = xr.open_dataset(uri, engine = " zarr" , chunks = " auto" )
@@ -75,8 +76,30 @@ ds = ds.where(ds.feature_id.isin(reaches), drop=True)
7576ds = ds.load()
7677end = time.time()
7778# > 0.793 seconds
79+ ```
80+
81+ ## Short Range (Query)
82+ ``` python
83+ import xarray as xr
84+ import dask
85+
86+ uri = " https://data.lynker-spatial.com/nwm/short_range/2025090214.zarr"
7887
79- # --- Analysis and Assimilation ---
88+ # Read Zarr metadata
89+ ds = xr.open_dataset(uri, engine = " zarr" , chunks = " auto" )
90+
91+ # Find 9 reaches where the streamflow exceeded 10 at least once
92+ cond = (ds.streamflow > 10 ).compute()
93+ reaches = ds.where(cond, drop = True ).feature_id[:9 ]
94+ ds = ds.sel(feature_id = reaches, drop = True )
95+ ds_mem = ds.load()
96+ ```
97+
98+ ![ ] ( /img/short-range-query.png )
99+
100+ ## Analysis and Assimilation
101+
102+ ``` python
80103uri = " https://data.lynker-spatial.com/nwm/analysis/2025090214.zarr"
81104start = time.time()
82105ds = xr.open_dataset(uri, engine = " zarr" , chunks = " auto" )
@@ -102,8 +125,10 @@ ds = ds.where(ds.feature_id.isin(reaches), drop=True)
102125ds = ds.load()
103126end = time.time()
104127# > 3.0864 seconds
128+ ```
105129
106- # --- NWIS ---
130+ ## NWIS Observations
131+ ``` python
107132uri = " https://data.lynker-spatial.com/nwis/2025090214_discharge.zarr"
108133start = time.time()
109134ds = xr.open_dataset(uri, engine = " zarr" )
0 commit comments