https://deepmind.google.com/science/weatherlab
https://developers.google.com/weathernext/guides/models
BASE = "weathernext3_spatial/weathernext_3_0_0/zarr/2026_to_present"
RUN = f"{BASE}/{{:%Y%m%d}}_{{:%H}}hr_01_preds/predictions.zarr"
storage_options={
"project": os.environ["GOOGLE_PROJECT_ID"],
"requester_pays": True,
}
fs = gcsfs.GCSFileSystem(**storage_options)
init = next(
t for t in pd.date_range(pd.Timestamp.now(tz="UTC").floor("h"), periods=30, freq="-1h")
if fs.exists(f"weathernext3_spatial/weathernext_3_0_0/zarr/2026_to_present/{t:%Y%m%d}_{t:%H}hr_01_preds/predictions.zarr/zarr.json")
)
print(init)
ds = xr.open_zarr("gs://" + RUN.format(init, init), storage_options=storage_options)
ds = ds.assign_coords(valid_time=ds["init_time"] + ds["lead_time"] + ds["lead_subtime"])
ds = ds.sel(lat_0p1=38.972735, lon_0p1=-76.5459665 % 360, method="nearest")
ds = ds.sel(lat_0p05=38.972735, lon_0p05=-76.5459665 % 360, method="nearest")
ds = ds.stack(time=("lead_time", "lead_subtime")).set_index(time="valid_time").sortby("time")
ds = ds.assign_coords(time=ds.indexes["time"].tz_localize("UTC").tz_convert("America/New_York"))
ds_t2m = ((ds["temperature_2m"] - 273.15) * 9 / 5 + 32)
ds_t2m.attrs["units"] = "F"
ds_station_t2m = ((ds["station_head_temperature_2m"] - 273.15) * 9 / 5 + 32)
ds_station_t2m.attrs["units"] = "F"
from datetime import datetime, timezone
from google.cloud import bigquery
client = bigquery.Client(project="gen-lang-client-0528773000")
# Pick the initialization run (WeatherNext runs hourly)
# Example: 7:00 AM UTC today
init_time_str = "2026-09-25 07:00:00 UTC"
query = f"""
WITH annapolis_point AS (
SELECT ST_GEOGPOINT(-76.5459665, 38.972735) AS pt
),
nearest_grid AS (
SELECT
init_time,
geography,
forecast,
ST_DISTANCE(geography, pt) AS distance_meters
FROM
`gen-lang-client-0528773000.weathernext_3.weathernext_3_0_0_0p05deg`,
annapolis_point
WHERE
init_time = TIMESTAMP('{init_time_str}')
AND ST_DWITHIN(geography, pt, 10000)
ORDER BY distance_meters ASC
LIMIT 1
)
SELECT
f.hours AS lead_hours,
DATETIME(f.time, 'America/New_York') AS valid_time_edt,
ROUND((f.station_head_temperature_2m_mean - 273.15) * 9 / 5 + 32, 2) AS station_temp_2m_f,
ROUND((f.station_head_dewpoint_temperature_2m_mean - 273.15) * 9 / 5 + 32, 2) AS station_dewpoint_2m_f
FROM
nearest_grid,
UNNEST(forecast) AS f
ORDER BY
f.hours ASC;
"""
df = client.query(query).to_dataframe()