Add environment variable for number of cores to use for analysis

develop
Chris Leaman 6 years ago
parent 70f3ad90be
commit 96bb259755

@ -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. # 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" 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. # The settings below should be left as is unless you know what you're doing.

@ -12,9 +12,17 @@ from src.analysis.runup_models import sto06_individual, sto06
logging.config.fileConfig("./src/logging.conf", disable_existing_loggers=False) logging.config.fileConfig("./src/logging.conf", disable_existing_loggers=False)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
MULTIPROCESS_THREADS = int(os.environ.get("MULTIPROCESS_THREADS", 4))
def forecast_twl( 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 # Use df_waves as a base
df_twl = df_waves.copy() df_twl = df_waves.copy()

Loading…
Cancel
Save