This repository was archived by the owner on Jun 2, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
ocf_datapipes/load/nwp/providers Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,13 @@ def open_excarta(zarr_path) -> xr.Dataset:
36
36
Returns:
37
37
Xarray DataArray of the NWP data
38
38
"""
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
39
46
# Doing the wildcard doesn't really work for Excarta at the moment
40
47
if "*" in str (zarr_path ):
41
48
zarr_path = []
@@ -59,10 +66,10 @@ def open_excarta(zarr_path) -> xr.Dataset:
59
66
nwp ["100v" ] = nwp ["100m_wind_speed" ] * np .sin (np .deg2rad (nwp ["100m_wind_speed_angle" ]))
60
67
61
68
# Combine them all into a channels dimension
62
- nwp = nwp .drop_vars (
69
+ nwp : xr . Dataset = nwp .drop_vars (
63
70
["10m_wind_speed" , "10m_wind_speed_angle" , "100m_wind_speed" , "100m_wind_speed_angle" ]
64
71
)
65
- nwp = nwp .to_dataarray (dim = "channel" )
72
+ nwp : xr . DataArray = nwp .to_array (dim = "channel" )
66
73
# Sanity checks.
67
74
time = pd .DatetimeIndex (nwp .init_time_utc )
68
75
assert time .is_unique
You can’t perform that action at this time.
0 commit comments