{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Sea Ice Coordinates & Plotting Examples" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This recipe shows how to load and plot sea ice concentration from sea ice models (CICE5, and SIS2) output, while also indicating how to get around some of the pitfalls and foibles in CICE temporal and spatial gridding.\n", "\n", "Requirements: The `conda/analysis3` module from `/g/data/xp65/public/modules`. \n", "\n", "- This recipe directly searches the intake catalog for coordinates, and so will require `conda/analysis3-25.02` or later.\n", "- This recipe was run on a large ARE instance, and may not work if run with fewer resources.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Firstly, load modules:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "tags": [] }, "outputs": [], "source": [ "import intake\n", "from dask.distributed import Client\n", "from datetime import timedelta\n", "\n", "import matplotlib.pyplot as plt\n", "import cartopy.crs as ccrs\n", "import cartopy.feature as cfeature\n", "import numpy as np\n", "import matplotlib.path as mpath\n", "import cmocean.cm as cmo" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "tags": [] }, "outputs": [ { "data": { "text/plain": [ "'/proxy/8787/status'" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "client = Client(threads_per_worker=1)\n", "client.dashboard_link" ] }, { "cell_type": "markdown", "metadata": { "tags": [] }, "source": [ "Open the catalog" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "tags": [] }, "outputs": [], "source": [ "catalog = intake.cat.access_nri" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next we will select an experiment which uses the `cice5` sea ice model. Experiment `01deg_jra55v13_ryf9091` is a 0.1-degree repeat-year forcing run using MOM5. In CICE, areal sea ice concentration is called `aice_m`, where the `m` refers to the variable being averaged on a monthly basis.\n", "\n", "If you want a different experiment change the necessary values." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "model = \"cice5\"\n", "experiment = \"01deg_jra55v13_ryf9091\" \n", "variable = \"aice_m\"\n", "area_variable = \"area_t\"\n", "geo_variables = [\"geolon_t\", \"geolat_t\"]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Note**: We could adapt these variables to instead select another experiment or even one using SIS2 and MOM6 by specifying:\n", "\n", "```python\n", "experiment = \"OM4_025.JRA_RYF\"\n", "variable = \"siconc\"\n", "area_variable = \"areacello\"\n", "geo_variables = [\"geolon\", \"geolat\"]\n", "```\n", "Since the SIS2 model is smaller than the CICE5 model, it may be easier to use if you have limited computing power." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "
01deg_jra55v13_ryf9091 catalog with 22 dataset(s) from 11947 asset(s):
| \n", " | unique | \n", "
|---|---|
| filename | \n", "3469 | \n", "
| path | \n", "11947 | \n", "
| file_id | \n", "22 | \n", "
| frequency | \n", "5 | \n", "
| start_date | \n", "3361 | \n", "
| end_date | \n", "3360 | \n", "
| variable | \n", "205 | \n", "
| variable_long_name | \n", "197 | \n", "
| variable_standard_name | \n", "36 | \n", "
| variable_cell_methods | \n", "3 | \n", "
| variable_units | \n", "52 | \n", "
| realm | \n", "2 | \n", "
| derived_variable | \n", "0 | \n", "
01deg_jra55v13_ryf9091 catalog with 1 dataset(s) from 3360 asset(s):
| \n", " | unique | \n", "
|---|---|
| filename | \n", "3360 | \n", "
| path | \n", "3360 | \n", "
| file_id | \n", "1 | \n", "
| frequency | \n", "1 | \n", "
| start_date | \n", "3360 | \n", "
| end_date | \n", "3360 | \n", "
| variable | \n", "55 | \n", "
| variable_long_name | \n", "55 | \n", "
| variable_standard_name | \n", "1 | \n", "
| variable_cell_methods | \n", "2 | \n", "
| variable_units | \n", "19 | \n", "
| realm | \n", "1 | \n", "
| derived_variable | \n", "0 | \n", "
<xarray.DataArray 'aice_m' (time: 3360, nj: 2700, ni: 3600)> Size: 131GB\n",
"dask.array<concatenate, shape=(3360, 2700, 3600), dtype=float32, chunksize=(1, 2700, 3600), chunktype=numpy.ndarray>\n",
"Coordinates:\n",
" * time (time) object 27kB 1900-02-01 00:00:00 ... 2180-01-01 00:00:00\n",
"Dimensions without coordinates: nj, ni\n",
"Attributes:\n",
" units: 1\n",
" long_name: ice area (aggregate)\n",
" coordinates: TLON TLAT time\n",
" cell_measures: area: tarea\n",
" cell_methods: time: mean\n",
" time_rep: averaged<xarray.DataArray 'aice_m' (time: 120, nj: 2700, ni: 3600)> Size: 5GB\n",
"dask.array<getitem, shape=(120, 2700, 3600), dtype=float32, chunksize=(12, 2700, 3600), chunktype=numpy.ndarray>\n",
"Coordinates:\n",
" * time (time) object 960B 1981-01-31 12:00:00 ... 1990-12-31 12:00:00\n",
"Dimensions without coordinates: nj, ni\n",
"Attributes:\n",
" units: 1\n",
" long_name: ice area (aggregate)\n",
" coordinates: TLON TLAT time\n",
" cell_measures: area: tarea\n",
" cell_methods: time: mean\n",
" time_rep: averaged<xarray.DataArray 'area_t' (yt_ocean: 2700, xt_ocean: 3600)> Size: 39MB\n",
"array([[nan, nan, nan, ..., nan, nan, nan],\n",
" [nan, nan, nan, ..., nan, nan, nan],\n",
" [nan, nan, nan, ..., nan, nan, nan],\n",
" ...,\n",
" [nan, nan, nan, ..., nan, nan, nan],\n",
" [nan, nan, nan, ..., nan, nan, nan],\n",
" [nan, nan, nan, ..., nan, nan, nan]], dtype=float32)\n",
"Coordinates:\n",
" * xt_ocean (xt_ocean) float64 29kB -279.9 -279.8 -279.7 ... 79.75 79.85 79.95\n",
" * yt_ocean (yt_ocean) float64 22kB -81.11 -81.07 -81.02 ... 89.89 89.94 89.98\n",
" geolon_t (yt_ocean, xt_ocean) float32 39MB nan nan nan nan ... nan nan nan\n",
" geolat_t (yt_ocean, xt_ocean) float32 39MB nan nan nan nan ... nan nan nan\n",
"Attributes:\n",
" long_name: tracer cell area\n",
" units: m^2\n",
" valid_range: [0.e+00 1.e+15]\n",
" cell_methods: time: point<xarray.DataArray 'aice_m' (time: 120, yt_ocean: 2700, xt_ocean: 3600)> Size: 5GB\n",
"dask.array<getitem, shape=(120, 2700, 3600), dtype=float32, chunksize=(12, 2700, 3600), chunktype=numpy.ndarray>\n",
"Coordinates:\n",
" * time (time) object 960B 1981-01-31 12:00:00 ... 1990-12-31 12:00:00\n",
" * xt_ocean (xt_ocean) float64 29kB -279.9 -279.8 -279.7 ... 79.75 79.85 79.95\n",
" * yt_ocean (yt_ocean) float64 22kB -81.11 -81.07 -81.02 ... 89.89 89.94 89.98\n",
"Attributes:\n",
" units: 1\n",
" long_name: ice area (aggregate)\n",
" coordinates: TLON TLAT time\n",
" cell_measures: area: tarea\n",
" cell_methods: time: mean\n",
" time_rep: averaged<xarray.DataArray (time: 120, yt_ocean: 2700, xt_ocean: 3600)> Size: 5GB\n",
"dask.array<mul, shape=(120, 2700, 3600), dtype=float32, chunksize=(12, 2700, 3600), chunktype=numpy.ndarray>\n",
"Coordinates:\n",
" * time (time) object 960B 1981-01-31 12:00:00 ... 1990-12-31 12:00:00\n",
" * xt_ocean (xt_ocean) float64 29kB -279.9 -279.8 -279.7 ... 79.75 79.85 79.95\n",
" * yt_ocean (yt_ocean) float64 22kB -81.11 -81.07 -81.02 ... 89.89 89.94 89.98<xarray.DataArray (time: 120)> Size: 480B\n",
"dask.array<sum-aggregate, shape=(120,), dtype=float32, chunksize=(12,), chunktype=numpy.ndarray>\n",
"Coordinates:\n",
" * time (time) object 960B 1981-01-31 12:00:00 ... 1990-12-31 12:00:00<xarray.DataArray 'area_t' (yt_ocean: 2700, xt_ocean: 3600)> Size: 39MB\n",
"array([[nan, nan, nan, ..., nan, nan, nan],\n",
" [nan, nan, nan, ..., nan, nan, nan],\n",
" [nan, nan, nan, ..., nan, nan, nan],\n",
" ...,\n",
" [nan, nan, nan, ..., nan, nan, nan],\n",
" [nan, nan, nan, ..., nan, nan, nan],\n",
" [nan, nan, nan, ..., nan, nan, nan]], dtype=float32)\n",
"Coordinates:\n",
" * xt_ocean (xt_ocean) float64 29kB -279.9 -279.8 -279.7 ... 79.75 79.85 79.95\n",
" * yt_ocean (yt_ocean) float64 22kB -81.11 -81.07 -81.02 ... 89.89 89.94 89.98\n",
" geolon_t (yt_ocean, xt_ocean) float32 39MB nan nan nan nan ... nan nan nan\n",
" geolat_t (yt_ocean, xt_ocean) float32 39MB nan nan nan nan ... nan nan nan\n",
"Attributes:\n",
" long_name: tracer cell area\n",
" units: m^2\n",
" valid_range: [0.e+00 1.e+15]\n",
" cell_methods: time: point