diff --git a/video_prediction_tools/env_setup/requirements.txt b/video_prediction_tools/env_setup/requirements.txt index 4352cbd3bcf369a754ee65e617c45a0f1bf522ff..28b7c6f83865095745ccab685b08c60aba8a71f9 100755 --- a/video_prediction_tools/env_setup/requirements.txt +++ b/video_prediction_tools/env_setup/requirements.txt @@ -6,3 +6,4 @@ basemap==1.3.0 numpy==1.17.3 # although this numpy-version is in the container, we set it here to avoid any further installation scikit-image==0.18.1 opencv-python-headless==4.2.0.34 +netcdf4 diff --git a/video_prediction_tools/main_scripts/main_visualize_postprocess.py b/video_prediction_tools/main_scripts/main_visualize_postprocess.py index 5606a1e5fb48b93c95319c24aa30f828cdf536a2..f95cfd79d9439a3009a0ca60c29fe57559024b00 100644 --- a/video_prediction_tools/main_scripts/main_visualize_postprocess.py +++ b/video_prediction_tools/main_scripts/main_visualize_postprocess.py @@ -1045,7 +1045,11 @@ class Postprocess(TrainModel): var_pickle.extend(var_origin_pickle) # Retrieve starting index - ind = list(time_pickle).index(np.array(ts_persistence[0])) + try: + ind = list(time_pickle).index(np.array(ts_persistence[0])) + except Exception as err: + print("Please consider return Data preprocess step 1 to generate entire month data") + raise err var_persistence = np.array(var_pickle)[ind:ind + len(ts_persistence)] time_persistence = np.array(time_pickle)[ind:ind + len(ts_persistence)].ravel() @@ -1144,10 +1148,10 @@ class Postprocess(TrainModel): raise NotADirectoryError("%{0}: The directory to store the netCDf-file does not exist.".format(method)) encode_nc = {key: {"zlib": True, "complevel": comp_level} for key in ds.keys()} - + # populate data in netCDF-file (take care for the mode!) try: - ds.to_netcdf(nc_fname, encoding=encode_nc) + ds.to_netcdf(nc_fname, encoding=encode_nc,engine="netcdf4") print("%{0}: netCDF-file '{1}' was created successfully.".format(method, nc_fname)) except Exception as err: print("%{0}: Something unexpected happened when creating netCDF-file '1'".format(method, nc_fname))