Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit 2b1f7b6

Browse files
committed
Fix loading prepared hindcast
1 parent 03baa44 commit 2b1f7b6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ocf_datapipes/load/nwp/providers/excarta.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ def open_excarta(zarr_path) -> xr.Dataset:
3636
Returns:
3737
Xarray DataArray of the NWP data
3838
"""
39+
40+
if "hindcast" in str(zarr_path): # Preprocessed one
41+
nwp = open_zarr_paths(zarr_path)
42+
time = pd.DatetimeIndex(nwp.init_time_utc)
43+
assert time.is_unique
44+
assert time.is_monotonic_increasing
45+
return nwp
3946
# Doing the wildcard doesn't really work for Excarta at the moment
4047
if "*" in str(zarr_path):
4148
zarr_path = []
@@ -59,10 +66,10 @@ def open_excarta(zarr_path) -> xr.Dataset:
5966
nwp["100v"] = nwp["100m_wind_speed"] * np.sin(np.deg2rad(nwp["100m_wind_speed_angle"]))
6067

6168
# Combine them all into a channels dimension
62-
nwp = nwp.drop_vars(
69+
nwp: xr.Dataset = nwp.drop_vars(
6370
["10m_wind_speed", "10m_wind_speed_angle", "100m_wind_speed", "100m_wind_speed_angle"]
6471
)
65-
nwp = nwp.to_dataarray(dim="channel")
72+
nwp: xr.DataArray = nwp.to_array(dim="channel")
6673
# Sanity checks.
6774
time = pd.DatetimeIndex(nwp.init_time_utc)
6875
assert time.is_unique

0 commit comments

Comments
 (0)