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

Commit 57e0451

Browse files
Sukhil PatelSukhil Patel
authored andcommitted
Update normalisation constants
1 parent 602f87b commit 57e0451

File tree

2 files changed

+36
-8
lines changed

2 files changed

+36
-8
lines changed

ocf_datapipes/training/pvnet_site.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ def construct_sliced_data_pipeline(
188188
location_pipe: IterDataPipe,
189189
t0_datapipe: IterDataPipe,
190190
production: bool = False,
191+
new_normalisation_constants: bool = False
191192
) -> dict:
192193
"""Constructs data pipeline for the input data config file.
193194
@@ -198,6 +199,7 @@ def construct_sliced_data_pipeline(
198199
location_pipe: Datapipe yielding locations.
199200
t0_datapipe: Datapipe yielding times.
200201
production: Whether constucting pipeline for production inference.
202+
new_normalisation_constants: whether new normalisation constants are used.
201203
"""
202204

203205
datapipes_dict = _get_datapipes_dict(
@@ -245,8 +247,10 @@ def construct_sliced_data_pipeline(
245247
# Somewhat hacky way for India specifically, need different mean/std for ECMWF data
246248
if conf_nwp[nwp_key].nwp_provider in ["ecmwf"]:
247249
normalize_provider = "ecmwf_india"
248-
elif conf_nwp[nwp_key].nwp_provider in ["gfs"]:
249-
normalize_provider = "gfs_india"
250+
elif new_normalisation_constants and conf_nwp[nwp_key].nwp_provider in ["mo_global"]:
251+
normalize_provider = "mo_global_new_india"
252+
elif new_normalisation_constants and conf_nwp[nwp_key].nwp_provider in ["gfs"]:
253+
normalize_provider = "gfs_india"
250254
else:
251255
normalize_provider = conf_nwp[nwp_key].nwp_provider
252256

ocf_datapipes/utils/consts.py

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def __getitem__(self, key):
4848
"merra2",
4949
"merra2_uk",
5050
"mo_global",
51+
"mo_global_new_india"
5152
]
5253

5354
# ------ UKV
@@ -133,9 +134,29 @@ def __getitem__(self, key):
133134
UKV_STD = _to_data_array(UKV_STD)
134135
UKV_MEAN = _to_data_array(UKV_MEAN)
135136

136-
# --- MO Global
137+
# --- MO Global (partial initial constants)
137138

138139
MO_GLOBAL_INDIA_MEAN = {
140+
"temperature_sl": 298.2,
141+
"wind_u_component_10m": 0.5732,
142+
"wind_v_component_10m": -0.2831,
143+
}
144+
145+
MO_GLOBAL_INDIA_STD = {
146+
"temperature_sl": 8.473,
147+
"wind_u_component_10m": 2.599,
148+
"wind_v_component_10m": 2.016,
149+
}
150+
151+
152+
MO_GLOBAL_VARIABLE_NAMES = tuple(MO_GLOBAL_INDIA_MEAN.keys())
153+
MO_GLOBAL_INDIA_STD = _to_data_array(MO_GLOBAL_INDIA_STD)
154+
MO_GLOBAL_INDIA_MEAN = _to_data_array(MO_GLOBAL_INDIA_MEAN)
155+
156+
157+
# --- MO Global New
158+
159+
MO_GLOBAL_INDIA_NEW_MEAN = {
139160
"temperature_sl": 295.34392488,
140161
"wind_u_component_10m": 0.83223102,
141162
"wind_v_component_10m": 0.0802083,
@@ -148,7 +169,7 @@ def __getitem__(self, key):
148169
"visibility_sl": 23181.81547681,
149170
}
150171

151-
MO_GLOBAL_INDIA_STD = {
172+
MO_GLOBAL_INDIA_NEW_STD = {
152173
"temperature_sl": 12.26983825,
153174
"wind_u_component_10m": 3.45169835,
154175
"wind_v_component_10m": 2.9825603,
@@ -162,9 +183,9 @@ def __getitem__(self, key):
162183
}
163184

164185

165-
MO_GLOBAL_VARIABLE_NAMES = tuple(MO_GLOBAL_INDIA_MEAN.keys())
166-
MO_GLOBAL_INDIA_STD = _to_data_array(MO_GLOBAL_INDIA_STD)
167-
MO_GLOBAL_INDIA_MEAN = _to_data_array(MO_GLOBAL_INDIA_MEAN)
186+
MO_GLOBAL_NEW_VARIABLE_NAMES = tuple(MO_GLOBAL_INDIA_NEW_MEAN.keys())
187+
MO_GLOBAL_INDIA_NEW_STD = _to_data_array(MO_GLOBAL_INDIA_NEW_STD)
188+
MO_GLOBAL_INDIA_NEW_MEAN = _to_data_array(MO_GLOBAL_INDIA_NEW_MEAN)
168189

169190

170191
# ------ GFS
@@ -213,7 +234,7 @@ def __getitem__(self, key):
213234
GFS_MEAN = _to_data_array(GFS_MEAN)
214235

215236

216-
# ------ GFS
237+
# ------ GFS India
217238
GFS_INDIA_STD_DICT = {
218239
"t": 14.93798,
219240
"prate": 5.965701e-05,
@@ -434,6 +455,7 @@ def __getitem__(self, key):
434455
merra2=MERRA2_VARIABLE_NAMES,
435456
merra2_uk=UK_MERRA2_VARIABLE_NAMES,
436457
mo_global=MO_GLOBAL_VARIABLE_NAMES,
458+
mo_global_new_india=MO_GLOBAL_NEW_VARIABLE_NAMES
437459
)
438460
NWP_STDS = NWPStatDict(
439461
ukv=UKV_STD,
@@ -445,6 +467,7 @@ def __getitem__(self, key):
445467
merra2=MERRA2_STD,
446468
merra2_uk=UK_MERRA2_STD,
447469
mo_global=MO_GLOBAL_INDIA_STD,
470+
mo_global_new_india=MO_GLOBAL_INDIA_NEW_STD,
448471
)
449472
NWP_MEANS = NWPStatDict(
450473
ukv=UKV_MEAN,
@@ -456,6 +479,7 @@ def __getitem__(self, key):
456479
merra2=MERRA2_MEAN,
457480
merra2_uk=UK_MERRA2_MEAN,
458481
mo_global=MO_GLOBAL_INDIA_MEAN,
482+
mo_global_new_india=MO_GLOBAL_INDIA_NEW_MEAN
459483
)
460484

461485
# --------------------------- SATELLITE ------------------------------

0 commit comments

Comments
 (0)