This repository was archived by the owner on Sep 11, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
nowcasting_dataset/dataset Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,32 @@ def load_netcdf(
159159 metadata = load_from_csv (path = local_netcdf_path , batch_size = batch_size , batch_idx = batch_idx )
160160 batch_dict ["metadata" ] = metadata .dict ()
161161
162+ # quick options to turn on when using legacy data e.g v15
163+ legacy_data = False
164+ if legacy_data :
165+ # legacy GSP
166+ if "gsp" in batch_dict .keys ():
167+ batch_dict ["gsp" ] = batch_dict ["gsp" ].rename (
168+ {"x_coords" : "x_osgb" , "y_coords" : "y_osgb" }
169+ )
170+
171+ # legacy PV
172+ if "pv" in batch_dict .keys ():
173+ batch_dict ["pv" ] = batch_dict ["pv" ].rename (
174+ {"x_coords" : "x_osgb" , "y_coords" : "y_osgb" }
175+ )
176+
177+ # legacy NWP
178+ if "nwp" in batch_dict .keys ():
179+ batch_dict ["nwp" ] = batch_dict ["nwp" ].rename (
180+ {
181+ "x_index" : "x_osgb_index" ,
182+ "y_index" : "y_osgb_index" ,
183+ "x" : "x_osgb" ,
184+ "y" : "y_osgb" ,
185+ }
186+ )
187+
162188 try :
163189 batch = Batch (** batch_dict )
164190 except Exception as e :
@@ -191,7 +217,7 @@ def download_batch_and_load_batch(
191217
192218 if batch_idx == 0 :
193219 for data_source in data_sources_names :
194- os .makedirs (f"{ tmp_path } /{ data_source } " )
220+ os .makedirs (f"{ tmp_path } /{ data_source } " , exist_ok = True )
195221
196222 # download all data files
197223 for data_source in data_sources_names :
You can’t perform that action at this time.
0 commit comments