Skip to main content

NEMS configuration generation

Project description

NEMSpy

tests codecov build version license style documentation

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).

pip install nemspy

NEMS implements the National Unified Operational Prediction Capability (NUOPC), and configuration files built for NEMS will also work for most NUOPC applications.

Documentation can be found at https://nemspy.readthedocs.io

organization / responsibility

NEMSpy is developed by the Coastal Marine Modeling Branch (CMMB) of the Office of Coast Survey (OCS), a part of the National Oceanic and Atmospheric Administration (NOAA), an agency of the United States federal government.

usage

from datetime import datetime, timedelta
from pathlib import Path

from nemspy import ModelingSystem
from nemspy.model import ADCIRCEntry, AtmosphericForcingEntry, WaveWatch3ForcingEntry

# 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 = AtmosphericForcingEntry(
    filename=forcings_directory / 'wind_atm_fin_ch_time_vec.nc', processors=1
)
wave_mesh = WaveWatch3ForcingEntry(
    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 projects

Project details


Release history Release notifications | RSS feed

This version

1.0.6

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.6.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

nemspy-1.0.6-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file nemspy-1.0.6.tar.gz.

File metadata

  • Download URL: nemspy-1.0.6.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for nemspy-1.0.6.tar.gz
Algorithm Hash digest
SHA256 9b115bccc9dbca0112544c3fbb662e6765f7cd96ca3d6cecded84d45ef159fb5
MD5 8c7e2ca52f937732a3396213b978d07d
BLAKE2b-256 19581e0f6eccd1df21722a7027f041ae69b637728593cd91754a0dcfc6480613

See more details on using hashes here.

Provenance

File details

Details for the file nemspy-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: nemspy-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for nemspy-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 70c632531887974e9876f314d1f3ee0204bfad628988da35be61e23889b96b9c
MD5 c9a90931e68b459feea1e3a6260c1015
BLAKE2b-256 bef741ef360288cc4b89f0011733674da63a94b4cf0b84f21b6dec6d3af5f55e

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page