Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ on:

jobs:
ci_tests:
name: visualCaseGen CI tests
name: visualCaseGen CI tests (Python ${{ matrix.python-version }})
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
defaults:
run:
shell: bash -el {0}
Expand Down Expand Up @@ -56,6 +60,7 @@ jobs:
- name: Create visualCaseGen conda env
run: |
cd CESM/visualCaseGen/
sed -i "s/python>=3.11.10/python=${{ matrix.python-version }}.*/" environment.yml
conda env create --file environment.yml
conda activate visualCaseGen

Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "external/mom6_bathy"]
path = external/mom6_bathy
url = https://github.com/NCAR/mom6_bathy.git
[submodule "external/mom6_forge"]
path = external/mom6_forge
url = https://github.com/NCAR/mom6_forge.git
[submodule "external/ipyfilechooser"]
path = external/ipyfilechooser
url = https://github.com/alperaltuntas/ipyfilechooser.git
12 changes: 6 additions & 6 deletions docs/grid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,23 @@ Ocean Grid
For the ocean grid, if MOM6 is selected as the ocean model, you can either select a standard
ocean grid or create a new MOM6 grid. When creating a new MOM6 grid, you'll specify parameters
such as grid extent and resolution, after which you'll be directed to a separate notebook that
uses the `mom6_bathy` tool to generate the new grid and bathymetry.
uses the `mom6_forge` tool to generate the new grid and bathymetry.

If using a standard ocean grid, select one from the list compatible with your chosen compset
and atmosphere grid. If creating a new MOM6 grid, complete the required parameters, then proceed
to launch the `mom6_bathy` tool for final customization.
to launch the `mom6_forge` tool for final customization.

.. image:: assets/Stage2_6.png

After specifying all ocean grid parameters, click `Launch mom6_bathy`. This will open an
After specifying all ocean grid parameters, click `Launch mom6_forge`. This will open an
auto-generated Jupyter notebook where you can fine-tune the ocean grid, topography, and vertical grid.
You can then generate the corresponding MOM6 input files, which will be saved under `ocnice` subdirectory
within the directory you specified earlier for saving the new grid files.
For more details on mom6_bathy, refer to its documentation: https://ncar.github.io/mom6_bathy/
For more details on mom6_forge, refer to its documentation: https://ncar.github.io/mom6_forge/

.. note:: If the `mom6_bathy` notebook doesn't open automatically, make sure that your browser allows
.. note:: If the `mom6_forge` notebook doesn't open automatically, make sure that your browser allows
pop-ups from visualCaseGen. If the notebook still doesn't open, you can manually launch it by
navigating to the `mom6_bathy_notebooks/` directory in your visualCaseGen installation and opening
navigating to the `mom6_forge_notebooks/` directory in your visualCaseGen installation and opening
the notebook corresponding to your custom grid.

Ocean Initial conditions
Expand Down
18 changes: 9 additions & 9 deletions docs/ridge.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,31 +126,31 @@ assign a unique name to your custom ocean grid.

.. image:: assets/ridge7.png

After specifying all ocean grid parameters, click the green **Launch mom6_bathy** button. This will open an auto-generated
After specifying all ocean grid parameters, click the green **Launch mom6_forge** button. This will open an auto-generated
Jupyter notebook where you can further customize the ocean bathymetry and generate all necessary grid input files.

The mom6_bathy tool
The mom6_forge tool
~~~~~~~~~~~~~~~~~~~

.. important:: If the `mom6_bathy` notebook doesn't open automatically, make sure that your browser allows
.. important:: If the `mom6_forge` notebook doesn't open automatically, make sure that your browser allows
pop-ups from visualCaseGen. If the notebook still doesn't open, you can manually launch it by
navigating to the `mom6_bathy_notebooks/` directory in your visualCaseGen installation and opening
navigating to the `mom6_forge_notebooks/` directory in your visualCaseGen installation and opening
the notebook corresponding to your custom grid.

Once the auto-generated `mom6_bathy` notebook is open, you will see a series of cells that guide you through
Once the auto-generated `mom6_forge` notebook is open, you will see a series of cells that guide you through
the process of creating your custom ocean bathymetry. Before proceeding, make sure that the appropriate
kernel is selected in the top right corner of the notebook. Then, execute the first two cells to import
the necessary libraries and to instantiate the `Grid` object. Notice that the `Grid` object is initialized
with the parameters you specified in visualCaseGen.

.. image:: assets/ridge8.png

The third section of mom6_bathy is where a custom bathymetry may be defined. The default option is to produce
The third section of mom6_forge is where a custom bathymetry may be defined. The default option is to produce
a flat ocean bottom of depth 2000m. We are going to instead generate an ocean that
resembles the ridge world case of `Wu et al (2021) <https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2021GL093966>`_ ,
which has a depth 4000m with some sinusoidal fluctuations, a land ridge of width 1 degree longitude and
the furthest poleward 10 degrees latitude at the poles set to land. We will specify this analytically with python
code within mom6_bathy.
code within mom6_forge.

First, instantiate the topo object by running the cell below. Note that the `min_depth` parameter, which
is set to 10.0m by default determines the minimum bathymetric depth for a cell to be considered ocean.
Expand Down Expand Up @@ -199,7 +199,7 @@ You can plot the bathymetry to see the results by running the cell below:
Vertical Grid
~~~~~~~~~~~~~

Next, you will need to set up the vertical grid. In the `mom6_bathy` notebook,
Next, you will need to set up the vertical grid. In the `mom6_forge` notebook,
a default vertical grid is provided, which consists of 20 layers, and a ratio of 10,
which means that the thicknesses of layers gradually increase with depth, and the thickness
of the bottom layer is 10 times thicker than the top layer.
Expand All @@ -222,7 +222,7 @@ vertical grid files (needed by MOM6), CICE grid file (needed by the sea ice mode
(needed by the CESM coupler).

.. warning:: The paths specified in the cell below are for illustrative purposes only. Do not modify the paths
in your auto-generated `mom6_bathy` notebook. The paths are unique to the user's system and should not be changed,
in your auto-generated `mom6_forge` notebook. The paths are unique to the user's system and should not be changed,
since doing so will prevent visualCaseGen from confirming that the grid files have been successfully generated
and will prevent configuring CESM accurately.

Expand Down
6 changes: 3 additions & 3 deletions docs/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ Commonly Encountered Issues
right corner of the welcome dialog to see if any error messages are displayed. If so, submit an issue on the
visualCaseGen GitHub repository with the error messages.

- **mom6_bathy notebook doesn't open automatically:** If the `mom6_bathy` notebook doesn't open automatically,
- **mom6_forge notebook doesn't open automatically:** If the `mom6_forge` notebook doesn't open automatically,
make sure that your browser allows
pop-ups from visualCaseGen. If the notebook still doesn't open, you can manually launch it by
navigating to the `mom6_bathy_notebooks/` directory in your visualCaseGen installation and opening
navigating to the `mom6_forge_notebooks/` directory in your visualCaseGen installation and opening
the notebook corresponding to your custom grid.

- **The mom6_bathy interactive point-and-click feature is not working on JupyterHub.**
- **The mom6_forge interactive point-and-click feature is not working on JupyterHub.**
If you are experiencing issues with interactive features, such as point-and-click highlighting of individual
cells, you may need to (re)install the ipympl extension. Steps to (re)install the ipympl extension: (1) Open
JupyterHub. (2) Locate the *Extension Manager* tab on the left sidebar: Look for an icon that resembles a puzzle
Expand Down
8 changes: 4 additions & 4 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ channels:
- anaconda

dependencies:
- python>=3.11.10,<3.12
- libxml2>=2.13,<2.14
- xesmf>=0.8.10,<0.9
- python>=3.11.10,<3.13.0
- libxml2>=2.13,<2.16
- xesmf>=0.8.10,<0.10.0
- pip
- pip:
- -e ./external/mom6_bathy/
- -e ./external/mom6_forge/
- -e ./external/ipyfilechooser/
- -e ./ # visualCaseGen
1 change: 0 additions & 1 deletion external/mom6_bathy
Submodule mom6_bathy deleted from cc9c76
1 change: 1 addition & 0 deletions external/mom6_forge
Submodule mom6_forge added at e4f665
2 changes: 1 addition & 1 deletion internal/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
This subdirectory is internally used by visualCaseGen to exchange information with mom6_bathy and other tools. Manually interfering with files in this directory may disrupt any active visualCaseGen session.
This subdirectory is internally used by visualCaseGen to exchange information with mom6_forge and other tools. Manually interfering with files in this directory may disrupt any active visualCaseGen session.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This directory is for storing mom6_bathy notebooks generated by visualCaseGen.
This directory is for storing mom6_forge notebooks generated by visualCaseGen.
When you are done with a notebook, you may manually remove or store it for documentation purposes.
28 changes: 14 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ classifiers = [
"Programming Language :: Python",
"Framework :: Jupyter"
]
requires-python = ">=3.11.10,<3.12"
requires-python = ">=3.11.10,<3.13.0"
dependencies = [
"ipykernel>=6.29,<6.30",
"ipython>=8.2,<8.3",
"jupyterlab>=4.0,<4.1",
"jupyterlab_server>=2.25,<2.26",
"ipywidgets>=8.1.1,<8.2",
"PyYAML>=6.0,<6.1",
"z3-solver>=4.12.3,<4.13",
"networkx>=3.3,<3.4",
"netcdf4>=1.6,<1.7",
"xarray>=2023.12,<2024",
"black>=24.1,<24.2",
"pytest>=8.0,<8.1",
"hypothesis>=6.125.1,<6.126"
"ipykernel>=6.29,<7.3.0",
"ipython>=8.2,<9.13",
"jupyterlab>=4.0,<4.6.0",
"jupyterlab_server>=2.25,<2.29.0",
"ipywidgets>=8.1.1,<8.2.0",
"PyYAML>=6.0,<6.1.0",
"z3-solver>=4.12.3,<4.17.0",
"networkx>=3.3,<3.7.0",
"netcdf4>=1.6,<1.8.0",
"xarray>=2023.12,<2026.3.0",
"black>=24.1,<26.4.0",
"pytest>=8.0,<9.1.0",
"hypothesis>=6.125.1,<6.152.0"
]

[build-system]
Expand Down
2 changes: 1 addition & 1 deletion tests/3_system/test_custom_compset_std_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from visualCaseGen.initialize_stages import initialize_stages
from visualCaseGen.specs.options import set_options
from visualCaseGen.specs.relational_constraints import get_relational_constraints
from visualCaseGen.custom_widget_types.mom6_bathy_launcher import MOM6BathyLauncher
from visualCaseGen.custom_widget_types.mom6_forge_launcher import MOM6ForgeLauncher
from visualCaseGen.custom_widget_types.case_creator_widget import CaseCreatorWidget
from tests.utils import safe_create_case

Expand Down
24 changes: 12 additions & 12 deletions tests/3_system/test_custom_mom6_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from visualCaseGen.initialize_stages import initialize_stages
from visualCaseGen.specs.options import set_options
from visualCaseGen.specs.relational_constraints import get_relational_constraints
from visualCaseGen.custom_widget_types.mom6_bathy_launcher import MOM6BathyLauncher
from visualCaseGen.custom_widget_types.mom6_forge_launcher import MOM6ForgeLauncher
from visualCaseGen.custom_widget_types.case_creator_widget import CaseCreatorWidget
from tests.utils import safe_create_case

Expand Down Expand Up @@ -90,24 +90,24 @@ def test_custom_mom6_grid():
cvars["OCN_LENY"].value = 160.0
cvars["CUSTOM_OCN_GRID_NAME"].value = "custom_ocn_grid"

# now launch the mom6_bathy notebook
# now launch the mom6_forge notebook

mom6_bathy_launcher_widget = Stage.active()._widget._main_body.children[-1]
assert isinstance(mom6_bathy_launcher_widget, MOM6BathyLauncher)
mom6_forge_launcher_widget = Stage.active()._widget._main_body.children[-1]
assert isinstance(mom6_forge_launcher_widget, MOM6ForgeLauncher)

# After setting all the required parameters, the launch button should be enabled
assert mom6_bathy_launcher_widget._btn_launch_mom6_bathy.disabled is False
assert mom6_forge_launcher_widget._btn_launch_mom6_forge.disabled is False

# *Click* the launch button
mom6_bathy_launcher_widget._on_btn_launch_clicked(b=None)
mom6_forge_launcher_widget._on_btn_launch_clicked(b=None)

# The confirm button should be visible:
assert (
mom6_bathy_launcher_widget._btn_confirm_completion.layout.display != "none"
mom6_forge_launcher_widget._btn_confirm_completion.layout.display != "none"
)

# *Click* the confirm button
mom6_bathy_launcher_widget._on_btn_confirm_completion_clicked(b=None)
mom6_forge_launcher_widget._on_btn_confirm_completion_clicked(b=None)

# Since the notebook wasn't fully executed, we should remain in the same stage
assert Stage.active().title.startswith("Custom Ocean")
Expand All @@ -116,10 +116,10 @@ def test_custom_mom6_grid():
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor, CellExecutionError

# find the only mom6_bathy_*.ipynb file in the mom6_bathy_notebooks directory
# find the only mom6_forge_*.ipynb file in the mom6_forge_notebooks directory
ocn_grid_name = cvars['CUSTOM_OCN_GRID_NAME'].value
nb_files = list(Path("mom6_bathy_notebooks").glob(f"mom6_bathy_{ocn_grid_name}*.ipynb"))
assert len(nb_files) == 1, "Expected only one mom6_bathy notebook file"
nb_files = list(Path("mom6_forge_notebooks").glob(f"mom6_forge_{ocn_grid_name}*.ipynb"))
assert len(nb_files) == 1, "Expected only one mom6_forge notebook file"
nb_path = nb_files[0]

with open(nb_path, "r") as f:
Expand Down Expand Up @@ -173,7 +173,7 @@ def test_custom_mom6_grid():
# If the error is not related to machine porting, raise it
raise e

# remove mom6_bathy notebook belonging to the test_grid:
# remove mom6_forge notebook belonging to the test_grid:
if os.path.exists(nb_path):
os.remove(nb_path)

Expand Down
22 changes: 11 additions & 11 deletions tests/3_system/test_f2000_custom_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from visualCaseGen.specs.relational_constraints import get_relational_constraints
from visualCaseGen.custom_widget_types.clm_modifier_launcher import MeshMaskModifierLauncher, FsurdatModifierLauncher
from visualCaseGen.custom_widget_types.case_creator_widget import CaseCreatorWidget
from visualCaseGen.custom_widget_types.mom6_bathy_launcher import MOM6BathyLauncher
from visualCaseGen.custom_widget_types.mom6_forge_launcher import MOM6ForgeLauncher
from tests.utils import safe_create_case


Expand Down Expand Up @@ -308,30 +308,30 @@ def construct_custom_res_from_new_mom6_grid_modified_clm_grid(cime):
cvars["OCN_LENY"].value = 160.0
cvars["CUSTOM_OCN_GRID_NAME"].value = "custom_ocn_grid"

# now launch the mom6_bathy notebook
# now launch the mom6_forge notebook

mom6_bathy_launcher_widget = Stage.active()._widget._main_body.children[-1]
assert isinstance(mom6_bathy_launcher_widget, MOM6BathyLauncher)
mom6_forge_launcher_widget = Stage.active()._widget._main_body.children[-1]
assert isinstance(mom6_forge_launcher_widget, MOM6ForgeLauncher)

# After setting all the required parameters, the launch button should be enabled
assert mom6_bathy_launcher_widget._btn_launch_mom6_bathy.disabled is False
assert mom6_forge_launcher_widget._btn_launch_mom6_forge.disabled is False

# *Click* the launch button
mom6_bathy_launcher_widget._on_btn_launch_clicked(b=None)
mom6_forge_launcher_widget._on_btn_launch_clicked(b=None)

# The confirm button should be visible:
assert (
mom6_bathy_launcher_widget._btn_confirm_completion.layout.display != "none"
mom6_forge_launcher_widget._btn_confirm_completion.layout.display != "none"
)

# now, programmatically run the notebook
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor, CellExecutionError

# find the only mom6_bathy_*.ipynb file in the mom6_bathy_notebooks directory
# find the only mom6_forge_*.ipynb file in the mom6_forge_notebooks directory
ocn_grid_name = cvars['CUSTOM_OCN_GRID_NAME'].value
nb_files = list(Path("mom6_bathy_notebooks").glob(f"mom6_bathy_{ocn_grid_name}*.ipynb"))
assert len(nb_files) == 1, "Expected only one mom6_bathy notebook file"
nb_files = list(Path("mom6_forge_notebooks").glob(f"mom6_forge_{ocn_grid_name}*.ipynb"))
assert len(nb_files) == 1, "Expected only one mom6_forge notebook file"
nb_path = nb_files[0]

with open(nb_path, "r") as f:
Expand Down Expand Up @@ -393,7 +393,7 @@ def construct_custom_res_from_new_mom6_grid_modified_clm_grid(cime):
# sleep for a bit to allow the case to be created
time.sleep(5)

# remove mom6_bathy notebook belonging to the test_grid:
# remove mom6_forge notebook belonging to the test_grid:
os.remove(nb_path)

# remove the caseroot directory
Expand Down
2 changes: 1 addition & 1 deletion visualCaseGen/config_vars/grid_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def initialize_custom_grid_variables(cime):
ConfigVarInt("OCN_NY") # number of cells in y-direction
ConfigVarReal("OCN_LENX") # grid length in x-direction
ConfigVarReal("OCN_LENY") # grid length in y-direction
ConfigVarStr('MB_ATTEMPT_ID') # latest mom6_bathy attempt id (auxiliary variable)
ConfigVarStr('MB_ATTEMPT_ID') # latest mom6_forge attempt id (auxiliary variable)
ConfigVarStr(
"MOM6_BATHY_STATUS", widget_none_val=""
) # a status variable to prevent the completion of the stage
Expand Down
14 changes: 7 additions & 7 deletions visualCaseGen/custom_widget_types/case_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import math

from ProConPy.config_var import cvars
from visualCaseGen.custom_widget_types.mom6_bathy_launcher import MOM6BathyLauncher
from visualCaseGen.custom_widget_types.mom6_forge_launcher import MOM6ForgeLauncher
from visualCaseGen.custom_widget_types.dummy_output import DummyOutput
from visualCaseGen.custom_widget_types.case_tools import xmlchange, run_case_setup, append_user_nl, is_ccs_config_writeable

Expand Down Expand Up @@ -435,7 +435,7 @@ def _update_component_grids(
new_domain,
"desc",
)
desc.text = f"New ocean grid {ocn_grid} generated by mom6_bathy"
desc.text = f"New ocean grid {ocn_grid} generated by mom6_forge"

if not do_exec:
return
Expand Down Expand Up @@ -642,10 +642,10 @@ def _apply_mom_namelist_changes(self, do_exec):
ocn_grid_mode == "Create New"
), f"Unknown ocean grid mode: {ocn_grid_mode}"

supergrid_file_path = MOM6BathyLauncher.supergrid_file_path()
topo_file_path = MOM6BathyLauncher.topo_file_path()
vgrid_file_path = MOM6BathyLauncher.vgrid_file_path()
ocn_grid_path = MOM6BathyLauncher.get_custom_ocn_grid_path()
supergrid_file_path = MOM6ForgeLauncher.supergrid_file_path()
topo_file_path = MOM6ForgeLauncher.topo_file_path()
vgrid_file_path = MOM6ForgeLauncher.vgrid_file_path()
ocn_grid_path = MOM6ForgeLauncher.get_custom_ocn_grid_path()

# read in min and max depth from the MOM6 topo file:
ds_topo = xr.open_dataset(topo_file_path)
Expand Down Expand Up @@ -752,7 +752,7 @@ def _apply_cice_namelist_changes(self, do_exec):
if not comp_ice.startswith("cice"):
return

cice_grid_file_path = MOM6BathyLauncher.cice_grid_file_path()
cice_grid_file_path = MOM6ForgeLauncher.cice_grid_file_path()
self._apply_user_nl_changes(
"cice",
[
Expand Down
Loading
Loading