ModelingSystem
Interface
- class nemspy.interface.ModelingSystem(start_time: datetime.datetime, end_time: datetime.datetime, interval: datetime.timedelta, **models)
main user interface class of NEMSpy, providing configuration and output to files
from datetime import datetime, timedelta from nemspy import ModelingSystem from nemspy.model import ADCIRCEntry, AtmosphericForcingEntry, WaveWatch3ForcingEntry # instantiate model system with model entries nems = ModelingSystem( start_time=datetime(2020, 6, 1), end_time=start_time + timedelta(days=1), interval=timedelta(hours=1), ocn=ADCIRCEntry(processors=11), atm=AtmosphericForcingEntry(filename='wind_atm_fin_ch_time_vec.nc'), wav=WaveWatch3ForcingEntry(filename='ww3.Constant.20151214_sxy_ike_date.nc'), ) # form connections between models nems.connect('ATM', 'OCN') nems.connect('WAV', 'OCN') # define execution order nems.sequence = [ 'ATM -> OCN', 'WAV -> OCN', 'ATM', 'WAV', 'OCN', ] # write configuration files to the given directory nems.write('nems_configuration')
- Parameters
start_time – start time within the modeled system
end_time – end time within the modeled system
interval – time interval of top-level run sequence
verbose – verbosity in NEMS configuration
atm – atmospheric wind model
wav – oceanic wave model
ocn – oceanic circulation model
hyd – terrestrial water model
med – model mediator
- property start_time: datetime.datetime
end time within modeled system
- property end_time: datetime.datetime
end time within modeled system
- property duration: datetime.timedelta
duration of run within modeled system
- property interval: datetime.timedelta
run sequence interval within the modeled system
- property models: List[nemspy.model.base.ModelEntry]
models in execution order
- property processors: int
number of PETs / processors / tasks
- property sequence: List[str]
model execution order
- connect(source: str, target: Optional[str] = None, method: Optional[str] = None)
couple two models with an information exchange pathway
- Parameters
source – model providing information
target – model receiving information
method – remapping method
- property connections: List[str]
string representations of coupling connections in format
'WAV -> HYD'
- mediate(sources: Optional[List[str]] = None, functions: Optional[List[str]] = None, targets: Optional[List[str]] = None, method: Optional[nemspy.model.base.GridRemapMethod] = None, processors: Optional[int] = None, **attributes)
create a mediation between one or two models and a mediator, with an arbitrary number of mediation functions
- Parameters
sources – model providing information
functions – mediator functions
targets – model receiving information
method – remapping method
processors – number of processors to assign to mediation
- write(directory: os.PathLike, overwrite: bool = False, include_version: bool = False) List[pathlib.Path]
write NEMS / NUOPC configuration to the given directory
- Parameters
directory – path to output directory
overwrite – overwrite existing files
include_version – include the NEMSpy version in a comment
- Returns
list of written file paths