From e153bdca5bf38ac3518f02d50688019a6a3bd1de Mon Sep 17 00:00:00 2001 From: "zachary.burnett" Date: Fri, 23 Jul 2021 12:09:24 -0400 Subject: [PATCH] revamp NEMS configuration to not have duplicate model objects --- coupledmodeldriver/configure/base.py | 145 ++++-------------- coupledmodeldriver/configure/configure.py | 12 +- .../generate/adcirc/configure.py | 20 ++- .../generate/adcirc/generate.py | 10 +- .../runs/unperturbed/fort.15 | 2 +- .../adcirc/hera_shinnecock_ike/spinup/fort.15 | 2 +- .../runs/unperturbed/fort.15 | 2 +- .../runs/unperturbed/fort.15 | 2 +- .../local_shinnecock_ike/spinup/fort.15 | 2 +- .../runs/unperturbed/fort.15 | 2 +- .../stampede2_shinnecock_ike/spinup/fort.15 | 2 +- .../hera_shinnecock_ike/configure_nems.json | 5 - .../runs/unperturbed/config.rc | 4 +- .../runs/unperturbed/fort.15 | 2 +- .../hera_shinnecock_ike/spinup/fort.15 | 2 +- .../configure_nems.json | 4 - .../runs/unperturbed/config.rc | 2 +- .../runs/unperturbed/fort.15 | 2 +- .../hera_shinnecock_ike_aswip/spinup/fort.15 | 2 +- .../configure_nems.json | 5 - .../runs/unperturbed/fort.15 | 2 +- .../configure_nems.json | 5 - .../runs/run_1/config.rc | 4 +- .../runs/run_1/fort.15 | 2 +- .../runs/run_2/config.rc | 4 +- .../runs/run_2/fort.15 | 2 +- .../spinup/fort.15 | 2 +- .../local_shinnecock_ike/configure_nems.json | 5 - .../runs/unperturbed/config.rc | 4 +- .../runs/unperturbed/fort.15 | 2 +- .../local_shinnecock_ike/spinup/fort.15 | 2 +- .../configure_nems.json | 5 - .../runs/unperturbed/config.rc | 4 +- .../runs/unperturbed/fort.15 | 2 +- .../stampede2_shinnecock_ike/spinup/fort.15 | 2 +- tests/test_configuration.py | 3 +- 36 files changed, 83 insertions(+), 196 deletions(-) diff --git a/coupledmodeldriver/configure/base.py b/coupledmodeldriver/configure/base.py index 4c2c0ad2..c27f1146 100644 --- a/coupledmodeldriver/configure/base.py +++ b/coupledmodeldriver/configure/base.py @@ -8,19 +8,13 @@ from typing import Any, Union from adcircpy.server import SlurmConfig -import nemspy from nemspy import ModelingSystem -from nemspy.model.base import ModelEntry, ModelMeshEntry +from nemspy.model.base import ModelEntry from coupledmodeldriver.platforms import Platform from coupledmodeldriver.script import SlurmEmailType from coupledmodeldriver.utilities import convert_to_json, convert_value, LOGGER -NEMS_MODEL_ENTRIES = [ - *(cls for name, cls in nemspy.model.__dict__.items() if isinstance(cls, type)), - ModelEntry, -] - class ConfigurationJSON(ABC): name: str @@ -67,7 +61,7 @@ def move_paths(self, relative: PathLike): for name, value in self.configuration.items(): if isinstance(value, Path) and not value.is_absolute(): - self[name] = PurePosixPath(move_path(value, relative)) + self[name] = PurePosixPath(move_path(value, relative).resolve()) def relative_to(self, path: PathLike, inplace: bool = False) -> 'ConfigurationJSON': instance = copy(self) if not inplace else self @@ -371,6 +365,32 @@ def __init__(self, attributes: {str: Any} = None, **kwargs): self['attributes'] = attributes +class NEMSCapJSON(ConfigurationJSON, ABC): + default_processors: int + field_types = { + 'processors': int, + 'nems_parameters': {str: str}, + } + + def __init__(self, processors: int = None, nems_parameters: {str: str} = None, **kwargs): + if processors is None: + processors = self.default_processors + if nems_parameters is None: + nems_parameters = {} + if 'fields' not in kwargs: + kwargs['fields'] = {} + kwargs['fields'].update(NEMSCapJSON.field_types) + + ConfigurationJSON.__init__(self, **kwargs) + + self['processors'] = processors + self['nems_parameters'] = nems_parameters + + @abstractmethod + def nemspy_entry(self) -> ModelEntry: + raise NotImplementedError() + + class NEMSJSON(ConfigurationJSON): name = 'NEMS' default_filename = f'configure_nems.json' @@ -379,7 +399,6 @@ class NEMSJSON(ConfigurationJSON): 'modeled_start_time': datetime, 'modeled_end_time': datetime, 'interval': timedelta, - 'models': [ModelEntry], 'connections': [[str]], 'mediations': [str], 'sequence': [str], @@ -391,7 +410,6 @@ def __init__( modeled_start_time: datetime, modeled_end_time: datetime, interval: timedelta = None, - models: [ModelEntry] = None, connections: [[str]] = None, mediations: [[str]] = None, sequence: [str] = None, @@ -407,18 +425,19 @@ def __init__( self['modeled_start_time'] = modeled_start_time self['modeled_end_time'] = modeled_end_time self['interval'] = interval - self['models'] = models self['connections'] = connections self['mediations'] = mediations self['sequence'] = sequence - @property - def nemspy_modeling_system(self) -> ModelingSystem: + def to_nemspy(self, models: [NEMSCapJSON]) -> ModelingSystem: + models = [ + model.nemspy_entry if isinstance(model, NEMSCapJSON) else model for model in models + ] modeling_system = ModelingSystem( start_time=self['modeled_start_time'], end_time=self['modeled_end_time'], interval=self['interval'], - **{model.model_type.value.lower(): model for model in self['models']}, + **{model.model_type.value.lower(): model for model in models}, ) for connection in self['connections']: modeling_system.connect(*connection) @@ -432,22 +451,6 @@ def nemspy_modeling_system(self) -> ModelingSystem: return modeling_system - def move_paths(self, relative: PathLike): - super().move_paths(relative) - for model in self['models']: - if isinstance(model, ModelMeshEntry): - model.filename = move_path(model.filename, relative) - - def relative_to(self, path: PathLike, inplace: bool = False) -> 'NEMSJSON': - instance = super().relative_to(path, inplace) - for model in instance['models']: - if isinstance(model, ModelMeshEntry): - model.filename = Path(os.path.relpath(model.filename, path)) - return instance - - def to_nemspy(self) -> ModelingSystem: - return self.nemspy_modeling_system - @classmethod def from_nemspy(cls, modeling_system: ModelingSystem, executable_path: PathLike = None): if executable_path is None: @@ -462,88 +465,6 @@ def from_nemspy(cls, modeling_system: ModelingSystem, executable_path: PathLike sequence=modeling_system.sequence, ) - @classmethod - def from_string(cls, string: str) -> 'NEMSJSON': - configuration = json.loads(string) - - if 'models' in configuration: - if configuration['models'] is not None: - for index, value in enumerate(configuration['models']): - for model_entry_type in NEMS_MODEL_ENTRIES: - try: - value = model_entry_type.from_string(value) - configuration['models'][index] = value - break - except: - pass - - configuration = { - key.lower(): convert_value(value, cls.field_types[key]) - if key in cls.field_types - else convert_to_json(value) - for key, value in configuration.items() - } - - return cls.from_dict(configuration) - - @classmethod - def from_file(cls, filename: PathLike) -> 'NEMSJSON': - if not isinstance(filename, Path): - filename = Path(filename) - - if filename.is_dir(): - filename = filename / cls.default_filename - - with open(filename) as file: - LOGGER.debug(f'reading file "{os.path.relpath(filename.resolve(), Path.cwd())}"') - configuration = json.load(file) - - if 'models' in configuration: - if configuration['models'] is not None: - for index, value in enumerate(configuration['models']): - for model_entry_type in NEMS_MODEL_ENTRIES: - try: - value = model_entry_type.from_string(value) - configuration['models'][index] = value - break - except: - pass - - configuration = { - key.lower(): convert_value(value, cls.field_types[key]) - if key in cls.field_types - else convert_to_json(value) - for key, value in configuration.items() - } - - return cls.from_dict(configuration) - - -class NEMSCapJSON(ConfigurationJSON, ABC): - default_processors: int - field_types = { - 'processors': int, - 'nems_parameters': {str: str}, - } - - def __init__(self, processors: int = None, nems_parameters: {str: str} = None, **kwargs): - if processors is None: - processors = self.default_processors - if nems_parameters is None: - nems_parameters = {} - if 'fields' not in kwargs: - kwargs['fields'] = {} - kwargs['fields'].update(NEMSCapJSON.field_types) - - ConfigurationJSON.__init__(self, **kwargs) - - self['processors'] = processors - self['nems_parameters'] = nems_parameters - - @abstractmethod - def nemspy_entry(self) -> ModelEntry: - raise NotImplementedError() - def move_path(path: PathLike, move: Union[PathLike, int]) -> Path: if not isinstance(path, Path): diff --git a/coupledmodeldriver/configure/configure.py b/coupledmodeldriver/configure/configure.py index a976773a..f1c64302 100644 --- a/coupledmodeldriver/configure/configure.py +++ b/coupledmodeldriver/configure/configure.py @@ -4,9 +4,7 @@ from pathlib import Path from typing import Any, Collection, Mapping, Union -from nemspy.model.base import ModelEntry - -from coupledmodeldriver.configure.base import ConfigurationJSON, ModelDriverJSON, NEMSCapJSON +from coupledmodeldriver.configure.base import ConfigurationJSON, ModelDriverJSON from coupledmodeldriver.configure.forcings.base import ADCIRCPY_FORCING_CLASSES, ForcingJSON from coupledmodeldriver.utilities import LOGGER @@ -53,14 +51,6 @@ def configurations(self, configurations: [ConfigurationJSON]): for name, configuration in configurations.items(): self[name] = configuration - @property - def nemspy_entries(self) -> [ModelEntry]: - return [ - configuration.nemspy_entry - for configuration in self.__configurations.values() - if isinstance(configuration, NEMSCapJSON) - ] - def move_paths(self, relative: PathLike): for configuration in self.configurations: configuration.move_paths(relative) diff --git a/coupledmodeldriver/generate/adcirc/configure.py b/coupledmodeldriver/generate/adcirc/configure.py index 7e55051b..b83521a3 100644 --- a/coupledmodeldriver/generate/adcirc/configure.py +++ b/coupledmodeldriver/generate/adcirc/configure.py @@ -6,6 +6,7 @@ from adcircpy import AdcircMesh, AdcircRun from nemspy import ModelingSystem +from nemspy.model.base import ModelEntry from coupledmodeldriver.configure import NEMSJSON from coupledmodeldriver.configure.base import ( @@ -273,7 +274,6 @@ def __init__( modeled_start_time=modeled_start_time, modeled_end_time=modeled_end_time, interval=nems_interval, - models=self.nemspy_entries, connections=nems_connections, mediations=nems_mediations, sequence=nems_sequence, @@ -284,17 +284,23 @@ def __init__( for forcing in forcings: self.add_forcing(forcing) - self['slurm'].tasks = self['nems'].nemspy_modeling_system.processors + self['slurm'].tasks = self.nemspy_modeling_system.processors + + @property + def nemspy_entries(self) -> [ModelEntry]: + return [ + configuration.nemspy_entry + for configuration in self.configurations + if isinstance(configuration, NEMSCapJSON) + ] @property def nemspy_modeling_system(self) -> ModelingSystem: - return self['nems'].nemspy_modeling_system + return self['nems'].to_nemspy(self.nemspy_entries) def add_forcing(self, forcing: ForcingJSON): if forcing not in self: forcing = self[self.add(forcing)] - if isinstance(forcing, NEMSCapJSON): - self['nems']['models'].append(forcing.nemspy_entry) self['adcirc'].add_forcing(forcing) def __copy__(self) -> 'NEMSADCIRCRunConfiguration': @@ -338,6 +344,4 @@ def read_directory( supplementary = set() supplementary.update(NEMSADCIRCRunConfiguration.SUPPLEMENTARY) - instance = super().read_directory(directory, required, supplementary) - instance['nems']['models'] = instance.nemspy_entries - return instance + return super().read_directory(directory, required, supplementary) diff --git a/coupledmodeldriver/generate/adcirc/generate.py b/coupledmodeldriver/generate/adcirc/generate.py index ac222124..218bcf6f 100644 --- a/coupledmodeldriver/generate/adcirc/generate.py +++ b/coupledmodeldriver/generate/adcirc/generate.py @@ -263,10 +263,11 @@ async def write_spinup_directory( spinup_adcircpy_driver = spinup_configuration.adcircpy_driver - spinup_configuration.relative_to(spinup_directory, inplace=True) + if relative_paths: + spinup_configuration.relative_to(spinup_directory, inplace=True) if use_nems: - spinup_nems = spinup_configuration['nems'].nemspy_modeling_system + spinup_nems = spinup_configuration.nemspy_modeling_system spinup_nems = ModelingSystem( spinup_nems.start_time - spinup_duration, spinup_nems.start_time, @@ -415,10 +416,11 @@ async def write_run_directory( run_adcircpy_driver = run_configuration.adcircpy_driver - run_configuration.relative_to(run_directory, inplace=True) + if relative_paths: + run_configuration.relative_to(run_directory, inplace=True) if use_nems: - run_nems = run_configuration['nems'].nemspy_modeling_system + run_nems = run_configuration.nemspy_modeling_system run_processors = run_nems.processors run_model_executable = run_configuration['nems']['executable_path'] else: diff --git a/tests/data/reference/adcirc/hera_shinnecock_ike/runs/unperturbed/fort.15 b/tests/data/reference/adcirc/hera_shinnecock_ike/runs/unperturbed/fort.15 index d8ac8c34..c2cac765 100644 --- a/tests/data/reference/adcirc/hera_shinnecock_ike/runs/unperturbed/fort.15 +++ b/tests/data/reference/adcirc/hera_shinnecock_ike/runs/unperturbed/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:11 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:06 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/adcirc/hera_shinnecock_ike/spinup/fort.15 b/tests/data/reference/adcirc/hera_shinnecock_ike/spinup/fort.15 index df1605ed..35967a42 100644 --- a/tests/data/reference/adcirc/hera_shinnecock_ike/spinup/fort.15 +++ b/tests/data/reference/adcirc/hera_shinnecock_ike/spinup/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:10 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:05 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/adcirc/hera_shinnecock_ike_nospinup/runs/unperturbed/fort.15 b/tests/data/reference/adcirc/hera_shinnecock_ike_nospinup/runs/unperturbed/fort.15 index 74c74261..8656fb32 100644 --- a/tests/data/reference/adcirc/hera_shinnecock_ike_nospinup/runs/unperturbed/fort.15 +++ b/tests/data/reference/adcirc/hera_shinnecock_ike_nospinup/runs/unperturbed/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:10 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:04 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/adcirc/local_shinnecock_ike/runs/unperturbed/fort.15 b/tests/data/reference/adcirc/local_shinnecock_ike/runs/unperturbed/fort.15 index d8ac8c34..c2cac765 100644 --- a/tests/data/reference/adcirc/local_shinnecock_ike/runs/unperturbed/fort.15 +++ b/tests/data/reference/adcirc/local_shinnecock_ike/runs/unperturbed/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:11 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:06 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/adcirc/local_shinnecock_ike/spinup/fort.15 b/tests/data/reference/adcirc/local_shinnecock_ike/spinup/fort.15 index df1605ed..35967a42 100644 --- a/tests/data/reference/adcirc/local_shinnecock_ike/spinup/fort.15 +++ b/tests/data/reference/adcirc/local_shinnecock_ike/spinup/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:10 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:05 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/adcirc/stampede2_shinnecock_ike/runs/unperturbed/fort.15 b/tests/data/reference/adcirc/stampede2_shinnecock_ike/runs/unperturbed/fort.15 index d8ac8c34..c2cac765 100644 --- a/tests/data/reference/adcirc/stampede2_shinnecock_ike/runs/unperturbed/fort.15 +++ b/tests/data/reference/adcirc/stampede2_shinnecock_ike/runs/unperturbed/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:11 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:06 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/adcirc/stampede2_shinnecock_ike/spinup/fort.15 b/tests/data/reference/adcirc/stampede2_shinnecock_ike/spinup/fort.15 index df1605ed..35967a42 100644 --- a/tests/data/reference/adcirc/stampede2_shinnecock_ike/spinup/fort.15 +++ b/tests/data/reference/adcirc/stampede2_shinnecock_ike/spinup/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:10 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:05 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike/configure_nems.json b/tests/data/reference/nems_adcirc/hera_shinnecock_ike/configure_nems.json index 25bb8e8f..51f1fef8 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike/configure_nems.json +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike/configure_nems.json @@ -3,11 +3,6 @@ "modeled_start_time": "2008-08-23 00:00:00", "modeled_end_time": "2008-09-06 12:00:00", "interval": 3600.0, - "models": [ - "OCN_model: adcirc\nOCN_petlist_bounds: 2 601\nOCN_attributes::\n Verbosity = off\n::", - "ATM_model: atmesh\nATM_petlist_bounds: 0 0\nATM_attributes::\n Verbosity = off\n::", - "WAV_model: ww3data\nWAV_petlist_bounds: 1 1\nWAV_attributes::\n Verbosity = off\n::" - ], "connections": [ [ "ATM -> OCN" diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike/runs/unperturbed/config.rc b/tests/data/reference/nems_adcirc/hera_shinnecock_ike/runs/unperturbed/config.rc index e06800a6..d9e870ae 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike/runs/unperturbed/config.rc +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike/runs/unperturbed/config.rc @@ -1,5 +1,5 @@ # `config.rc` generated with NEMSpy 1.0.1 - atm_dir: ../../../../../../../../../input/shinnecock/ike/forcings + atm_dir: ../../../../../input/shinnecock/ike/forcings atm_nam: wind_atm_fin_ch_time_vec.nc - wav_dir: ../../../../../../../../../input/shinnecock/ike/forcings + wav_dir: ../../../../../input/shinnecock/ike/forcings wav_nam: ww3.Constant.20151214_sxy_ike_date.nc diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike/runs/unperturbed/fort.15 b/tests/data/reference/nems_adcirc/hera_shinnecock_ike/runs/unperturbed/fort.15 index 51509dbc..f1ac6512 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike/runs/unperturbed/fort.15 +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike/runs/unperturbed/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:10 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:04 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike/spinup/fort.15 b/tests/data/reference/nems_adcirc/hera_shinnecock_ike/spinup/fort.15 index 1ece8b83..2e448c70 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike/spinup/fort.15 +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike/spinup/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:09 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:04 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/configure_nems.json b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/configure_nems.json index ed727f4d..bfffc517 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/configure_nems.json +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/configure_nems.json @@ -3,10 +3,6 @@ "modeled_start_time": "2008-09-01 06:00:00", "modeled_end_time": "2008-09-15 06:00:00", "interval": 3600.0, - "models": [ - "OCN_model: adcirc\nOCN_petlist_bounds: 1 600\nOCN_attributes::\n Verbosity = off\n::", - "WAV_model: ww3data\nWAV_petlist_bounds: 0 0\nWAV_attributes::\n Verbosity = off\n::" - ], "connections": [ [ "WAV -> OCN" diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/runs/unperturbed/config.rc b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/runs/unperturbed/config.rc index fa5b4510..6b9de6b2 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/runs/unperturbed/config.rc +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/runs/unperturbed/config.rc @@ -1,3 +1,3 @@ # `config.rc` generated with NEMSpy 1.0.1 - wav_dir: ../../../../../../../../../input/shinnecock/ike/forcings + wav_dir: ../../../../../input/shinnecock/ike/forcings wav_nam: ww3.Constant.20151214_sxy_ike_date.nc diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/runs/unperturbed/fort.15 b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/runs/unperturbed/fort.15 index 0c542db8..6f385db4 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/runs/unperturbed/fort.15 +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/runs/unperturbed/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-16 11:24 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:07 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/spinup/fort.15 b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/spinup/fort.15 index 9046f523..dae328e9 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/spinup/fort.15 +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_aswip/spinup/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-16 11:23 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:06 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_nospinup/configure_nems.json b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_nospinup/configure_nems.json index 25bb8e8f..51f1fef8 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_nospinup/configure_nems.json +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_nospinup/configure_nems.json @@ -3,11 +3,6 @@ "modeled_start_time": "2008-08-23 00:00:00", "modeled_end_time": "2008-09-06 12:00:00", "interval": 3600.0, - "models": [ - "OCN_model: adcirc\nOCN_petlist_bounds: 2 601\nOCN_attributes::\n Verbosity = off\n::", - "ATM_model: atmesh\nATM_petlist_bounds: 0 0\nATM_attributes::\n Verbosity = off\n::", - "WAV_model: ww3data\nWAV_petlist_bounds: 1 1\nWAV_attributes::\n Verbosity = off\n::" - ], "connections": [ [ "ATM -> OCN" diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_nospinup/runs/unperturbed/fort.15 b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_nospinup/runs/unperturbed/fort.15 index e1d46f71..422fc9af 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_nospinup/runs/unperturbed/fort.15 +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_nospinup/runs/unperturbed/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:09 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:04 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/configure_nems.json b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/configure_nems.json index 25bb8e8f..51f1fef8 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/configure_nems.json +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/configure_nems.json @@ -3,11 +3,6 @@ "modeled_start_time": "2008-08-23 00:00:00", "modeled_end_time": "2008-09-06 12:00:00", "interval": 3600.0, - "models": [ - "OCN_model: adcirc\nOCN_petlist_bounds: 2 601\nOCN_attributes::\n Verbosity = off\n::", - "ATM_model: atmesh\nATM_petlist_bounds: 0 0\nATM_attributes::\n Verbosity = off\n::", - "WAV_model: ww3data\nWAV_petlist_bounds: 1 1\nWAV_attributes::\n Verbosity = off\n::" - ], "connections": [ [ "ATM -> OCN" diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_1/config.rc b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_1/config.rc index e06800a6..d9e870ae 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_1/config.rc +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_1/config.rc @@ -1,5 +1,5 @@ # `config.rc` generated with NEMSpy 1.0.1 - atm_dir: ../../../../../../../../../input/shinnecock/ike/forcings + atm_dir: ../../../../../input/shinnecock/ike/forcings atm_nam: wind_atm_fin_ch_time_vec.nc - wav_dir: ../../../../../../../../../input/shinnecock/ike/forcings + wav_dir: ../../../../../input/shinnecock/ike/forcings wav_nam: ww3.Constant.20151214_sxy_ike_date.nc diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_1/fort.15 b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_1/fort.15 index 4e76ec9d..5cee893d 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_1/fort.15 +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_1/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:11 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:06 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_2/config.rc b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_2/config.rc index e06800a6..d9e870ae 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_2/config.rc +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_2/config.rc @@ -1,5 +1,5 @@ # `config.rc` generated with NEMSpy 1.0.1 - atm_dir: ../../../../../../../../../input/shinnecock/ike/forcings + atm_dir: ../../../../../input/shinnecock/ike/forcings atm_nam: wind_atm_fin_ch_time_vec.nc - wav_dir: ../../../../../../../../../input/shinnecock/ike/forcings + wav_dir: ../../../../../input/shinnecock/ike/forcings wav_nam: ww3.Constant.20151214_sxy_ike_date.nc diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_2/fort.15 b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_2/fort.15 index 48be224f..ac599c9f 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_2/fort.15 +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/runs/run_2/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:12 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:06 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/spinup/fort.15 b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/spinup/fort.15 index df1605ed..35967a42 100644 --- a/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/spinup/fort.15 +++ b/tests/data/reference/nems_adcirc/hera_shinnecock_ike_perturbed/spinup/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:10 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:05 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/nems_adcirc/local_shinnecock_ike/configure_nems.json b/tests/data/reference/nems_adcirc/local_shinnecock_ike/configure_nems.json index 66230f4d..51f1fef8 100644 --- a/tests/data/reference/nems_adcirc/local_shinnecock_ike/configure_nems.json +++ b/tests/data/reference/nems_adcirc/local_shinnecock_ike/configure_nems.json @@ -3,11 +3,6 @@ "modeled_start_time": "2008-08-23 00:00:00", "modeled_end_time": "2008-09-06 12:00:00", "interval": 3600.0, - "models": [ - "OCN_model: adcirc\nOCN_petlist_bounds: 2 12\nOCN_attributes::\n Verbosity = off\n::", - "ATM_model: atmesh\nATM_petlist_bounds: 0 0\nATM_attributes::\n Verbosity = off\n::", - "WAV_model: ww3data\nWAV_petlist_bounds: 1 1\nWAV_attributes::\n Verbosity = off\n::" - ], "connections": [ [ "ATM -> OCN" diff --git a/tests/data/reference/nems_adcirc/local_shinnecock_ike/runs/unperturbed/config.rc b/tests/data/reference/nems_adcirc/local_shinnecock_ike/runs/unperturbed/config.rc index e06800a6..d9e870ae 100644 --- a/tests/data/reference/nems_adcirc/local_shinnecock_ike/runs/unperturbed/config.rc +++ b/tests/data/reference/nems_adcirc/local_shinnecock_ike/runs/unperturbed/config.rc @@ -1,5 +1,5 @@ # `config.rc` generated with NEMSpy 1.0.1 - atm_dir: ../../../../../../../../../input/shinnecock/ike/forcings + atm_dir: ../../../../../input/shinnecock/ike/forcings atm_nam: wind_atm_fin_ch_time_vec.nc - wav_dir: ../../../../../../../../../input/shinnecock/ike/forcings + wav_dir: ../../../../../input/shinnecock/ike/forcings wav_nam: ww3.Constant.20151214_sxy_ike_date.nc diff --git a/tests/data/reference/nems_adcirc/local_shinnecock_ike/runs/unperturbed/fort.15 b/tests/data/reference/nems_adcirc/local_shinnecock_ike/runs/unperturbed/fort.15 index 51509dbc..f1ac6512 100644 --- a/tests/data/reference/nems_adcirc/local_shinnecock_ike/runs/unperturbed/fort.15 +++ b/tests/data/reference/nems_adcirc/local_shinnecock_ike/runs/unperturbed/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:10 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:04 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/nems_adcirc/local_shinnecock_ike/spinup/fort.15 b/tests/data/reference/nems_adcirc/local_shinnecock_ike/spinup/fort.15 index 1ece8b83..2e448c70 100644 --- a/tests/data/reference/nems_adcirc/local_shinnecock_ike/spinup/fort.15 +++ b/tests/data/reference/nems_adcirc/local_shinnecock_ike/spinup/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:09 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:04 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/configure_nems.json b/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/configure_nems.json index 1742b827..51f1fef8 100644 --- a/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/configure_nems.json +++ b/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/configure_nems.json @@ -3,11 +3,6 @@ "modeled_start_time": "2008-08-23 00:00:00", "modeled_end_time": "2008-09-06 12:00:00", "interval": 3600.0, - "models": [ - "OCN_model: adcirc\nOCN_petlist_bounds: 2 1021\nOCN_attributes::\n Verbosity = off\n::", - "ATM_model: atmesh\nATM_petlist_bounds: 0 0\nATM_attributes::\n Verbosity = off\n::", - "WAV_model: ww3data\nWAV_petlist_bounds: 1 1\nWAV_attributes::\n Verbosity = off\n::" - ], "connections": [ [ "ATM -> OCN" diff --git a/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/runs/unperturbed/config.rc b/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/runs/unperturbed/config.rc index e06800a6..d9e870ae 100644 --- a/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/runs/unperturbed/config.rc +++ b/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/runs/unperturbed/config.rc @@ -1,5 +1,5 @@ # `config.rc` generated with NEMSpy 1.0.1 - atm_dir: ../../../../../../../../../input/shinnecock/ike/forcings + atm_dir: ../../../../../input/shinnecock/ike/forcings atm_nam: wind_atm_fin_ch_time_vec.nc - wav_dir: ../../../../../../../../../input/shinnecock/ike/forcings + wav_dir: ../../../../../input/shinnecock/ike/forcings wav_nam: ww3.Constant.20151214_sxy_ike_date.nc diff --git a/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/runs/unperturbed/fort.15 b/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/runs/unperturbed/fort.15 index 51509dbc..f1ac6512 100644 --- a/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/runs/unperturbed/fort.15 +++ b/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/runs/unperturbed/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:10 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:04 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/spinup/fort.15 b/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/spinup/fort.15 index 1ece8b83..2e448c70 100644 --- a/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/spinup/fort.15 +++ b/tests/data/reference/nems_adcirc/stampede2_shinnecock_ike/spinup/fort.15 @@ -1,4 +1,4 @@ -created on 2021-07-08 16:09 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION +created on 2021-07-23 12:04 ! RUNDES - 32 CHARACTER ALPHANUMERIC RUN DESCRIPTION Shinacock Inlet Coarse Grid ! RUNID - 24 CHARACTER ALPANUMERIC RUN IDENTIFICATION 1 ! NFOVER - NONFATAL ERROR OVERRIDE OPTION 1 ! NABOUT - ABREVIATED OUTPUT OPTION PARAMETER diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 9626b79b..bc539fd0 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -78,13 +78,12 @@ def test_nems(): modeled_start_time=datetime(2012, 10, 22, 6), modeled_end_time=datetime(2012, 10, 22, 6) + timedelta(days=14.5), interval=timedelta(hours=1), - models=model_entries, connections=connections, mediations=mediations, sequence=sequence, ) - modeling_system = configuration.nemspy_modeling_system + modeling_system = configuration.to_nemspy(model_entries) assert modeling_system.sequence == [ 'ATM -> OCN :remapMethod=redist',