Skip to content
Snippets Groups Projects
Commit 9cf4a272 authored by Bing Gong's avatar Bing Gong
Browse files

Replace the raise error by giving warning message. since for some month, there...

Replace the raise error by giving warning message. since for some month, there are missing data from raw dataset
parent a9398237
No related branches found
No related tags found
No related merge requests found
Pipeline #59171 passed
...@@ -12,6 +12,7 @@ from mpi4py import MPI ...@@ -12,6 +12,7 @@ from mpi4py import MPI
from general_utils import get_unique_vars from general_utils import get_unique_vars
from statistics import Calc_data_stat from statistics import Calc_data_stat
from data_preprocess.preprocess_data_step2 import * from data_preprocess.preprocess_data_step2 import *
import warnings
def main(): def main():
...@@ -50,8 +51,7 @@ def main(): ...@@ -50,8 +51,7 @@ def main():
# process stat-file: # process stat-file:
stat_obj.acc_stat_master(file_dir, int(month)) # process monthly statistic-file stat_obj.acc_stat_master(file_dir, int(month)) # process monthly statistic-file
else: else:
raise ("The stat file does not exist:", os.path.join(file_dir, "stat_" + '{0:02}'.\ warnings.warn("The stat file for year {} month {} does not exist".format(year, month))
format(month) + ".json"))
# finalize statistics and write to json-file # finalize statistics and write to json-file
stat_obj.finalize_stat_master(vars_uni) stat_obj.finalize_stat_master(vars_uni)
stat_obj.write_stat_json(input_dir_pkl) stat_obj.write_stat_json(input_dir_pkl)
......
  • Maintainer

    Hmm I find that critical. If there's missing data, the data is not very trustful at all and I would pefer an error

  • I was preprocessing the data for year 2014. In slmet, the month 9 of this year is missing. this will cause the "if" function cannot find the statistic json file in the folder 2014/09. this error related the origin data sources, but should not raise error here.

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment