{ "cells": [ { "cell_type": "markdown", "id": "b5b7f9e1-63af-46e3-8452-c8ef703c23d8", "metadata": {}, "source": [ "[Jupyter Book](https://geo-smart.github.io/oceanography/intro.html) and [GitHub repo](https://github.com/geo-smart/oceanography).\n", "\n", "\n", "# ROMS Regional Ocean Modeling System\n", "\n", "\n", "This notebook works with what Parker calls a 'mooring extraction'. The ROMS model operates on a vast area divided into a 3D grid of cells.\n", "Given a lat/lon location of a 'mooring' we get the extraction from the full-volume model result. \n", "\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "57f34cac-c78c-4a4f-81bc-cb9cc8bb7a47", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Jupyter Notebook running Python 3\n" ] } ], "source": [ "import os, sys, time, glob, warnings\n", "from os.path import join as joindir\n", "from IPython.display import clear_output\n", "from matplotlib import pyplot as plt\n", "from matplotlib import colors as mplcolors\n", "import numpy as np, pandas as pd, xarray as xr\n", "from numpy import datetime64 as dt64, timedelta64 as td64\n", "\n", "warnings.filterwarnings('ignore')\n", "\n", "def doy(theDatetime): return 1 + int((theDatetime - dt64(str(theDatetime)[0:4] + '-01-01')) / td64(1, 'D'))\n", "def dt64_from_doy(year, doy): return dt64(str(year) + '-01-01') + td64(doy-1, 'D')\n", "def day_of_month_to_string(d): return str(d) if d > 9 else '0' + str(d)\n", "\n", "print('\\nJupyter Notebook running Python {}'.format(sys.version_info[0]))" ] }, { "cell_type": "code", "execution_count": 2, "id": "b3aca1cb-35a8-4388-81bc-3237c805b956", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset>\n", "Dimensions: (ocean_time: 745, s_w: 31, s_rho: 30)\n", "Coordinates:\n", " lat_rho float64 ...\n", " lat_u float64 ...\n", " lat_v float64 ...\n", " lon_rho float64 ...\n", " lon_u float64 ...\n", " lon_v float64 ...\n", " * ocean_time (ocean_time) datetime64[ns] 2021-07-01 ... 2021-08-01\n", " * s_rho (s_rho) float64 -0.9833 -0.95 -0.9167 ... -0.05 -0.01667\n", " * s_w (s_w) float64 -1.0 -0.9667 -0.9333 ... -0.06667 -0.03333 0.0\n", "Data variables: (12/38)\n", " AKs (ocean_time, s_w) float32 ...\n", " AKv (ocean_time, s_w) float32 ...\n", " Cs_r (s_rho) float64 ...\n", " Cs_w (s_w) float64 ...\n", " Ldetritus (ocean_time, s_rho) float32 ...\n", " NO3 (ocean_time, s_rho) float32 ...\n", " ... ...\n", " vbar (ocean_time) float32 ...\n", " w (ocean_time, s_w) float32 ...\n", " zeta (ocean_time) float32 ...\n", " zooplankton (ocean_time, s_rho) float32 ...\n", " z_rho (ocean_time, s_rho) float64 ...\n", " z_w (ocean_time, s_w) float64 ...\n", "Attributes: (12/43)\n", " file: /gscratch/macc/parker/LiveOcean_roms/output/cas6_...\n", " format: netCDF-4\n", " Conventions: CF-1.4, SGRID-0.3\n", " type: ROMS/TOMS history file\n", " title: First LiveOcean input file\n", " var_info: /gscratch/macc/parker/LiveOcean_roms/LO_ROMS/ROMS...\n", " ... ...\n", " ana_file: ROMS/Functionals/ana_btflux.h, ROMS/Functionals/a...\n", " bio_file: ROMS/Nonlinear/Biology/npzd2o_banas.h\n", " CPP_options: LO8B, ADD_FSOBC, ADD_M2OBC, ANA_BPFLUX, ANA_BSFLU...\n", " NCO: netCDF Operators version 4.9.8 (Homepage = http:/...\n", " nco_input_file_number: 8761\n", " nco_input_file_list: moor_temp_000000.nc moor_temp_000001.nc moor_temp...