diff --git a/SAMIR_xls/SAMIRv5.1_2020.xlsx b/SAMIR_xls/SAMIRv5.1_2020.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..1dc6a7a27135f067c124ac5596884b8516fd2020 Binary files /dev/null and b/SAMIR_xls/SAMIRv5.1_2020.xlsx differ diff --git a/config/config.py b/config/config.py index 37dd30c18805b1fc714b8cd1c62de069cac6b932..0f0f242314cfbda10100edf85f0f778644acc06b 100644 --- a/config/config.py +++ b/config/config.py @@ -22,22 +22,24 @@ class config: - end_date: ``str`` - mode: ``str`` - run_name: ``str`` - - path_to_config_file: ``str`` + - path_to_eodag_config_file: ``str`` - preferred_provider: ``str`` - cloud_cover_limit: ``int`` - - minimum_overlap: ``str`` - data_path: ``str`` - output_path: ``str`` - soil_path: ``str`` - landcover_path: ``str`` + - irrigation_mask_path: ``str`` - shapefile_path: ``str`` - param_csv_file: ``str`` + - init_RU_path: ``str`` - resolution: ``int`` - ndvi_overwrite: ``bool`` - weather_overwrite: ``bool`` - open_browser: ``bool`` - max_cpu: ``int`` - max_ram: ``int`` + - compress_outputs: ``bool`` - additional_output: ``dict`` - parcel_shapefile_vars: ``list`` """ diff --git a/config/config_modspa.example.json b/config/config_modspa.example.json index 62edba7dbe412af58cc81005971d1770276a25ee..48ea1caff22992899d6c98f1e66f418b22a8d5f7 100644 --- a/config/config_modspa.example.json +++ b/config/config_modspa.example.json @@ -62,6 +62,9 @@ "_comment": "Max amount of RAM memory (in GiB) to use for calculations", "max_ram": 16, + "_comment": "Choice to compress output netCDF file (takes less space but longer to write)", + "compress_outputs": false, + "_comment": "Dictionnary containing the name of additionnal variables to write in output and the integer scaling factor. Equal to null if no additionnal output is required.", "additional_output": null, diff --git a/main_run_samir.py b/main_run_samir.py index b0a017a75d1673f8f9bf3ab9738b970e3833cc28..b2ba41dde9075bd458684b1d9293b70c6864d953 100644 --- a/main_run_samir.py +++ b/main_run_samir.py @@ -82,7 +82,7 @@ if __name__ == '__main__': output_shapefile_dir = os.path.join(data_path, 'SHP', run_name) # Run SAMIR - run_samir(param_csv_file, ndvi_path, weather_path, soil_path, land_cover_path, irrigation_mask_path, init_RU_path, Kcb_max_obs_path, output_save_path, additional_outputs = config_params.additional_output, available_ram = max_ram, available_cpu = max_cpu) + run_samir(param_csv_file, ndvi_path, weather_path, soil_path, land_cover_path, irrigation_mask_path, init_RU_path, Kcb_max_obs_path, output_save_path, additional_outputs = config_params.additional_output, available_ram = max_ram, available_cpu = max_cpu, compress_outputs = config_params.compress_outputs) # Convert output dataset to dataframe and shapefile for parcel mode if mode == 'parcel': diff --git a/source/modspa_samir.py b/source/modspa_samir.py index 17c4048077869b24d2662fa6327e56373cde5531..bb8c5cd927f6c36ca5727f431de8ab02c9dc91cd 100644 --- a/source/modspa_samir.py +++ b/source/modspa_samir.py @@ -1289,7 +1289,7 @@ def samir_daily(NDVI: np.ndarray, ET0: np.ndarray, Rain: np.ndarray, Wfc: np.nda return DP, Dd, Dei, Dep, Dr, E, Irrig, Irrig_test, SWCe, SWCr, Tr, Zr -def run_samir(csv_param_file: str, ndvi_cube_path: str, weather_path: str, soil_params_path: str, land_cover_path: str, irrigation_raster: str, init_RU_path: str, Kcb_max_obs_path: str, save_path: str, scaling_dict: Dict[str, int] = {'E': 1000, 'Tr': 1000, 'SWCe': 1000, 'SWCr': 1000, 'DP': 100, 'Irr': 100}, additional_outputs: Dict[str, int] = None, available_ram: int = 8, available_cpu: int = 4) -> None: +def run_samir(csv_param_file: str, ndvi_cube_path: str, weather_path: str, soil_params_path: str, land_cover_path: str, irrigation_raster: str, init_RU_path: str, Kcb_max_obs_path: str, save_path: str, scaling_dict: Dict[str, int] = {'E': 1000, 'Tr': 1000, 'SWCe': 1000, 'SWCr': 1000, 'DP': 100, 'Irr': 100}, additional_outputs: Dict[str, int] = None, available_ram: int = 8, available_cpu: int = 4, compress_outputs: bool = False) -> None: """ Run the *SAMIR* model on the prepared inputs. Calls the ``samir_daily()`` in a time loop. Maximizes memory usage with given limits to run faster. @@ -1326,6 +1326,8 @@ def run_samir(csv_param_file: str, ndvi_cube_path: str, weather_path: str, soil_ available RAM in **GiB** for the model 12. available_cpu: ``int`` ``default = 4`` number of available **physical** CPU cores + 12. compress_outputs: ``bool`` ``default = False`` + choice to compress output file (takes longer) Returns ======= @@ -1407,6 +1409,9 @@ def run_samir(csv_param_file: str, ndvi_cube_path: str, weather_path: str, soil_ encod['dtype'] = 'u2' # TODO: figure out optimal file chunk size encod['chunksizes'] = (1, y_size, x_size) + if compress_outputs: + encod['zlib'] = True + encod['complevel'] = 1 encoding_dict[variable] = encod # Save empty output