diff --git a/.env b/.env index 08bef7d..f144aa6 100644 --- a/.env +++ b/.env @@ -6,6 +6,9 @@ DATA_BACKUP_DIR="J:/Coastal/Temp/CKL/nsw_2016_storm_impact/data" # Location where the matlab interpreter is located. Required for a couple of data processing scripts. MATLAB_PATH="C:/Program Files/MATLAB/R2016b/bin/win64/MATLAB.exe" +# Number of threads to use for multi-core processing. Used when calculating time-varying beach slope when estimating +# total water level. +MULTIPROCESS_THREADS=2 # The settings below should be left as is unless you know what you're doing. diff --git a/src/analysis/forecast_twl.py b/src/analysis/forecast_twl.py index 70f357e..2fe1b0a 100644 --- a/src/analysis/forecast_twl.py +++ b/src/analysis/forecast_twl.py @@ -12,9 +12,17 @@ from src.analysis.runup_models import sto06_individual, sto06 logging.config.fileConfig("./src/logging.conf", disable_existing_loggers=False) logger = logging.getLogger(__name__) +MULTIPROCESS_THREADS = int(os.environ.get("MULTIPROCESS_THREADS", 4)) + def forecast_twl( - df_tides, df_profiles, df_waves, df_profile_features, runup_function, n_processes=4, slope="foreshore" + df_tides, + df_profiles, + df_waves, + df_profile_features, + runup_function, + n_processes=MULTIPROCESS_THREADS, + slope="foreshore", ): # Use df_waves as a base df_twl = df_waves.copy()