Skip to content

Commit 84d899c

Browse files
committed
Changes required
1 parent 20bd117 commit 84d899c

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

visualCaseGen/config_vars/grid_vars.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ def initialize_custom_grid_variables(cime):
4040
# A preexisting ATM grid picked for custom grid
4141
ConfigVarStrMS("CUSTOM_ATM_GRID", default_value="0.9x1.25")
4242

43+
# The associated domain mesh
44+
ConfigVarStrMS("CUSTOM_ATM_DOMAIN_MESH")
45+
4346
# Custom ocean grid variables
4447
ConfigVarStr("OCN_GRID_MODE") # Standard, Modify Existing, Create New
4548

@@ -71,6 +74,8 @@ def initialize_custom_grid_variables(cime):
7174
"CUSTOM_LND_GRID",
7275
default_value="0.9x1.25"
7376
) # A preexisting land grid picked for the custom grid
77+
ConfigVarStr("CUSTOM_LND_DOMAIN_MESH") # The associated domain mesh
78+
7479

7580
# Auto-fill the INPUT_MASK_MESH variable based on the CUSTOM_LND_GRID variable
7681
def default_input_mask_mesh():

visualCaseGen/custom_widget_types/case_creator.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def create_case(self, do_exec):
108108
if cvars["GRID_MODE"].value == "Standard":
109109
resolution = cvars["GRID"].value
110110
elif cvars["GRID_MODE"].value == "Custom":
111-
resolution = "a%" + cvars["CUSTOM_ATM_GRID"].value + "_l%" + cvars["CUSTOM_LND_GRID"].value + "_oi%VisualCaseGen_Custom_r%null_g%null_w%null_z%null_m%VisualCaseGen_Custom"
111+
resolution = "visualCaseGen_Custom"
112112
else:
113113
raise RuntimeError(f"Unknown grid mode: {cvars['GRID_MODE'].value}")
114114

@@ -117,6 +117,7 @@ def create_case(self, do_exec):
117117
print(f"{COMMENT}Creating case...{RESET}\n")
118118

119119
# Run create_newcase
120+
breakpoint()
120121
self._run_create_newcase(caseroot, compset, resolution, do_exec)
121122

122123
# Add custom grid information to the case if needed:
@@ -230,6 +231,14 @@ def _update_component_grids(
230231

231232
xmlchange("OCN_GRID", "VCG_Changed", do_exec, self._is_non_local(), self._out)
232233

234+
xmlchange("ATM_GRID", cvars["CUSTOM_ATM_GRID"].value, do_exec, self._is_non_local(), self._out)
235+
236+
xmlchange("LND_GRID", cvars["CUSTOM_LND_GRID"].value, do_exec, self._is_non_local(), self._out)
237+
238+
xmlchange("ATM_DOMAIN_MESH", cvars["CUSTOM_ATM_DOMAIN_MESH"].value, do_exec, self._is_non_local(), self._out)
239+
240+
xmlchange("LND_DOMAIN_MESH", cvars["CUSTOM_LND_DOMAIN_MESH"].value, do_exec, self._is_non_local(), self._out)
241+
233242

234243
lnd_grid_mode = cvars["LND_GRID_MODE"].value
235244
if lnd_grid_mode == "Modified":

visualCaseGen/specs/grid_options.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,26 @@ def custom_atm_grid_options_func(comp_atm, grid_mode):
125125
func=custom_atm_grid_options_func, args=(cvars["COMP_ATM"], cvars["GRID_MODE"])
126126
)
127127

128+
# CUSTOM_ATM_DOMAIN_MESH options
129+
def custom_atm_domain_mesh_options_func(comp_atm, grid_mode):
130+
"""Return the options and descriptions for the custom ATM grid variable."""
131+
compset_lname = cvars["COMPSET_LNAME"].value
132+
compatible_atm_grids = []
133+
descriptions = []
134+
meshes = []
135+
for atm_grid in cime.domains["atm"].values():
136+
if check_comp_grid("ATM", atm_grid, compset_lname) is False:
137+
continue
138+
compatible_atm_grids.append(atm_grid.mesh)
139+
descriptions.append(atm_grid.desc)
140+
meshes.append(atm_grid.mesh)
141+
return meshes, descriptions
142+
143+
cv_custom_atm_domain_mesh = cvars["CUSTOM_ATM_DOMAIN_MESH"]
144+
cv_custom_atm_domain_mesh.options_spec = OptionsSpec(
145+
func=custom_atm_domain_mesh_options_func, args=(cvars["COMP_ATM"], cvars["GRID_MODE"])
146+
)
147+
128148

129149
def set_custom_ocn_grid_options(cime):
130150
"""Set the options and options specs for the custom OCN grid variables.
@@ -223,6 +243,33 @@ def custom_lnd_grid_options_func(comp_lnd, custom_atm_grid, lnd_grid_mode):
223243
args=(cvars["COMP_LND"], cvars["CUSTOM_ATM_GRID"], cvars["LND_GRID_MODE"]),
224244
)
225245

246+
247+
# CUSTOM_LND_DOMAIN_MESH options
248+
def custom_lnd_domain_mesh_options_func(comp_lnd, custom_atm_grid, lnd_grid_mode):
249+
"""Return the options and descriptions for the custom LND grid variable."""
250+
if comp_lnd != "clm":
251+
return [custom_atm_grid], [
252+
"(When CLM is not selected, custom LND grid is automatically set to ATM grid.)"
253+
]
254+
else:
255+
compset_lname = cvars["COMPSET_LNAME"].value
256+
compatible_lnd_grids = []
257+
descriptions = []
258+
meshes = []
259+
for lnd_grid in cime.domains["lnd"].values():
260+
if check_comp_grid("LND", lnd_grid, compset_lname) is False:
261+
continue
262+
compatible_lnd_grids.append(lnd_grid.name)
263+
descriptions.append(lnd_grid.desc)
264+
meshes.append(lnd_grid.mesh)
265+
return meshes, descriptions
266+
267+
cv_custom_lnd_domain_mesh = cvars["CUSTOM_LND_DOMAIN_MESH"]
268+
cv_custom_lnd_domain_mesh.options_spec = OptionsSpec(
269+
func=custom_lnd_domain_mesh_options_func,
270+
args=(cvars["COMP_LND"], cvars["CUSTOM_ATM_GRID"], cvars["LND_GRID_MODE"]),
271+
)
272+
226273
cv_fsurdat_idealized = cvars["FSURDAT_IDEALIZED"]
227274
cv_fsurdat_idealized.options = ["True", "False"]
228275

0 commit comments

Comments
 (0)