{ "cells": [ { "cell_type": "markdown", "id": "e66cc92f-add7-48dc-a6e9-1e8862765a2e", "metadata": {}, "source": [ "# Create Mask for ECCO Modeling Utilities (EMU)" ] }, { "cell_type": "markdown", "id": "329c9750-bd42-4868-b34b-ac549e496808", "metadata": {}, "source": [ "This notebook describes how to create a mask for EMU.\n", "\n", "- [Example 1](#example-1-create-a-2d-mask-for-the-box-mean-ssh-in-the-nino-34-box-weighted-by-grid-cell-area) Create a 2d mask for the box-mean SSH in the NINO 3.4 box, weighted by grid cell area\n", "\n", "- [Example 2](#example-2-create-a-very-similar-mask-but-for-ssh-anomaly-relative-to-the-global-mean-sea-level) Create a very similar mask but for ***SSH anomaly relative to the global mean sea level***\n", "\n", "- [Example 3](#example-3-create-a-3d-mask-for-the-box-mean-theta-in-the-nino-34-box-between-20-and-60-meters-weighted-by-grid-cell-volume) Create a 3D mask for the box-mean THETA in the NINO 3.4 box between 20 and 60 meters, weighted by grid cell volume\n", "\n", "- [Example 4](#example-4-create-transect-masks-for-transport) Create transect masks for transport\n", "\n", "- [Example 5](#example-5-create-a-basin-mask-for-pacific) Create a basin mask for Pacific" ] }, { "cell_type": "markdown", "id": "4f806aaf-6da0-465d-b48a-9365dfa1a9cf", "metadata": {}, "source": [ "## Load modules " ] }, { "cell_type": "code", "execution_count": 1, "id": "a9f74f87-bcf5-46ea-8b32-f4297af2f7c0", "metadata": {}, "outputs": [], "source": [ "import sys\n", "from os.path import join,expanduser\n", "import xarray as xr\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", "#user_home_dir = expanduser('~')\n", "#sys.path.append(join(user_home_dir,'ECCOv4-py'))\n", "import ecco_v4_py as ecco\n", "#sys.path.append(join(user_home_dir,'ECCO-v4-Python-Tutorial'))\n", "#import ecco_access as ea" ] }, { "cell_type": "markdown", "id": "c2189d9b-7805-448f-8812-98cf2e4825fc", "metadata": {}, "source": [ "## Load grid" ] }, { "cell_type": "code", "execution_count": 2, "id": "06090159-b7c3-4b03-96fb-6b14f3f3fa72", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset> Size: 89MB\n", "Dimensions: (i: 90, i_g: 90, j: 90, j_g: 90, k: 50, k_u: 50, k_l: 50,\n", " k_p1: 51, tile: 13, nb: 4, nv: 2)\n", "Coordinates: (12/20)\n", " * i (i) int32 360B 0 1 2 3 4 5 6 7 8 9 ... 81 82 83 84 85 86 87 88 89\n", " * i_g (i_g) int32 360B 0 1 2 3 4 5 6 7 8 9 ... 81 82 83 84 85 86 87 88 89\n", " * j (j) int32 360B 0 1 2 3 4 5 6 7 8 9 ... 81 82 83 84 85 86 87 88 89\n", " * j_g (j_g) int32 360B 0 1 2 3 4 5 6 7 8 9 ... 81 82 83 84 85 86 87 88 89\n", " * k (k) int32 200B 0 1 2 3 4 5 6 7 8 9 ... 41 42 43 44 45 46 47 48 49\n", " * k_u (k_u) int32 200B 0 1 2 3 4 5 6 7 8 9 ... 41 42 43 44 45 46 47 48 49\n", " ... ...\n", " Zp1 (k_p1) float32 204B 0.0 -10.0 -20.0 ... -5.678e+03 -6.134e+03\n", " Zu (k_u) float32 200B -10.0 -20.0 -30.0 ... -5.678e+03 -6.134e+03\n", " Zl (k_l) float32 200B 0.0 -10.0 -20.0 ... -5.244e+03 -5.678e+03\n", " XC_bnds (tile, j, i, nb) float32 2MB -115.0 -115.0 -107.9 ... -115.0 -108.5\n", " YC_bnds (tile, j, i, nb) float32 2MB -88.18 -88.32 -88.3 ... -88.18 -88.16\n", " Z_bnds (k, nv) float32 400B 0.0 -10.0 -10.0 ... -5.678e+03 -6.134e+03\n", "Dimensions without coordinates: nb, nv\n", "Data variables: (12/21)\n", " CS (tile, j, i) float32 421kB 0.06158 0.06675 ... -0.9854 -0.9984\n", " SN (tile, j, i) float32 421kB -0.9981 -0.9978 ... -0.1705 -0.05718\n", " rA (tile, j, i) float32 421kB 3.623e+08 3.633e+08 ... 3.611e+08\n", " dxG (tile, j_g, i) float32 421kB 1.558e+04 1.559e+04 ... 2.314e+04\n", " dyG (tile, j, i_g) float32 421kB 2.321e+04 2.327e+04 ... 1.558e+04\n", " Depth (tile, j, i) float32 421kB 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0\n", " ... ...\n", " hFacC (k, tile, j, i) float32 21MB 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0\n", " hFacW (k, tile, j, i_g) float32 21MB 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0\n", " hFacS (k, tile, j_g, i) float32 21MB 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0\n", " maskC (k, tile, j, i) bool 5MB False False False ... False False False\n", " maskW (k, tile, j, i_g) bool 5MB False False False ... False False False\n", " maskS (k, tile, j_g, i) bool 5MB False False False ... False False False\n", "Attributes: (12/58)\n", " acknowledgement: This research was carried out by the Jet...\n", " author: Ian Fenty and Ou Wang\n", " cdm_data_type: Grid\n", " comment: Fields provided on the curvilinear lat-l...\n", " Conventions: CF-1.8, ACDD-1.3\n", " coordinates_comment: Note: the global 'coordinates' attribute...\n", " ... ...\n", " references: ECCO Consortium, Fukumori, I., Wang, O.,...\n", " source: The ECCO V4r4 state estimate was produce...\n", " standard_name_vocabulary: NetCDF Climate and Forecast (CF) Metadat...\n", " summary: This dataset provides geometric paramete...\n", " title: ECCO Geometry Parameters for the Lat-Lon...\n", " uuid: 87ff7d24-86e5-11eb-9c5f-f8f21e2ee3e0