NEMS configuration generation
Project description
NEMSpy
NEMSpy generates configuration files (nems.configure
, config.rc
, model_configure
, atm_namelist.rc
)
for coupled modeling applications run with a compiled NEMS binary (not included).
NEMS implements the National Unified Operational Prediction Capability (NUOPC), and configuration files built for NEMS will also work for most NUOPC applications.
Usage:
from datetime import datetime, timedelta
from pathlib import Path
from nemspy import ModelingSystem
from nemspy.model import ADCIRCEntry, AtmosphericMeshEntry, WaveWatch3MeshEntry
# directory to which configuration files should be written
output_directory = Path(__file__).parent / 'nems_configuration'
# directory containing forcings
forcings_directory = Path(__file__).parent / 'forcings'
# model run time
start_time = datetime(2020, 6, 1)
duration = timedelta(days=1)
end_time = start_time + duration
# returning interval of main run sequence
interval = timedelta(hours=1)
# model entries
ocean_model = ADCIRCEntry(processors=11, Verbosity='max', DumpFields=False)
atmospheric_mesh = AtmosphericMeshEntry(
filename=forcings_directory / 'wind_atm_fin_ch_time_vec.nc', processors=1
)
wave_mesh = WaveWatch3MeshEntry(
filename=forcings_directory / 'ww3.Constant.20151214_sxy_ike_date.nc', processors=1
)
# instantiate model system with model entries
nems = ModelingSystem(
start_time=start_time,
end_time=end_time,
interval=interval,
ocn=ocean_model,
atm=atmospheric_mesh,
wav=wave_mesh,
)
# 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(directory=output_directory, overwrite=True, include_version=True)
Output:
nems.configure
# `nems.configure` generated with NEMSpy 1.0.0
# EARTH #
EARTH_component_list: ATM WAV OCN
EARTH_attributes::
Verbosity = off
::
# ATM #
ATM_model: atmesh
ATM_petlist_bounds: 0 0
ATM_attributes::
Verbosity = off
::
# WAV #
WAV_model: ww3data
WAV_petlist_bounds: 1 1
WAV_attributes::
Verbosity = off
::
# OCN #
OCN_model: adcirc
OCN_petlist_bounds: 2 12
OCN_attributes::
Verbosity = max
DumpFields = false
::
# Run Sequence #
runSeq::
@3600
ATM -> OCN :remapMethod=redist
WAV -> OCN :remapMethod=redist
ATM
WAV
OCN
@
::
model_configure
# `model_configure` generated with NEMSpy 1.0.0
total_member: 1
print_esmf: .true.
namelist: atm_namelist.rc
PE_MEMBER01: 13
start_year: 2020
start_month: 6
start_day: 1
start_hour: 0
start_minute: 0
start_second: 0
nhours_fcst: 24
RUN_CONTINUE: .false.
ENS_SPS: .false.
config.rc
# `config.rc` generated with NEMSpy 1.0.0
atm_dir: ~/forcings
atm_nam: wind_atm_fin_ch_time_vec.nc
wav_dir: ~/forcings
wav_nam: ww3.Constant.20151214_sxy_ike_date.nc
Related:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nemspy-1.0.2.tar.gz
(20.7 kB
view details)
Built Distribution
nemspy-1.0.2-py3-none-any.whl
(23.2 kB
view details)
File details
Details for the file nemspy-1.0.2.tar.gz
.
File metadata
- Download URL: nemspy-1.0.2.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 513d3fcfbcf38af2db6388a8343af43b2a016ac7b51dd4ce88393c4034e0caf8 |
|
MD5 | 358a1d2fd138382bceb6933810385373 |
|
BLAKE2b-256 | 026b3cfc30f3c7c7b3724ca8bca95b51a6f69e6db6c135d1908f4044ec836985 |
Provenance
File details
Details for the file nemspy-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: nemspy-1.0.2-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a78f58276cca1a3031e440142df8ebc2f6d7c4149019afc277d9a98a89814f2 |
|
MD5 | d4f18ea0c2a352fbfbdb02836f091de4 |
|
BLAKE2b-256 | 7b898cf2c898881d49db53460ef3b47f1dda02c5f9aaf47ba4fe307bc54bb370 |