Skip to main content

NEMS configuration generation

Project description

NEMSpy

tests build version license style

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 nemspy import ModelingSystem
from nemspy.model import ADCIRCEntry, AtmosphericMeshEntry, WaveMeshEntry

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

# directory to which configuration files should be written
output_directory = '~/nems_configuration/'

# model entries
ocean_model = ADCIRCEntry(
    processors=11,
    Verbosity='max',
    DumpFields=False
)
atmospheric_mesh = AtmosphericMeshEntry(
    filename='~/wind_atm_fin_ch_time_vec.nc',
    processors=1
)
wave_mesh = WaveMeshEntry(
    filename='~/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 0.5.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 0.5.0
total_member:            1
print_esmf:              .true.
namelist:                atm_namelist
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 0.5.0
 atm_dir: ~
 atm_nam: wind_atm_fin_ch_time_vec.nc
 wav_dir: ~
 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-0.6.9.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

nemspy-0.6.9-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nemspy-0.6.9.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for nemspy-0.6.9.tar.gz
Algorithm Hash digest
SHA256 c607b17aae5a5557b5fb153ce03e0a76542e41a277e178fbc1c59b1fb95e2e2d
MD5 73aa1a7759481a1d89e7135e7b52006b
BLAKE2b-256 947393cdafedbe158c32f191b591a8595cb72db670fbc59245e4484f39350ad3

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: nemspy-0.6.9-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for nemspy-0.6.9-py3-none-any.whl
Algorithm Hash digest
SHA256 88fa06e407ca87b4c08b638be327af80ee08708d06947f50ab3f1fefadb210d4
MD5 03da109c0a58a35c3dcd8c74a36a77c6
BLAKE2b-256 c50431c1ecbc65d78898a2267c1ad5dae18375c59987819c090f3f59a8124604

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