{ "cells": [ { "cell_type": "markdown", "id": "e750cf22-3ebc-4e03-bbd4-ea190aaf4ca2", "metadata": { "jp-MarkdownHeadingCollapsed": true }, "source": [ "# Object Configurators in mom6_forge\n", "\n", "## Set up a custom regional CESM-MOM6 domain using object configurators\n", "\n", "These object configurators include:\n", "\n", "1. A horizontal grid creator (Grid Creator)\n", "2. A topography editor (Topo Editor)\n", "3. A vertical grid creator (VGrid Creator)\n", "\n", "This notebook demonstrates how to use these object configurators to streamline regional CESM-MOM6 domain generation." ] }, { "cell_type": "markdown", "id": "d0d70586-e8f9-421a-a9b3-b9ea922329d8", "metadata": {}, "source": [ "## SECTION 1: Using the Grid Creator" ] }, { "cell_type": "markdown", "id": "1bcfa877-c711-4802-8e59-a4b6513032c5", "metadata": {}, "source": [ "We begin by defining a regional MOM6 domain. To do so, we first generate a horizontal grid." ] }, { "cell_type": "code", "execution_count": 2, "id": "c54b08a3-0c12-4f63-a686-f7ceba206fe9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The autoreload extension is already loaded. To reload it, use:\n", " %reload_ext autoreload\n" ] } ], "source": [ "%load_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "markdown", "id": "aac156c3-cb67-4513-831d-edf44eb9d35a", "metadata": {}, "source": [ "We instantiate a `Grid` with the necessary parameters, including resolution, xstart, lenx, ystart, leny, and name." ] }, { "cell_type": "code", "execution_count": 3, "id": "6f3d8331-1d17-4f6d-9145-3ebe1db8b0e3", "metadata": {}, "outputs": [], "source": [ "from mom6_forge.grid import Grid\n", "%matplotlib ipympl\n", "grid = Grid(\n", " resolution = 0.01,\n", " xstart = 281.0,\n", " lenx = 5.0,\n", " ystart = 35.0,\n", " leny = 5.0,\n", " name = \"EastCoast\",\n", ")" ] }, { "cell_type": "markdown", "id": "8be7debd-77ed-4db1-b029-736e405df186", "metadata": {}, "source": [ "Once we have instantiated a `Grid` object, we are now ready to use the Grid Creator." ] }, { "cell_type": "markdown", "id": "9b484951-54a9-4dc3-9d05-4d95e02c84e8", "metadata": {}, "source": [ "## 1. Launching the Grid Creator\n", "\n", "First, import and launch the Grid Creator in a notebook cell:" ] }, { "cell_type": "code", "execution_count": 4, "id": "d96dc0fb-0138-4727-a2a6-cdae762a7376", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "bd712d20c9e34606bc8355b8eb64f3bf", "version_major": 2, "version_minor": 0 }, "text/plain": [ "GridCreator(children=(VBox(children=(VBox(children=(HTML(value='