Skip to content

Commit

Permalink
update to latest mom6_bathy
Browse files Browse the repository at this point in the history
  • Loading branch information
alperaltuntas committed May 8, 2024
1 parent f05cb20 commit e86bb0c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion external/mom6_bathy
Submodule mom6_bathy updated 67 files
+3 −2 .docstr/conf.py
+11 −6 .docstr/examples.rst
+2 −2 .docstr/mom6_bathy.grid.rst
+2 −2 .docstr/mom6_bathy.rst
+2 −2 .docstr/mom6_bathy.topo.rst
+84 −116 .docstr/quickstart.rst
+1 −1 docs/.buildinfo
+ docs/.doctrees/environment.pickle
+ docs/.doctrees/examples.doctree
+ docs/.doctrees/glossary.doctree
+ docs/.doctrees/index.doctree
+ docs/.doctrees/installation.doctree
+ docs/.doctrees/modules.doctree
+ docs/.doctrees/mom6_bathy.doctree
+ docs/.doctrees/mom6_bathy.grid.doctree
+ docs/.doctrees/mom6_bathy.topo.doctree
+ docs/.doctrees/quickstart.doctree
+11 −6 docs/_sources/examples.rst.txt
+7 −0 docs/_sources/mom6_bathy.grid.rst.txt
+2 −2 docs/_sources/mom6_bathy.rst.txt
+7 −0 docs/_sources/mom6_bathy.topo.rst.txt
+84 −118 docs/_sources/quickstart.rst.txt
+134 −0 docs/_static/_sphinx_javascript_frameworks_compat.js
+39 −15 docs/_static/basic.css
+1 −1 docs/_static/css/badge_only.css
+2 −2 docs/_static/css/theme.css
+194 −256 docs/_static/doctools.js
+4 −2 docs/_static/documentation_options.js
+10,881 −0 docs/_static/jquery-3.6.0.js
+2 −2 docs/_static/jquery.js
+1 −99 docs/_static/language_data.js
+1 −0 docs/_static/pygments.css
+395 −393 docs/_static/searchtools.js
+27 −16 docs/examples.html
+262 −9 docs/genindex.html
+18 −11 docs/glossary.html
+19 −12 docs/index.html
+24 −17 docs/installation.html
+19 −12 docs/modules.html
+444 −0 docs/mom6_bathy.grid.html
+26 −19 docs/mom6_bathy.html
+0 −123 docs/mom6_bathy.mom6bathy.html
+0 −121 docs/mom6_bathy.mom6grid.html
+327 −0 docs/mom6_bathy.topo.html
+ docs/objects.inv
+30 −124 docs/py-modindex.html
+116 −146 docs/quickstart.html
+15 −8 docs/search.html
+1 −1 docs/searchindex.js
+0 −192 mom6_bathy/depth_modifier.py
+622 −0 mom6_bathy/grid.py
+0 −722 mom6_bathy/mom6bathy.py
+0 −578 mom6_bathy/mom6grid.py
+757 −0 mom6_bathy/topo.py
+218 −0 mom6_bathy/topo_editor.py
+0 −409 notebooks/1_cartesian_ideal_bathy.ipynb
+390 −0 notebooks/1_spherical_grid.ipynb
+365 −0 notebooks/2_equatorial_res.ipynb
+0 −387 notebooks/2_spherical_equatorial_res.ipynb
+274 −0 notebooks/3_custom_bathy.ipynb
+0 −286 notebooks/3_spherical_custom_bathy.ipynb
+57 −67 notebooks/4_ingest_landmask.ipynb
+157 −0 notebooks/5_modify_existing.ipynb
+3 −0 setup.py
+206 −0 tests/test_1.py
+45 −0 tests/test_notebooks.py
+8 −0 tests/utils.py
36 changes: 17 additions & 19 deletions visualCaseGen/custom_widget_types/mom6_bathy_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,15 @@ def _create_notebook_object():
nbf.v4.new_markdown_cell(
"# mom6_bathy\n"
"This notebook is auto-generated by visualCaseGen. "
"Please review and execute the cells below to create the new MOM6 grid and bathymetry."
"Please review and execute the cells below to create the new MOM6 grid and bathymetry. "
"You can modify the cells as needed, unless otherwise noted, to customize the grid "
"and bathymetry."
),
nbf.v4.new_markdown_cell("## 1. Import mom6_bathy"),
nbf.v4.new_code_cell(
"%%capture\n"
"from mom6_bathy.mom6grid import mom6grid\n"
"from mom6_bathy.mom6bathy import mom6bathy"
"from mom6_bathy.grid import Grid\n"
"from mom6_bathy.topo import Topo"
),
nbf.v4.new_markdown_cell("## 2. Create horizontal grid\n"),
]
Expand All @@ -237,15 +237,12 @@ def _create_notebook_object():
nb["cells"].extend([
nbf.v4.new_code_cell(
f'# Do NOT modify this cell!\n'
f'grd = mom6grid(\n'
f'grid = Grid(\n'
f' nx = {nx}, # Number of grid points in x direction\n'
f' ny = {ny}, # Number of grid points in y direction\n'
f' config = "spherical",\n'
f' axis_units = "degrees",\n'
f' lenx = {lenx}, # grid length in x direction (degrees).\n'
f' leny = {leny}, # grid length in y direction (degrees).\n'
f' cyclic_x = {True if cyclic_x == "True" else False},\n'
f' cyclic_y = False,\n'
f')'
)
])
Expand All @@ -269,11 +266,11 @@ def _create_notebook_object():
),
nbf.v4.new_code_cell(
"# Instantiate the bathymetry object\n"
"bathy = mom6bathy(grd, min_depth = 10.0)"
"topo = Topo(grid, min_depth = 10.0)"
),
nbf.v4.new_code_cell(
"# Set the bathymetry to be a flat bottom with a uniform depth of 2000m\n"
"bathy.set_flat(D=2000.0)"
"topo.set_flat(D=2000.0)"
),
]
)
Expand All @@ -286,37 +283,38 @@ def _create_notebook_object():

nb["cells"].extend(
[
nbf.v4.new_code_cell("bathy.depth.plot()"),
nbf.v4.new_code_cell("topo.depth.plot()"),
nbf.v4.new_code_cell(
"# Manually modify the bathymetry\n"
"%matplotlib ipympl\n"
"from mom6_bathy.depth_modifier import DepthModifier\n"
"DepthModifier(bathy)"
"from mom6_bathy.topo_editor import TopoEditor\n"
"TopoEditor(topo)"
),
]
)

save_files_cmd = (
"# Save MOM6 supergrid file. Do NOT modify this cell!\n"
f'grd.to_netcdf(supergrid_path = f"{custom_ocn_grid_path}/ocean_grid_{ocn_grid_name}_{attempt_id}.nc")\n\n'
"# Do NOT modify this cell!\n\n"
"# MOM6 supergrid file.\n"
f'grid.write_supergrid(f"{custom_ocn_grid_path}/ocean_grid_{ocn_grid_name}_{attempt_id}.nc")\n\n'
"# Save MOM6 topography file:\n"
f'bathy.to_topog(f"{custom_ocn_grid_path}/ocean_topog_{ocn_grid_name}_{attempt_id}.nc")\n\n'
f'topo.write_topo(f"{custom_ocn_grid_path}/ocean_topog_{ocn_grid_name}_{attempt_id}.nc")\n\n'
)

if "CICE" in cvars["COMP_ICE_PHYS"].value:
save_files_cmd += (
"# Save CICE grid file:\n"
f'bathy.to_cice_grid(f"{custom_ocn_grid_path}/cice_grid.{ocn_grid_name}_{attempt_id}.nc")\n\n'
"# CICE grid file:\n"
f'topo.write_cice_grid(f"{custom_ocn_grid_path}/cice_grid.{ocn_grid_name}_{attempt_id}.nc")\n\n'
)

save_files_cmd += (
"# Save ESMF mesh file:\n"
f'bathy.to_ESMF_mesh(f"{custom_ocn_grid_path}/ESMF_mesh_{ocn_grid_name}_{attempt_id}.nc")'
f'topo.write_esmf_mesh(f"{custom_ocn_grid_path}/ESMF_mesh_{ocn_grid_name}_{attempt_id}.nc")'
)

nb["cells"].extend(
[
nbf.v4.new_markdown_cell("## 4. Save the grid and bathymetry files"),
nbf.v4.new_markdown_cell("## 4. Save the grid, bathymetry, and mesh files"),
nbf.v4.new_code_cell(save_files_cmd),
]
)
Expand Down
2 changes: 1 addition & 1 deletion visualCaseGen/widgets/compset_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def initialize_compset_widgets(cime):

cv_support_level = cvars["SUPPORT_LEVEL"]
cv_support_level.widget = widgets.ToggleButtons(
description="Include all compsets or scientifically supported only?",
description="Browse all compsets or scientifically supported only?",
layout={"display": "flex", "width": "max-content", "padding": "10px"},
style={"button_width": button_width, "description_width": "max-content"},
)
Expand Down

0 comments on commit e86bb0c

Please sign in to comment.