You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -516,13 +503,7 @@ def __init__( # inherits all the stuff from Base
516
503
)
517
504
files=glob.glob(var_dir+f"/*.nc", recursive=True)
518
505
iflen(files) ==0:
519
-
print(
520
-
"No files for this scenario, year, ensemble member pairing:",
521
-
exp,
522
-
y,
523
-
em,
524
-
)
525
-
exit(0)
506
+
raiseFileNotFoundError(f"No files could be found for scenario {exp}, year {y}, and ensemble member {em}. Check if climate model runs for that pairing actually exist.")
526
507
# loads all years!
527
508
output_nc_files+=files
528
509
files_per_var.append(output_nc_files)
@@ -540,7 +521,6 @@ def __init__( # inherits all the stuff from Base
540
521
)
541
522
542
523
ifos.path.isfile(stats_fname):
543
-
print("Stats file already exists! Loading from memory.")
s=f" Super Emulator dataset: {len(self.index_manager.climate_models)} climate models with {self.index_manager.num_ensembles} ensemble members and {self.n_years} years used, with a total size of {len(self)} examples (in, out)."
523
-
returns
507
+
returnf" Super Emulator dataset: {len(self.index_manager.climate_models)} climate models with {self.index_manager.num_ensembles} ensemble members and {self.n_years} years used, with a total size of {len(self)} examples (in, out)."
524
508
525
509
526
510
def__len__(self):
@@ -531,8 +515,7 @@ def __len__(self):
531
515
# elif self.mode=='train+val':
532
516
# return self.get_initial_length()
533
517
else:
534
-
print("Unknown mode.", self.mode)
535
-
raiseValueError
518
+
raiseValueError(f"Unknown mode: {self.mode}")
536
519
537
520
538
521
@@ -588,7 +571,7 @@ def __init__( # inherits all the stuff from Base
588
571
os.path.join(output_save_dir, fname)
589
572
): # we first need to get the name here to test that...
@@ -621,16 +604,7 @@ def __init__( # inherits all the stuff from Base
621
604
)
622
605
files=glob.glob(var_dir+f"/*.nc", recursive=True)
623
606
iflen(files) ==0:
624
-
print(
625
-
"No files for this climate model, ensemble member, var, year ,scenario:",
626
-
climate_model,
627
-
data_dir.split("/")[-1],
628
-
var,
629
-
y,
630
-
exp,
631
-
)
632
-
print("Exiting! Please fix the data issue.")
633
-
exit(0)
607
+
raiseFileNotFoundError(f"No files for climate model {climate_model}, ensemble member {data_dir.split("/")[-1]}, var {var}, year {y}, scenario {exp}. Please check if climate model runs for this exact pairing actually exist.")
634
608
# loads all years! implement splitting
635
609
output_nc_files+=files
636
610
files_per_var.append(output_nc_files)
@@ -648,7 +622,7 @@ def __init__( # inherits all the stuff from Base
648
622
)
649
623
650
624
ifos.path.isfile(fname):
651
-
print("Stats file already exists! Loading from memory.")
625
+
#print("Stats file already exists! Loading from memory.")
0 commit comments