-
Notifications
You must be signed in to change notification settings - Fork 0
Side by side animations #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d2a75ef
f60a9ab
5f86d81
5a24380
ba0029b
31fcb65
91cdf61
0088c37
9b07bd0
7b0b247
7fcbf8a
2d25a53
24848f1
d162b37
f3e1c30
71a65c1
51bb6fc
e2db0c9
1144291
f2180a1
c26dd24
2fe543a
68487ba
8e76a1b
c9bb0ed
c72310f
f91cd65
d94e913
8729776
3ca16c3
bc27168
c283580
a291c59
1ce6b77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Showcase config for interpolators-ich1. | ||
| # Includes the base config and overrides only the showcase section. | ||
| # | ||
| # .venv/bin/evalml showcase config/showcase-interpolators-ich1.yaml | ||
|
|
||
| include: interpolators-ich1.yaml | ||
|
|
||
| showcase: | ||
| params: | ||
| - T_2M | ||
| - SP_10M | ||
| - TOT_PREC | ||
| meteograms: | ||
| enabled: false | ||
| stations: [JUN] | ||
| animations: | ||
| enabled: true | ||
| domains: | ||
| - europe | ||
| - switzerland | ||
| - globe | ||
| speed: 10 # simulated hours per second | ||
| runs: | ||
| - Varda-Single | ||
| comparisons: | ||
| - left: Varda-Single | ||
| right: KENDA-CH1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| from datetime import datetime | ||
| from datetime import datetime, timedelta | ||
| from pathlib import Path | ||
|
|
||
| import earthkit.data as ekd | ||
|
|
@@ -77,6 +77,60 @@ def load_state_from_grib( | |
| return state | ||
|
|
||
|
|
||
| def load_state_from_zarr( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to wait for #153 and read from GRIB files directly?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I thought so, but unfortunately the truth seems to stay in zarr, so I am assuming we need it still to be able to plot the truth? |
||
| zarr_root: Path, | ||
| reftime: datetime, | ||
| lead_time_hours: int, | ||
| params: list[str], | ||
| source_type: str = "analysis", | ||
| ) -> dict: | ||
| """Load a single time step from a zarr source into the state dict used by StatePlotter. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| zarr_root: | ||
| Path to the zarr dataset. | ||
| reftime: | ||
| Forecast reference time (init time). | ||
| lead_time_hours: | ||
| Lead time in hours to load. | ||
| params: | ||
| List of parameter names (ICON convention, e.g. ``['U_10M', 'V_10M']``). | ||
| source_type: | ||
| ``'analysis'`` for truth zarrs (loads via ``load_analysis_data_from_zarr``), | ||
| ``'baseline'`` for baseline forecast zarrs. | ||
| """ | ||
| from data_input import load_analysis_data_from_zarr, load_baseline_from_zarr | ||
|
|
||
| steps = [lead_time_hours] | ||
|
|
||
| if source_type == "analysis": | ||
| ds = load_analysis_data_from_zarr(zarr_root, reftime, steps, params) | ||
| ds_t = ds.isel(time=0) if "time" in ds.dims else ds.squeeze() | ||
| else: | ||
| ds = load_baseline_from_zarr(zarr_root, reftime, steps, params) | ||
| ds_t = ds.isel(lead_time=0) if "lead_time" in ds.dims else ds.squeeze() | ||
|
|
||
| lat = ds_t.lat.values.flatten() | ||
| lon = ds_t.lon.values.flatten() | ||
|
|
||
| hull = MultiPoint(list(zip(lon.tolist(), lat.tolist()))).convex_hull | ||
| state = { | ||
| "forecast_reference_time": reftime, | ||
| "valid_time": reftime + timedelta(hours=lead_time_hours), | ||
| "longitudes": lon, | ||
| "latitudes": lat, | ||
| "lam_envelope": gpd.GeoSeries([hull], crs="EPSG:4326"), | ||
| "fields": {}, | ||
| } | ||
| for param in params: | ||
| if param in ds_t.data_vars: | ||
| state["fields"][param] = ds_t[param].values.flatten() | ||
| else: | ||
| state["fields"][param] = np.full(lat.size, np.nan, dtype=float) | ||
| return state | ||
|
|
||
|
|
||
| def load_state_from_raw( | ||
| file: Path, paramlist: list[str] | None = None | ||
| ) -> dict[str, np.ndarray | dict[str, np.ndarray]]: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.