Skip to content

Commit

Permalink
multidates workflow with aiida shell, reorganizing and notebook added (
Browse files Browse the repository at this point in the history
…#12)

* multidates workflow with aiida shell, reorganizing and notebook added

* config folder and changed date sim functions

* deleted notebook, organize inputs of multidate workflow

* add one hour to release duration

* new computer setup for daint direct

* change code bash for ifs

* updates

* minor changes and parser check for successful run

* parser check for successful calc, wall time input added
  • Loading branch information
LucR31 authored Oct 19, 2023
1 parent 72d274e commit 6fc6a55
Show file tree
Hide file tree
Showing 24 changed files with 421 additions and 442 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def define(cls, spec):
'num_mpiprocs_per_machine': 1,
}

spec.input('metadata.options.max_wallclock_seconds', valid_type=int, default=1800)
spec.input('metadata.options.parser_name', valid_type=str, default='flexpart.cosmo')

# new ports
Expand Down Expand Up @@ -61,19 +62,22 @@ def define(cls, spec):
@classmethod
def _deal_with_time(cls, command_dict):
"""Dealing with simulation times."""

#initial values
simulation_beginning_date = datetime.datetime.strptime(command_dict.pop('simulation_date'),'%Y-%m-%d %H:%M:%S')
age_class_time = datetime.timedelta(seconds=command_dict.pop('age_class'))
release_chunk = datetime.timedelta(seconds=command_dict.pop('release_chunk'))
release_duration = datetime.timedelta(seconds=command_dict.pop('release_duration'))
release_beginning_date = simulation_beginning_date
release_ending_date = simulation_beginning_date + release_duration * command_dict['simulation_direction']
simulation_ending_date = release_ending_date + age_class_time * command_dict['simulation_direction']

# FLEXPART requires the beginning date to be lower than the ending date.
if simulation_beginning_date > simulation_ending_date:
simulation_beginning_date, simulation_ending_date = simulation_ending_date, simulation_beginning_date
if release_beginning_date > release_ending_date:
release_beginning_date, release_ending_date = release_ending_date, release_beginning_date

#releases start and end times
release_beginning_date=simulation_beginning_date
release_ending_date=release_beginning_date+release_duration

if command_dict['simulation_direction']>0: #forward
simulation_ending_date=release_ending_date+age_class_time
else: #backward
simulation_ending_date=release_ending_date
simulation_beginning_date-=age_class_time

command_dict['simulation_beginning_date'] = [
f'{simulation_beginning_date:%Y%m%d}',
Expand Down
94 changes: 0 additions & 94 deletions aiida_flexpart/data/__init__.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ def parse(self, **kwargs):
files_retrieved, files_expected))
return self.exit_codes.ERROR_MISSING_OUTPUT_FILES

# check aiida.out content
with self.retrieved.open(output_filename, 'r') as handle:
content=handle.read()
if 'CONGRATULATIONS' not in content:
return ExitCode(1)
# add output file
self.logger.info("Parsing '{}'".format(output_filename))
with self.retrieved.open(output_filename, 'rb') as handle:
Expand Down
Loading

0 comments on commit 6fc6a55

Please sign in to comment.