Browse Source

Merge branch 'bias-correction-in-flux-calculator'

1.04.00
Sven Karsten 5 months ago
parent
commit
f3a4628558
  1. 2
      scripts/run/model_handling.py
  2. 12
      scripts/run/model_handling_flux.py

2
scripts/run/model_handling.py

@ -76,7 +76,7 @@ def get_model_handlers(global_settings):
"""
# get a list of input folders
models = [d for d in os.listdir(global_settings.input_dir +'/') if (os.path.isdir(os.path.join(global_settings.input_dir +'/',d)) and (d[0] != '_'))]
models = [d for d in os.listdir(global_settings.input_dir +'/') if (os.path.isdir(os.path.join(global_settings.input_dir +'/',d)) and (d[0] != '_') and (d != 'flux_calculator'))]
# assume uncoupled case first
coupled = False

12
scripts/run/model_handling_flux.py

@ -83,7 +83,11 @@ class ModelHandler(model_handling.ModelHandlerBase):
timesteps = runseconds//coupling_time_step
# STEP 3: copy flux_calculator.nml file and change timestep and number of time steps
os.system('cp '+self.global_settings.input_dir+'/flux_calculator.nml '+full_directory+'/flux_calculator.nml')
if os.path.isfile(self.global_settings.input_dir+'/flux_calculator.nml'):
os.system('cp '+self.global_settings.input_dir+'/flux_calculator.nml '+full_directory+'/flux_calculator.nml')
# new: allow extra directory for flux calculator
if os.path.isdir(self.global_settings.input_dir+'/flux_calculator'):
os.system('cp -r '+self.global_settings.input_dir+'/flux_calculator/* '+full_directory+'/')
change_in_namelist.change_in_namelist(filename=full_directory+'/flux_calculator.nml',
after='&input', before='/', start_of_line='timestep',
@ -91,9 +95,11 @@ class ModelHandler(model_handling.ModelHandlerBase):
change_in_namelist.change_in_namelist(filename=full_directory+'/flux_calculator.nml',
after='&input', before='/', start_of_line='num_timesteps',
new_value = '='+str(timesteps))
# if corrections are intended, flux calculator needs the initial date to know the current month
change_in_namelist.change_in_namelist(filename=full_directory+'/flux_calculator.nml',
after='&bias', before='/', start_of_line='init_date',
new_value = '='+str(my_initdate))
after='&correctionsctl', before='/', start_of_line='init_date',
new_value = '='+str(init_date))
# TODO when several bottom models are supported, here should be a check for which model we adapt the num_tasks_per_model
mythreads = self.get_my_threads()
for i, model in enumerate(mythreads.keys()):

Loading…
Cancel
Save