From 82ff46fc41b74d36761bb70c10145b63388579cb Mon Sep 17 00:00:00 2001 From: alperaltuntas Date: Fri, 24 Oct 2025 16:25:16 -0600 Subject: [PATCH 1/6] add a test that catches the issue with std mom6 grid: Case creator attemps to set NTASKS_OCN for by checking OCN_NX and OCN_NY but those variables are not set for standard MOM6 grids. --- .../3_system/test_custom_compset_std_grid.py | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100755 tests/3_system/test_custom_compset_std_grid.py diff --git a/tests/3_system/test_custom_compset_std_grid.py b/tests/3_system/test_custom_compset_std_grid.py new file mode 100755 index 0000000..e591546 --- /dev/null +++ b/tests/3_system/test_custom_compset_std_grid.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python3 + +import pytest +import shutil +import os +from pathlib import Path +import tempfile +import time + +from ProConPy.config_var import ConfigVar, cvars +from ProConPy.stage import Stage +from ProConPy.csp_solver import csp +from visualCaseGen.cime_interface import CIME_interface +from visualCaseGen.initialize_configvars import initialize_configvars +from visualCaseGen.initialize_widgets import initialize_widgets +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.case_creator_widget import CaseCreatorWidget +from tests.utils import safe_create_case + + +# do not show logger output +import logging + +logger = logging.getLogger() +logger.setLevel(logging.CRITICAL) + +base_temp_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "temp")) + + +def test_custom_compset_std_grid(): + """Configure a custom compset with a standard grid: 2000_DATM%JRA_SLND_CICE%PRES_MOM6_SROF_SGLC_WW3. Progress through the stages + until the launch stage is reached.""" + + ConfigVar.reboot() + Stage.reboot() + cime = CIME_interface() + initialize_configvars(cime) + initialize_widgets(cime) + initialize_stages(cime) + set_options(cime) + csp.initialize(cvars, get_relational_constraints(cvars), Stage.first()) + + # At initialization, the first stage should be enabled + assert Stage.first().enabled + cvars['COMPSET_MODE'].value = 'Custom' + + # CCOMPSET_MODE is the only variable in the first stage, so assigning a value to it should disable the first stage + assert not Stage.first().enabled + + # The next stge is Custom Component Set, whose first child is Model Time Period + assert Stage.active().title.startswith('Time Period') + cvars['INITTIME'].value = '1850' + + cvars['COMP_OCN'].value = "mom" + cvars['COMP_ICE'].value = "sice" + cvars['COMP_ATM'].value = "cam" + cvars['COMP_ROF'].value = "mosart" + cvars['COMP_LND'].value = "clm" + cvars['COMP_WAV'].value = "swav" + cvars['COMP_GLC'].value = "sglc" + + + assert Stage.active().title.startswith('Component Physics') + + cvars['COMP_ATM_PHYS'].value = "CAM60" + cvars['COMP_LND_PHYS'].value = "CLM60" + + assert Stage.active().title.startswith('Component Options') + + cvars['COMP_ATM_OPTION'].value = "1PCT" + cvars['COMP_LND_OPTION'].value = "BGC" + cvars['COMP_OCN_OPTION'].value = "(none)" + cvars['COMP_ICE_OPTION'].value = "(none)" + cvars['COMP_ROF_OPTION'].value = "(none)" + + assert Stage.active().title.startswith('2. Grid') + + cvars['GRID_MODE'].value = 'Standard' + cvars['GRID'].value = 'f09_t232' + + assert Stage.active().title.startswith('3. Launch') + launch_stage = Stage.active() + + with tempfile.TemporaryDirectory(dir=base_temp_dir) as temp_case_path: + pass # immediately remove the random temporary directory, + # which will become the caseroot directory below + + cvars["CASEROOT"].value = temp_case_path + + case_creator = launch_stage._widget._main_body.children[-1] + assert isinstance(case_creator, CaseCreatorWidget) + + cvars["PROJECT"].value = "12345" + + # *Click* the create_case button + safe_create_case(cime.srcroot, case_creator) + + # sleep for a bit to allow the case to be created + time.sleep(5) + + # remove the caseroot directory + shutil.rmtree(temp_case_path) + + From 5f452235112d470c31730bce8504098c66da0efc Mon Sep 17 00:00:00 2001 From: alperaltuntas Date: Fri, 24 Oct 2025 16:27:59 -0600 Subject: [PATCH 2/6] fix the issue with standard MOM6 grids: Case creator attemps to set NTASKS_OCN for by checking OCN_NX and OCN_NY but those variables are not set for standard MOM6 grids. While we can retrieve them for standard grids too, we should still not change NTASKS for standard ocn grids, because they have associated, and optimized NTASKS values set in config_pes files. --- visualCaseGen/custom_widget_types/case_creator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/visualCaseGen/custom_widget_types/case_creator.py b/visualCaseGen/custom_widget_types/case_creator.py index 8205857..e6b5c73 100644 --- a/visualCaseGen/custom_widget_types/case_creator.py +++ b/visualCaseGen/custom_widget_types/case_creator.py @@ -508,8 +508,8 @@ def _apply_all_xmlchanges(self, do_exec): else: assert lnd_grid_mode in [None, "", "Standard"], f"Unknown land grid mode: {lnd_grid_mode}" - # Set NTASKS based on grid size. e.g. NX * NY < max_pts_per_core - if cvars["COMP_OCN"].value == "mom": + # Set NTASKS based on grid size if custom ocn grid. e.g. NX * NY < max_pts_per_core + if cvars["COMP_OCN"].value == "mom" and cvars["OCN_GRID_MODE"].value == "Custom": num_points = int(cvars["OCN_NX"].value) * int(cvars["OCN_NY"].value) cores = CaseCreator._calc_cores_based_on_grid(num_points) with self._out: From 1044d4303eb2abf65afe7e948bb460f5aab6f604 Mon Sep 17 00:00:00 2001 From: alperaltuntas Date: Tue, 20 Jan 2026 22:51:06 -0700 Subject: [PATCH 3/6] add libxm2 dependency --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index a310f6a..3294e2b 100644 --- a/environment.yml +++ b/environment.yml @@ -6,7 +6,7 @@ channels: dependencies: - python>=3.11.10,<3.12 - #- xesmf + - libxml2>=2.13,<2.14 - pip - pip: - -e ./external/mom6_bathy/ From 3a54ceee75126cd423fce697174060d8e57d75a8 Mon Sep 17 00:00:00 2001 From: manishvenu Date: Mon, 23 Mar 2026 15:18:06 -0600 Subject: [PATCH 4/6] Changes --- environment.yml | 2 +- pyproject.toml | 28 +++++++++---------- .../clm_modifier_launcher.py | 1 + 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/environment.yml b/environment.yml index 3294e2b..2de76c4 100644 --- a/environment.yml +++ b/environment.yml @@ -5,7 +5,7 @@ channels: - anaconda dependencies: - - python>=3.11.10,<3.12 + - python>=3.12 - libxml2>=2.13,<2.14 - pip - pip: diff --git a/pyproject.toml b/pyproject.toml index 48ff9d7..145ac16 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,21 +13,21 @@ classifiers = [ "Programming Language :: Python", "Framework :: Jupyter" ] -requires-python = ">=3.11.10,<3.12" +requires-python = ">=3.12" 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", + "ipython>=8.2", + "jupyterlab>=4.0", + "jupyterlab_server>=2.25", + "ipywidgets>=8.1.1", + "PyYAML>=6.0", + "z3-solver>=4.12.3", + "networkx>=3.3", + "netcdf4>=1.6", + "xarray>=2023.12", + "black>=24.1", + "pytest>=8.0", + "hypothesis>=6.125.1" ] [build-system] diff --git a/visualCaseGen/custom_widget_types/clm_modifier_launcher.py b/visualCaseGen/custom_widget_types/clm_modifier_launcher.py index 920be86..1ff8a68 100644 --- a/visualCaseGen/custom_widget_types/clm_modifier_launcher.py +++ b/visualCaseGen/custom_widget_types/clm_modifier_launcher.py @@ -305,6 +305,7 @@ def _write_config(self, config_file_path, modified_file_path): f.write( f"lat_dimname = UNSET\n" f"lon_dimname = UNSET\n" + f"lon_type = 360\n" f'dom_pft = {set_val(cvars["LND_DOM_PFT"].value)}\n' f"evenly_split_cropland = False\n" f"lai = {lai}\n" From a3870be2cad338faaec2a56e9888bd6491c6dc68 Mon Sep 17 00:00:00 2001 From: manishvenu Date: Mon, 23 Mar 2026 15:23:02 -0600 Subject: [PATCH 5/6] Bleh --- external/mom6_bathy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/mom6_bathy b/external/mom6_bathy index c8156d7..e4d197b 160000 --- a/external/mom6_bathy +++ b/external/mom6_bathy @@ -1 +1 @@ -Subproject commit c8156d7852a970e94769e3549ac97ec168cddd33 +Subproject commit e4d197bbd6374eb375dfc57a5ccd1be04a195d2c From 95868eba42a12e634a14f3b5a4751d6ad484c985 Mon Sep 17 00:00:00 2001 From: manishvenu Date: Mon, 23 Mar 2026 15:24:32 -0600 Subject: [PATCH 6/6] Bleh --- external/mom6_bathy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/mom6_bathy b/external/mom6_bathy index e4d197b..0b74164 160000 --- a/external/mom6_bathy +++ b/external/mom6_bathy @@ -1 +1 @@ -Subproject commit e4d197bbd6374eb375dfc57a5ccd1be04a195d2c +Subproject commit 0b7416488225b381373303bc19e64fba50456114