Skip to content

Commit

Permalink
added previous calc folder for ifs
Browse files Browse the repository at this point in the history
  • Loading branch information
LucR31 committed Oct 20, 2023
1 parent bf5166f commit 15a79e5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
13 changes: 9 additions & 4 deletions aiida_flexpart/calculations/flexpart_ifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,17 @@ def prepare_for_submission(self, folder):
'SPECIES'
))

#_DEFAULT_PARENT_CALC_FLDR_NAME = "parent_calc/"
if "parent_calc_folder" in self.inputs:
computer_uuid = self.inputs.parent_calc_folder.computer.uuid
remote_path = self.inputs.parent_calc_folder.get_remote_path()
calcinfo.remote_symlink_list.append((
self.inputs.parent_calc_folder.computer.uuid,
self.inputs.parent_calc_folder.get_remote_path(),
self._DEFAULT_PARENT_CALC_FLDR_NAME))
computer_uuid,
remote_path+'/header',
'header_previous'))
calcinfo.remote_symlink_list.append((
computer_uuid,
remote_path+'/partposit_inst',
'partposit_previous'))


# Dealing with land_use input namespace.
Expand Down
8 changes: 7 additions & 1 deletion aiida_flexpart/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ def convert_input_to_namelist_entry(key, val, mapping=None):

def fill_in_template_file(folder, fname, data):
"""Create an input file based on the standard templates."""
with folder.open(fname, 'w') as infile:

if 'ifs' in fname:
fname_=fname[:-4]
else:
fname_=fname

with folder.open(fname_, 'w') as infile:
template = jinja2.Template(
importlib.resources.read_text('aiida_flexpart.templates',
fname + '.j2'))
Expand Down
8 changes: 8 additions & 0 deletions examples/example_ifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ def test_run(flexpart_code):
meteo_path = orm.RemoteData(
remote_path=f'/scratch/snx3000/{user_name}/FLEXPART_input/IFS_GL_05',
computer=flexpart_code.computer)

#change path accordingly
previous_cosmo_calc = orm.RemoteData(
remote_path=f'/scratch/snx3000/{user_name}/aiida/9e/2c/5188-d166-4b20-a89f-b2559a83a6b1',
computer=flexpart_code.computer)

# Set up calculation.
calc = CalculationFactory('flexpart.ifs')
Expand All @@ -82,6 +87,9 @@ def test_run(flexpart_code):
'surfdepo': surfdepo,
}

#uncomment to use previous cosmo calculation
#builder.parent_calc_folder = previous_cosmo_calc

builder.metadata.description = 'Test job submission with the aiida_flexpart plugin'
builder.metadata.options.stash = {
'source_list': ['aiida.out', 'grid_time_*.nc'],
Expand Down

0 comments on commit 15a79e5

Please sign in to comment.