{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Copyright CNES\n", "\n", "## Read and plot a SWOT-HR Raster products \n", "In this notebook, we show how to read the SWOT-HR raster 100m and 250m netcdf products with xarray and how to represent a variable on a map with cartopy." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Libraries\n", "Please note that apart from the libraries listed in the cell below, you need to install the h5netcdf library (conda install -c conda-forge h5netcdf). This will be used by th xarray.open_dataset function to read the netcdf files." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import xarray as xr\n", "import rioxarray\n", "from pyproj import CRS\n", "import os\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1. Read a SWOT-HR Raster netcdf product with xarray\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset>\n", "Dimensions: (y: 75, x: 59)\n", "Coordinates:\n", " * x (x) float64 2.712e+05 2.713e+05 ... 2.77e+05\n", " * y (y) float64 5.558e+05 5.559e+05 ... 5.632e+05\n", "Data variables: (12/39)\n", " cross_track (y, x) float32 ...\n", " crs object ...\n", " dark_frac (y, x) float32 ...\n", " geoid (y, x) float32 ...\n", " height_cor_xover (y, x) float32 ...\n", " ice_clim_flag (y, x) float32 ...\n", " ... ...\n", " water_frac (y, x) float32 ...\n", " water_frac_uncert (y, x) float32 ...\n", " wse (y, x) float32 ...\n", " wse_qual (y, x) float32 ...\n", " wse_qual_bitwise (y, x) float64 ...\n", " wse_uncert (y, x) float32 ...\n", "Attributes: (12/50)\n", " Conventions: CF-1.7\n", " title: Level 2 KaRIn High Rate Raster Data Product\n", " source: Ka-band radar interferometer\n", " history: Wed Jun 5 21:08:21 2024: ncks -d x,271195...\n", " platform: SWOT\n", " references: V1.2.1\n", " ... ...\n", " x_max: 315500.0\n", " y_min: 497300.0\n", " y_max: 643000.0\n", " institution: CNES\n", " product_version: 01\n", " NCO: netCDF Operators version 5.0.6 (Homepage =...