forked from ufs-community/uwtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UW-533 & UW-534 MPAS driver for init_atmosphere and atmosphere foreca…
…st (ufs-community#447) * init * WIP * mpas files * Adding the initial bits of an MPAS driver. * WIP * WIP * WIP * WIP * WIP * WIP * WIP * Driver WIP * WIP * edit namelist name * WIP * WIP * WIP * WIP * WIP * Fixing namelist and streams creation. * WIP * WIP * clean up * renaming * WIP * mpas_init.yaml * new line * punctuation * A tested MPAS driver. * Adding schema with updated tests. * WIP * Works for running mpas. * PR feedback * feedback * config optional path * Formatting. * WIP * WIP * Updating schemas for consistency. * WIP * Default dict for mpas boundary files algo. * update CLI * DRY boundary files * doc string * update namelist_file * mpas updates * added try block * remove comment * simplify tests * updated runscript tests and configs --------- Co-authored-by: Christina Holt <[email protected]>
- Loading branch information
1 parent
c75f40b
commit b8eacbf
Showing
16 changed files
with
1,385 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
user: | ||
mpas_app: /path/to/mpas_app | ||
platform: | ||
account: me | ||
scheduler: slurm | ||
mpas_init: | ||
boundary_conditions: | ||
interval_hours: 6 | ||
length: 6 | ||
execution: | ||
executable: "{{ user.mpas_app }}/exec/init_atmosphere_model" | ||
batchargs: | ||
walltime: 01:30:00 | ||
cores: 4 | ||
mpiargs: | ||
- "--ntasks=4" | ||
mpicmd: srun | ||
envcmds: | ||
- module use {{ user.mpas_app }}/modulefiles | ||
- module load build_jet_intel | ||
files_to_copy: | ||
conus.static.nc: /path/to/conus.static.nc | ||
conus.graph.info.part.{{mpas_init.execution["batchargs"]["cores"]}}: /path/to/conus.graph.info.part.{{mpas_init.execution["batchargs"]["cores"]}} | ||
conus.init.nc: /path/to/conus.init.nc | ||
stream_list.atmosphere.diagnostics: "{{ user.mpas_app }}/src/MPAS-Model/stream_list.atmosphere.diagnostics" | ||
stream_list.atmosphere.output: "{{ user.mpas_app }}/src/MPAS-Model/stream_list.atmosphere.output" | ||
stream_list.atmosphere.surface: "{{ user.mpas_app }}/src/MPAS-Model/stream_list.atmosphere.surface" | ||
files_to_link: | ||
CAM_ABS_DATA.DBL: "{{ user.mpas_app }}/src/MPAS-Model/CAM_ABS_DATA.DBL" | ||
CAM_AEROPT_DATA.DBL: "{{ user.mpas_app }}/src/MPAS-Model/CAM_AEROPT_DATA.DBL" | ||
GENPARM.TBL: "{{ user.mpas_app }}/src/MPAS-Model/GENPARM.TBL" | ||
LANDUSE.TBL: "{{ user.mpas_app }}/src/MPAS-Model/LANDUSE.TBL" | ||
OZONE_DAT.TBL: "{{ user.mpas_app }}/src/MPAS-Model/OZONE_DAT.TBL" | ||
OZONE_LAT.TBL: "{{ user.mpas_app }}/src/MPAS-Model/OZONE_LAT.TBL" | ||
OZONE_PLEV.TBL: "{{ user.mpas_app }}/src/MPAS-Model/OZONE_PLEV.TBL" | ||
RRTMG_LW_DATA: "{{ user.mpas_app }}/src/MPAS-Model/RRTMG_LW_DATA" | ||
RRTMG_LW_DATA.DBL: "{{ user.mpas_app }}/src/MPAS-Model/RRTMG_LW_DATA.DBL" | ||
RRTMG_SW_DATA: "{{ user.mpas_app }}/src/MPAS-Model/RRTMG_SW_DATA" | ||
RRTMG_SW_DATA.DBL: "{{ user.mpas_app }}/src/MPAS-Model/RRTMG_SW_DATA.DBL" | ||
SOILPARM.TBL: "{{ user.mpas_app }}/src/MPAS-Model/SOILPARM.TBL" | ||
VEGPARM.TBL: "{{ user.mpas_app }}/src/MPAS-Model/VEGPARM.TBL" | ||
namelist: | ||
base_file: "{{ user.mpas_app }}/src/MPAS-Model/namelist.init_atmosphere" | ||
update_values: | ||
nhyd_model: | ||
config_init_case: 9 | ||
data_sources: | ||
config_met_prefix: FILE | ||
config_fg_interval: !int "{{ mpas_init.boundary_conditions['interval_hours'] * 3600 }}" | ||
vertical_grid: | ||
config_blend_bdy_terrain: true | ||
preproc_stages: | ||
config_static_interp: false | ||
config_native_gwd_static: false | ||
decomposition: | ||
config_block_decomp_file_prefix: conus.graph.info.part. | ||
run_dir: /path/to/rundir | ||
streams: | ||
path: /path/to/streams.init_atmosphere.IN | ||
values: | ||
input_filename: conus.init.nc | ||
output_filename: foo.nc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
""" | ||
API access to the ``uwtools`` ``mpas`` driver. | ||
""" | ||
|
||
import datetime as dt | ||
from pathlib import Path | ||
from typing import Dict, Optional | ||
|
||
import uwtools.drivers.support as _support | ||
from uwtools.drivers.mpas import MPAS as _MPAS | ||
|
||
|
||
def execute( | ||
task: str, | ||
cycle: dt.datetime, | ||
config: Optional[Path] = None, | ||
batch: bool = False, | ||
dry_run: bool = False, | ||
graph_file: Optional[Path] = None, | ||
) -> bool: | ||
""" | ||
Execute an ``mpas`` task. | ||
If ``batch`` is specified, a runscript will be written and submitted to the batch system. | ||
Otherwise, the executable will be run directly on the current system. | ||
:param task: The task to execute. | ||
:param cycle: The cycle. | ||
:param config: Path to config file (read stdin if missing or None). | ||
:param batch: Submit run to the batch system. | ||
:param dry_run: Do not run the executable, just report what would have been done. | ||
:param graph_file: Write Graphviz DOT output here. | ||
:return: ``True`` if task completes without raising an exception. | ||
""" | ||
obj = _MPAS(config=config, cycle=cycle, batch=batch, dry_run=dry_run) | ||
getattr(obj, task)() | ||
if graph_file: | ||
with open(graph_file, "w", encoding="utf-8") as f: | ||
print(graph(), file=f) | ||
return True | ||
|
||
|
||
def graph() -> str: | ||
""" | ||
Returns Graphviz DOT code for the most recently executed task. | ||
""" | ||
return _support.graph() | ||
|
||
|
||
def tasks() -> Dict[str, str]: | ||
""" | ||
Returns a mapping from task names to their one-line descriptions. | ||
""" | ||
return _support.tasks(_MPAS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
""" | ||
API access to the ``uwtools`` ``mpas-init`` driver. | ||
""" | ||
|
||
import datetime as dt | ||
from pathlib import Path | ||
from typing import Dict, Optional | ||
|
||
import uwtools.drivers.support as _support | ||
from uwtools.drivers.mpas_init import MPASInit as _MPASInit | ||
|
||
|
||
def execute( | ||
task: str, | ||
cycle: dt.datetime, | ||
config: Optional[Path] = None, | ||
batch: bool = False, | ||
dry_run: bool = False, | ||
graph_file: Optional[Path] = None, | ||
) -> bool: | ||
""" | ||
Execute an MPAS ``init-atmosphere`` task. | ||
If ``batch`` is specified, a runscript will be written and submitted to the batch system. | ||
Otherwise, the executable will be run directly on the current system. | ||
:param task: The task to execute. | ||
:param config: Path to config file (read stdin if missing or None). | ||
:param cycle: The cycle. | ||
:param batch: Submit run to the batch system? | ||
:param dry_run: Do not run the executable, just report what would have been done. | ||
:param graph_file: Write Graphviz DOT output here. | ||
:return: ``True`` if task completes without raising an exception. | ||
""" | ||
obj = _MPASInit(config=config, cycle=cycle, batch=batch, dry_run=dry_run) | ||
getattr(obj, task)() | ||
if graph_file: | ||
with open(graph_file, "w", encoding="utf-8") as f: | ||
print(graph(), file=f) | ||
return True | ||
|
||
|
||
def graph() -> str: | ||
""" | ||
Returns Graphviz DOT code for the most recently executed task. | ||
""" | ||
return _support.graph() | ||
|
||
|
||
def tasks() -> Dict[str, str]: | ||
""" | ||
Returns a mapping from task names to their one-line descriptions. | ||
""" | ||
return _support.tasks(_MPASInit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.