{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Using SWOT satellite altimetry" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This example will guide you through each step required to estimate energy cascade rates from a single SWOT KaRIn swath.\n", "\n", "**General procedure**\n", "\n", "1. Load and visualize the SWOT sea surface height anomaly (SSHA) data\n", "2. Use SSHA to estimate geostrophic velocities\n", "3. Subset the data to a small region\n", "4. Calculate various structure functions from the geostrophic velocities in the subset region\n", "5. Estimate cascade rates from the structure functions\n", "6. Plot cascade rates\n", "7. Plot 2nd order structure functions" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import matplotlib_inline.backend_inline\n", "import seaborn as sns\n", "\n", "sns.set_style(style=\"white\")\n", "sns.set_context(\"talk\")\n", "\n", "matplotlib_inline.backend_inline.set_matplotlib_formats(\"png\", dpi=200)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load the SWOT NetCDF file and visualize the data\n", "\n", "We will use `xarray` to load the `.nc` file. We are using the Expert version of SWOT Level-3 LR SSH v1.0, available through AVISO. This version includes estimates of geostrophic velocity along with improved data post-processing. It is possible to estimate geostrophic velocities from SSH data only, which is available in the Basic version of Level-3 and Level-2. \n", "\n", "**_Note:_** The SWOT data is not provided in the FluidSF repository, so you must instead access the data through [PO.DAAC](https://podaac.jpl.nasa.gov/SWOT?tab=mission-objectives§ions=about%2Bdata), [AVISO](https://www.aviso.altimetry.fr/en/data/products/sea-surface-height-products/global.html), or other methods. This example uses L3 data, accessible through AVISO." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import xarray as xr\n", "\n", "# Provide the path to the SWOT data you have downloaded\n", "ds = xr.open_dataset('example_data/SWOT_L3_LR_SSH_Expert_SAMPLE.nc') " ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset>\n", "Dimensions: (num_lines: 9860, num_pixels: 69, num_nadir: 1631)\n", "Coordinates:\n", " latitude (num_lines, num_pixels) float64 ...\n", " longitude (num_lines, num_pixels) float64 ...\n", "Dimensions without coordinates: num_lines, num_pixels, num_nadir\n", "Data variables: (12/18)\n", " time (num_lines) datetime64[ns] ...\n", " mdt (num_lines, num_pixels) float64 ...\n", " ssha (num_lines, num_pixels) float64 ...\n", " ssha_noiseless (num_lines, num_pixels) float64 ...\n", " ssha_unedited (num_lines, num_pixels) float64 ...\n", " quality_flag (num_lines, num_pixels) uint8 ...\n", " ... ...\n", " ugosa (num_lines, num_pixels) float64 ...\n", " vgosa (num_lines, num_pixels) float64 ...\n", " sigma0 (num_lines, num_pixels) float64 ...\n", " cross_track_distance (num_pixels) float64 ...\n", " i_num_line (num_nadir) int16 ...\n", " i_num_pixel (num_nadir) int8 ...\n", "Attributes: (12/42)\n", " Conventions: CF-1.7\n", " Metadata_Conventions: Unidata Dataset Discovery v1.0\n", " cdm_data_type: Swath\n", " comment: Sea Surface Height measured by Altimetry\n", " geospatial_lat_units: degrees_north\n", " geospatial_lon_units: degrees_east\n", " ... ...\n", " geospatial_lat_min: -78.272196\n", " geospatial_lat_max: 78.272247\n", " geospatial_lon_min: 0.000835\n", " geospatial_lon_max: 359.99901\n", " data_used: SWOT KaRIn L2_LR_SSH PGC0 (NASA/CNES). D...\n", " doi: https://doi.org/10.24400/527896/A01-2023...