Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CDEPS support #522

Merged
merged 73 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
8622a79
initial support for cdeps
uturuncoglu May 3, 2024
86f7134
more changes for cdeps driver
uturuncoglu May 5, 2024
9f232a3
cdeps support for atm and ocn
uturuncoglu May 6, 2024
5eaa94c
add more namelist option to atm section
uturuncoglu May 6, 2024
f54af7c
enable stream esmf config files
uturuncoglu May 14, 2024
00004f0
cleanup and extend support for ocean
uturuncoglu May 15, 2024
cad2118
sync with main
uturuncoglu Jul 2, 2024
075323a
WIP
maddenp-noaa Jul 11, 2024
1b4d6e2
Merge branch 'main' into cdeps-update
maddenp-noaa Jul 11, 2024
45c0195
WIP
maddenp-noaa Jul 11, 2024
0f380f1
WIP
maddenp-noaa Jul 11, 2024
9946981
Update CLI to deal with no-batch drivers
maddenp-noaa Jul 11, 2024
b9392dd
add missing variables to cdeps json schema
uturuncoglu Jul 12, 2024
9bbaba2
add simple uw yaml file for cdeps
uturuncoglu Jul 12, 2024
7eacab0
Remove execution block
maddenp-noaa Jul 15, 2024
2022411
Merge remote-tracking branch 'ufuk/feature/cdeps' into cdeps-update
maddenp-noaa Jul 15, 2024
4dbed05
Run yaml-sort on cdeps.yaml
maddenp-noaa Jul 15, 2024
52fa115
Run yaml-sort on cdeps.yaml
maddenp-noaa Jul 15, 2024
07bd2ea
Merge branch 'main' into cdeps-update
maddenp-noaa Jul 16, 2024
94a7ca4
Work on schema
maddenp-noaa Jul 16, 2024
0aff616
Work on schema
maddenp-noaa Jul 16, 2024
0f19cf6
WIP
maddenp-noaa Jul 16, 2024
bfeb01a
WIP
maddenp-noaa Jul 16, 2024
205df33
WIP
maddenp-noaa Jul 16, 2024
1a6775e
WIP
maddenp-noaa Jul 16, 2024
20f3fe5
WIP
maddenp-noaa Jul 16, 2024
4525cf4
Complete schema tests
maddenp-noaa Jul 16, 2024
f137478
Work on unit tests
maddenp-noaa Jul 17, 2024
1a2add2
Unit tests @ 100%
maddenp-noaa Jul 17, 2024
5f33d7f
Add test module
maddenp-noaa Jul 17, 2024
bb05ee9
Add API test
maddenp-noaa Jul 17, 2024
4bb884b
Add doc content
maddenp-noaa Jul 17, 2024
8a832fb
Add doc content
maddenp-noaa Jul 17, 2024
c9942e4
Add doc content
maddenp-noaa Jul 17, 2024
7ec4276
Merge remote-tracking branch 'upstream/main' into feature/cdeps
uturuncoglu Jul 17, 2024
0341c23
Merge remote-tracking branch 'ufuk/feature/cdeps' into cdeps-update
maddenp-noaa Jul 17, 2024
db75bd2
WIP
maddenp-noaa Jul 11, 2024
78dfc6c
WIP
maddenp-noaa Jul 11, 2024
3fbe2f4
WIP
maddenp-noaa Jul 11, 2024
737b2c4
Update CLI to deal with no-batch drivers
maddenp-noaa Jul 11, 2024
7662b1f
Remove execution block
maddenp-noaa Jul 15, 2024
b32df51
Run yaml-sort on cdeps.yaml
maddenp-noaa Jul 15, 2024
90e4654
Run yaml-sort on cdeps.yaml
maddenp-noaa Jul 15, 2024
519857e
Work on schema
maddenp-noaa Jul 16, 2024
2297f33
Work on schema
maddenp-noaa Jul 16, 2024
d2c65a3
WIP
maddenp-noaa Jul 16, 2024
02a03ca
WIP
maddenp-noaa Jul 16, 2024
20eda5b
WIP
maddenp-noaa Jul 16, 2024
ca10b50
WIP
maddenp-noaa Jul 16, 2024
a808050
WIP
maddenp-noaa Jul 16, 2024
7df18b1
Complete schema tests
maddenp-noaa Jul 16, 2024
473fae9
Work on unit tests
maddenp-noaa Jul 17, 2024
4436e63
Unit tests @ 100%
maddenp-noaa Jul 17, 2024
2378515
Add test module
maddenp-noaa Jul 17, 2024
5d46c7b
Add API test
maddenp-noaa Jul 17, 2024
d4f51fc
Add doc content
maddenp-noaa Jul 17, 2024
687d571
Add doc content
maddenp-noaa Jul 17, 2024
063f5af
Add doc content
maddenp-noaa Jul 17, 2024
d4243cf
Merge branch 'cdeps-update' of github.com:maddenp-noaa/uwtools into c…
maddenp-noaa Jul 22, 2024
b52ce7d
Use partial() on tasks() in CDEPS API module
maddenp-noaa Jul 22, 2024
7bb545f
Doc updates
maddenp-noaa Jul 22, 2024
3725449
Merge pull request #1 from maddenp-noaa/cdeps-update
uturuncoglu Jul 22, 2024
fe9f1d6
Merge remote-tracking branch 'upstream/main' into feature/cdeps
uturuncoglu Jul 22, 2024
c1189c3
Merge remote-tracking branch 'upstream/main' into feature/cdeps
uturuncoglu Jul 23, 2024
b7b9fa8
minor fix for stream namelist
uturuncoglu Jul 23, 2024
5affa39
Update src/uwtools/tests/drivers/test_cdeps.py
uturuncoglu Jul 23, 2024
46ef6e7
Update src/uwtools/drivers/cdeps.py
uturuncoglu Jul 23, 2024
d3edb85
Update docs/sections/user_guide/cli/drivers/cdeps/help.out
uturuncoglu Jul 23, 2024
77e674d
Update docs/sections/user_guide/yaml/components/cdeps.rst
uturuncoglu Jul 23, 2024
330fbe5
Update src/uwtools/drivers/cdeps.py
uturuncoglu Jul 23, 2024
a3d53a3
Merge remote-tracking branch 'upstream/main' into feature/cdeps
uturuncoglu Jul 23, 2024
94e4800
sync with main
uturuncoglu Jul 23, 2024
acdfd27
Merge branch 'feature/cdeps' of https://github.com/oceanmodeling/uwto…
uturuncoglu Jul 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"anaconda": ("https://www.anaconda.com/%s", "%s"),
"anaconda-condev": ("https://anaconda.org/maddenp/condev/%s", "%s"),
"black": ("https://black.readthedocs.io/en/stable/%s", "%s"),
"cdeps": ("https://escomp.github.io/CDEPS/versions/master/html/%s", "%s"),
"cmeps": ("https://escomp.github.io/CMEPS/versions/master/html/esmflds.html#%s", "%s"),
"conda": ("https://docs.conda.io/en/latest/%s", "%s"),
"conda-forge": ("https://conda-forge.org/%s", "%s"),
Expand Down
6 changes: 6 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ Drivers for UFS

To prepare a complete forecast, drivers would typically be run in the order shown here (along with additional drivers still in development).

cdeps
"""""

| **CLI**: ``uw cdeps -h``
| **API**: ``import uwtools.api.cdeps``

esg_grid
""""""""

Expand Down
6 changes: 6 additions & 0 deletions docs/sections/user_guide/api/cdeps.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
``uwtools.api.cdeps``
=====================

.. automodule:: uwtools.api.cdeps
:inherited-members:
:members:
1 change: 1 addition & 0 deletions docs/sections/user_guide/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ API
===

.. toctree::
cdeps
chgres_cube
config
esg_grid
Expand Down
45 changes: 45 additions & 0 deletions docs/sections/user_guide/cli/drivers/cdeps.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
``cdeps``
=========

The ``uw`` mode for configuring and running the :CDEPS:`cdeps<>` component.

.. literalinclude:: cdeps/help.cmd
:language: text
:emphasize-lines: 1
.. literalinclude:: cdeps/help.out
:language: text

All tasks take the same arguments. For example:

.. literalinclude:: cdeps/run-help.cmd
:language: text
:emphasize-lines: 1
.. literalinclude:: cdeps/run-help.out
:language: text

Examples
^^^^^^^^

The examples use a configuration file named ``config.yaml`` with content similar to:

.. highlight:: yaml
.. literalinclude:: /shared/cdeps.yaml

Its contents are described in depth in section :ref:`cdeps_yaml`. Each of the values in the ``cdeps`` YAML may contain Jinja2 variables/expressions using a ``cycle`` variable, which is a Python ``datetime`` object corresponding to the FV3 cycle being run.

* Create CDEPS atm configuration:

.. code-block:: text

$ uw cdeps atm --config-file config.yaml --cycle 2023-12-15T18

The driver creates a ``datm_in`` Fortran namelist file and a ``datm.streams`` stream-configuration file in the directory specified by ``rundir:`` in the config.


* Specifying the ``--dry-run`` flag results in the driver logging messages about actions it would have taken, without actually taking any.

.. code-block:: text

$ uw cdeps run --config-file config.yaml --cycle 2023-12-15T18 --batch --dry-run

.. include:: /shared/key_path.rst
1 change: 1 addition & 0 deletions docs/sections/user_guide/cli/drivers/cdeps/Makefile
1 change: 1 addition & 0 deletions docs/sections/user_guide/cli/drivers/cdeps/help.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uw cdeps --help
28 changes: 28 additions & 0 deletions docs/sections/user_guide/cli/drivers/cdeps/help.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
usage: uw cdeps [-h] [--version] TASK ...

Execute cdeps tasks

Optional arguments:
-h, --help
Show help and exit
--version
Show version info and exit

Positional arguments:
TASK
atm
Create data atmosphere configuration with all required content
atm_nml
Create data atmosphere Fortran namelist file (datm_in)
atm_stream
Create data atmosphere stream config file (datm.streams)
ocn
Create data ocean configuration with all required content
ocn_nml
Create data ocean Fortran namelist file (docn_in)
ocn_stream
Create data ocean stream config file (docn.streams)
provisioned_rundir
Run directory provisioned with all required content
uturuncoglu marked this conversation as resolved.
Show resolved Hide resolved
validate
Validate the UW driver config
1 change: 1 addition & 0 deletions docs/sections/user_guide/cli/drivers/cdeps/run-help.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uw cdeps atm --help
28 changes: 28 additions & 0 deletions docs/sections/user_guide/cli/drivers/cdeps/run-help.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
usage: uw cdeps atm --cycle CYCLE [-h] [--version] [--config-file PATH]
[--dry-run] [--graph-file PATH] [--key-path KEY[.KEY...]]
[--quiet] [--verbose]

Create data atmosphere configuration with all required content

Required arguments:
--cycle CYCLE
The cycle in ISO8601 format (e.g. 2024-07-17T00)

Optional arguments:
-h, --help
Show help and exit
--version
Show version info and exit
--config-file PATH, -c PATH
Path to UW YAML config file (default: read from stdin)
--dry-run
Only log info, making no changes
--graph-file PATH
Path to Graphviz DOT output [experimental]
--key-path KEY[.KEY...]
Dot-separated path of keys leading through the config to the driver's
configuration block
--quiet, -q
Print no logging messages
--verbose, -v
Print all logging messages
1 change: 1 addition & 0 deletions docs/sections/user_guide/cli/drivers/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Drivers
.. toctree::
:maxdepth: 1

cdeps
chgres_cube
esg_grid
filter_topo
Expand Down
53 changes: 53 additions & 0 deletions docs/sections/user_guide/yaml/components/cdeps.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.. _cdeps_yaml:

cdeps
=====

Structured YAML to run :cdeps:`CDEPS<index.html>` is validated by JSON Schema and requires the ``cdeps:`` block, described below.

.. include:: /shared/injected_cycle.rst

Here is a prototype UW YAML ``cdeps:`` block, explained in detail below:

.. highlight:: yaml
.. literalinclude:: /shared/cdeps.yaml

UW YAML for the ``cdeps:`` Block
--------------------------------

atm_in
^^^^^^

Configures the atm namelist file. Supports ``base_file:`` and ``update_values:`` blocks (see :ref:`updating_values` for details). Namelist options are described :cdeps:`here<streams.html>`.

.. include:: /shared/validate_namelist.rst

atm_streams
^^^^^^^^^^^

Configures the atm streams.

**streams:**

The ``streams:`` block may contain sub-blocks ``stream01`` through ``stream09``. Each such sub-block specifies a stream configuration to be used to render the Jinja2 template file named by ``template_file:`` (see below). Supported keys and avlues are described :cdeps:`here<streams.html>`.
uturuncoglu marked this conversation as resolved.
Show resolved Hide resolved

**template_file:**

The path to a Jinja2 template file to be rendered, using the values from the ``streams:`` block (see above), to a streams file.

ocn_in
^^^^^^

Configures the ocn namelist file. Supports ``base_file:`` and ``update_values:`` blocks (see :ref:`updating_values` for details). Namelist options are described :cdeps:`here<streams.html>`.

.. include:: /shared/validate_namelist.rst

ocn_streams
^^^^^^^^^^^

Configures the ocn streams. See the ``atm_streams:`` block, above, which is configured identically.

rundir
^^^^^^

The path to the run directory.
1 change: 1 addition & 0 deletions docs/sections/user_guide/yaml/components/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ UW YAML for Components
.. toctree::
:maxdepth: 1

cdeps
chgres_cube
esg_grid
filter_topo
Expand Down
78 changes: 78 additions & 0 deletions docs/shared/cdeps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
cdeps:
atm_in:
update_values:
datm_nml:
datamode: GFS
export_all: true
factorfn_data: 'null'
factorfn_mesh: 'null'
flds_co2: false
flds_presaero: false
flds_wiso: false
iradsw: 1
model_maskfile: /path/to/mesh1.nc
model_meshfile: /path/to/mesh1.nc
nx_global: 100
ny_global: 100
restfilm: 'null'
atm_streams:
streams:
stream01:
dtlimit: 1.5
mapalgo: redist
readmode: single
stream_data_files:
- /path/to/data_file1.nc
stream_data_variables:
- var1
stream_lev_dimname: 'null'
stream_mesh_file: /path/to/mesh1.nc
stream_offset: 0
stream_vectors:
- u
- v
taxmode: limit
tinterpalgo: linear
yearAlign: 2008
yearFirst: 2008
yearLast: 2008
template_file: stream.jinja2
ocn_in:
update_values:
docn_nml:
datamode: some_supported_mode2
import_data_fields: none
model_maskfile: /path/to/mesh2.nc
model_meshfile: /path/to/mesh2.nc
nx_global: 150
ny_global: 150
restfilm: 'null'
skip_restart_read: true
sst_constant_value: -1
ocn_streams:
streams:
stream01:
dtlimit: 1.5
mapalgo: redist
readmode: single
stream_data_files:
- /path/to/data_file2.nc
- /path/to/data_file3.nc
stream_data_variables:
- var2
- var3
stream_lev_dimname: 'null'
stream_mesh_file: /path/to/mesh2.nc
stream_offset: 0
stream_vectors:
- 'null'
taxmode: limit
tinterpalgo: linear
yearAlign: 2008
yearFirst: 2008
yearLast: 2008
template_file: stream.jinja2
rundir: /path/to/dir
platform:
account: me
scheduler: slurm
14 changes: 14 additions & 0 deletions src/uwtools/api/cdeps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
API access to the ``uwtools`` ``cdeps`` driver.
"""

from functools import partial

from uwtools.drivers.cdeps import CDEPS
from uwtools.drivers.support import graph, tasks
from uwtools.utils.api import make_execute as _make_execute

_driver = CDEPS
execute = _make_execute(_driver, with_cycle=True)
tasks = partial(tasks, _driver)
__all__ = [_driver.__name__, "execute", "graph", "tasks"]
Loading