Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
LucR31 committed Apr 29, 2024
2 parents 5cd95cc + 3bbe5d2 commit f0f12c0
Showing 1 changed file with 35 additions and 8 deletions.
43 changes: 35 additions & 8 deletions aiida_flexpart/workflows/multi_dates_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def define(cls, spec):
spec.input('check_meteo_ifs_code', valid_type=orm.AbstractCode)
spec.input('post_processing_code', valid_type=orm.AbstractCode)

#extras
spec.input('name', valid_type=str, non_db=True, required=False)

# Basic Inputs
spec.input('simulation_dates',
valid_type=orm.List,
Expand Down Expand Up @@ -108,10 +111,12 @@ def define(cls, spec):
spec.outline(
cls.setup,
engine.while_(cls.condition)(
engine.if_(cls.run_cosmo)(engine.if_(
cls.prepare_meteo_folder_cosmo)(cls.run_cosmo_simulation)),
engine.if_(cls.run_ifs)(engine.if_(
cls.prepare_meteo_folder_ifs)(cls.run_ifs_simulation)),
engine.if_(cls.run_cosmo)(
engine.if_(cls.prepare_meteo_folder_cosmo)(
cls.run_cosmo_simulation)),
engine.if_(cls.run_ifs)(
engine.if_(cls.prepare_meteo_folder_ifs)(
cls.run_ifs_simulation)),
cls.post_processing,
),
cls.results,
Expand Down Expand Up @@ -157,6 +162,24 @@ def setup(self):
self.ctx.outgrid = self.inputs.outgrid
self.ctx.species = self.inputs.species
self.ctx.land_use = self.inputs.land_use
if 'name' in self.inputs:
out_n = 'None'
if 'outgrid_nest' in self.inputs:
out_n = self.inputs.outgrid_nest.get_dict()
self.node.base.extras.set(
self.inputs.name, {
'command': self.ctx.command.get_dict(),
'input_phy': self.ctx.input_phy.get_dict(),
'release': self.ctx.release_settings.get_dict(),
'locations': self.ctx.locations.get_dict(),
'integration_time': self.ctx.integration_time.value,
'offline_integration_time':
self.ctx.offline_integration_time.value,
'model': self.inputs.model,
'model_offline': self.inputs.model_offline,
'outgrid': self.inputs.outgrid.get_dict(),
'outgrid_nest': out_n
})

def prepare_meteo_folder_ifs(self):
"""prepare meteo folder"""
Expand Down Expand Up @@ -275,9 +298,11 @@ def run_cosmo_simulation(self):
'input_phy': self.ctx.input_phy,
}

builder.outgrid = self.ctx.outgrid
builder.outgrid = orm.Dict(
list(self.ctx.outgrid.get_dict().values())[0])
if 'outgrid_nest' in self.inputs:
builder.outgrid_nest = self.inputs.outgrid_nest
builder.outgrid_nest = orm.Dict(
list(self.inputs.outgrid_nest.get_dict().values())[0])
builder.species = self.ctx.species
builder.land_use = self.ctx.land_use
builder.meteo_path = self.inputs.meteo_path
Expand Down Expand Up @@ -329,9 +354,11 @@ def run_ifs_simulation(self):
'command': orm.Dict(dict=new_dict),
}

builder.outgrid = self.ctx.outgrid
builder.outgrid = orm.Dict(
list(self.ctx.outgrid.get_dict().values())[0])
if 'outgrid_nest' in self.inputs:
builder.outgrid_nest = self.inputs.outgrid_nest
builder.outgrid_nest = orm.Dict(
list(self.inputs.outgrid_nest.get_dict().values())[0])
builder.species = self.ctx.species
builder.land_use = self.inputs.land_use_ifs

Expand Down

0 comments on commit f0f12c0

Please sign in to comment.