From the PO.DAAC Cookbook, to access the GitHub version of the notebook, follow this link.

SWOT Hydrology Science Application Tutorial on the Cloud

Retrieving SWOT attributes (WSE, width, slope) and plotting a longitudinal profile along a river or over a basin

Requirement

This tutorial can only be run in an AWS cloud instance running in us-west-2: NASA Earthdata Cloud data in S3 can be directly accessed via earthaccess python library; this access is limited to requests made within the US West (Oregon) (code: us-west-2) AWS region.

Earthdata Login

An Earthdata Login account is required to access data, as well as discover restricted data, from the NASA Earthdata system. Thus, to access NASA data, you need Earthdata Login. Please visit https://urs.earthdata.nasa.gov to register and manage your Earthdata Login account. This account is free to create and only takes a moment to set up.

This code runs using SWOT Level 2 Data Products (Version C, aka 2.0).

Notebook Authors: Arnaud Cerbelaud, Jeffrey Wade, NASA Jet Propulsion Laboratory - California Institute of Technology (Mar 2024)

Learning Objectives

  1. Retrieve SWOT hydrological attributes on river reaches within the AWS cloud (Cal/Val data). Query reaches by:
    • River name
    • Spatial bounding box
    • Downstream tracing from reach id (e.g. headwater to outlet) for river longitudinal profiles
    • Upstream tracing from reach id (e.g. outlet to full river network) for watershed analysis
  2. Plot a time series of WSE, width, slope data on the filtered data
  3. Visualize an interactive map of WSE, width, slope data on the filtered data

Import Packages

import fiona
import xarray as xr
import pandas as pd
import geopandas as gpd
import numpy as np
import matplotlib.pyplot as plt
import hvplot.xarray
import earthaccess

pd.set_option('display.max_columns', None) #make sure all columns displayed for shapefiles

Authenticate

Authenticate your Earthdata Login (EDL) information using the earthaccess python package as follows:

earthaccess.login() # Login with your EDL credentials if asked
<earthaccess.auth.Auth at 0x7f2fd5bbf220>

1. Retrieve SWOT hydrological attributes on river reaches within the AWS cloud (Cal/Val data)

What data should we download?

  • Optional step: Get the .kmz file of SWOT passes/swaths for the and import it into Google Earth for visualization
  • Determine which pass number corresponds to the river/basin you want to look at! #### Search for multiple days of data
# Enter pass number
pass_number    = ["341", "576", "298"]   #e.g. 341, 576, 298 for Connecticut in NA, "236", "514", "542", "085", "363", "057", "335", "029" for Rhine in EU
# Enter continent code
continent_code = "NA"     # e.g. "AF", "NA", "EU", "SI", "AS", "AU", "SA", "AR", "GR"

# Retrieves granulev and links list from the passes we want, in this case by passing to `earthdata.search_data` function the data collection shortname and temporal bounds
links_list = []
for p in range(len(pass_number)):
    river_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_RIVERSP_2.0', 
                                        temporal = ('2024-01-25 00:00:00', '2024-03-29 23:59:59'),
                                        granule_name = "*Reach*_" + pass_number[p] + "_" + continent_code + "*")
    for r in range(len(river_results)):
        river_link = earthaccess.results.DataGranule.data_links(river_results[r], access='direct')[0]
        links_list.append(river_link)
Granules found: 2
Granules found: 3
Granules found: 3
# Create fiona session to read data from zip files without download and extraction
fs_s3 = earthaccess.get_s3fs_session(results=river_results)
fiona_session=fiona.session.AWSSession(
        aws_access_key_id=fs_s3.storage_options["key"],
        aws_secret_access_key=fs_s3.storage_options["secret"],
        aws_session_token=fs_s3.storage_options["token"]
    )
links_list
['s3://podaac-swot-ops-cumulus-protected/SWOT_L2_HR_RiverSP_2.0/SWOT_L2_HR_RiverSP_Reach_010_341_NA_20240206T041926_20240206T041927_PIC0_01.zip',
 's3://podaac-swot-ops-cumulus-protected/SWOT_L2_HR_RiverSP_2.0/SWOT_L2_HR_RiverSP_Reach_011_341_NA_20240227T010431_20240227T010433_PIC0_01.zip',
 's3://podaac-swot-ops-cumulus-protected/SWOT_L2_HR_RiverSP_2.0/SWOT_L2_HR_RiverSP_Reach_010_576_NA_20240214T133056_20240214T133057_PIC0_01.zip',
 's3://podaac-swot-ops-cumulus-protected/SWOT_L2_HR_RiverSP_2.0/SWOT_L2_HR_RiverSP_Reach_011_576_NA_20240306T101600_20240306T101602_PIC0_01.zip',
 's3://podaac-swot-ops-cumulus-protected/SWOT_L2_HR_RiverSP_2.0/SWOT_L2_HR_RiverSP_Reach_012_576_NA_20240327T070054_20240327T070055_PIC0_01.zip',
 's3://podaac-swot-ops-cumulus-protected/SWOT_L2_HR_RiverSP_2.0/SWOT_L2_HR_RiverSP_Reach_010_298_NA_20240204T150846_20240204T150850_PIC0_01.zip',
 's3://podaac-swot-ops-cumulus-protected/SWOT_L2_HR_RiverSP_2.0/SWOT_L2_HR_RiverSP_Reach_011_298_NA_20240225T115352_20240225T115356_PIC0_01.zip',
 's3://podaac-swot-ops-cumulus-protected/SWOT_L2_HR_RiverSP_2.0/SWOT_L2_HR_RiverSP_Reach_012_298_NA_20240317T083854_20240317T083858_PIC0_01.zip']

Unzip selected files in Fiona session

# Initialize list of shapefiles containing all dates
SWOT_HR_shps = []

# Loop through queried granules to stack all acquisition dates
for j in range(len(links_list)):
    
    # We use the zip+ prefix so fiona knows that we are operating on a zip file
    river_shp_url = f"zip+{links_list[j]}"
    
    # Read shapefile
    with fiona.Env(session=fiona_session):
        SWOT_HR_shps.append(gpd.read_file(river_shp_url)) 

Aggregate unzipped files into dataframe

# Combine granules from all acquisition dates into one dataframe
SWOT_HR_df = gpd.GeoDataFrame(pd.concat(SWOT_HR_shps, ignore_index=True))

# Sort dataframe by reach_id and time
SWOT_HR_df = SWOT_HR_df.sort_values(['reach_id', 'time'])

SWOT_HR_df
reach_id time time_tai time_str p_lat p_lon river_name wse wse_u wse_r_u wse_c wse_c_u slope slope_u slope_r_u slope2 slope2_u slope2_r_u width width_u width_c width_c_u area_total area_tot_u area_detct area_det_u area_wse d_x_area d_x_area_u layovr_val node_dist loc_offset xtrk_dist dschg_c dschg_c_u dschg_csf dschg_c_q dschg_gc dschg_gc_u dschg_gcsf dschg_gc_q dschg_m dschg_m_u dschg_msf dschg_m_q dschg_gm dschg_gm_u dschg_gmsf dschg_gm_q dschg_b dschg_b_u dschg_bsf dschg_b_q dschg_gb dschg_gb_u dschg_gbsf dschg_gb_q dschg_h dschg_h_u dschg_hsf dschg_h_q dschg_gh dschg_gh_u dschg_ghsf dschg_gh_q dschg_o dschg_o_u dschg_osf dschg_o_q dschg_go dschg_go_u dschg_gosf dschg_go_q dschg_s dschg_s_u dschg_ssf dschg_s_q dschg_gs dschg_gs_u dschg_gssf dschg_gs_q dschg_i dschg_i_u dschg_isf dschg_i_q dschg_gi dschg_gi_u dschg_gisf dschg_gi_q dschg_q_b dschg_gq_b reach_q reach_q_b dark_frac ice_clim_f ice_dyn_f partial_f n_good_nod obs_frac_n xovr_cal_q geoid_hght geoid_slop solid_tide load_tidef load_tideg pole_tide dry_trop_c wet_trop_c iono_c xovr_cal_c n_reach_up n_reach_dn rch_id_up rch_id_dn p_wse p_wse_var p_width p_wid_var p_n_nodes p_dist_out p_length p_maf p_dam_id p_n_ch_max p_n_ch_mod p_low_slp geometry
3738 72120300121 -1.000000e+12 -1.000000e+12 no_data 50.355053 -77.287576 no_data -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 12582912 12582912 3 469762048 -1.000000e+12 2 -999 1 -999 -1.000000e+12 2 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 1 1 72120300206, no_data, no_data, no_data 72120300113, no_data, no_data, no_data 248.199997 0.031587 45.0 217.523 86 228174.350 17135.322465 -1.000000e+12 0 1 1 0 LINESTRING (-77.37319 50.31698, -77.37277 50.3...
4454 72120300121 -1.000000e+12 -1.000000e+12 no_data 50.355053 -77.287576 no_data -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 12582912 12582912 3 469762048 -1.000000e+12 2 -999 1 -999 -1.000000e+12 2 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 1 1 72120300206, no_data, no_data, no_data 72120300113, no_data, no_data, no_data 248.199997 0.031587 45.0 217.523 86 228174.350 17135.322465 -1.000000e+12 0 1 1 0 LINESTRING (-77.37319 50.31698, -77.37277 50.3...
5170 72120300121 -1.000000e+12 -1.000000e+12 no_data 50.355053 -77.287576 no_data -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 12582912 12582912 3 469762048 -1.000000e+12 2 -999 1 -999 -1.000000e+12 2 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 1 1 72120300206, no_data, no_data, no_data 72120300113, no_data, no_data, no_data 248.199997 0.031587 45.0 217.523 86 228174.350 17135.322465 -1.000000e+12 0 1 1 0 LINESTRING (-77.37319 50.31698, -77.37277 50.3...
3739 72120400051 -1.000000e+12 -1.000000e+12 no_data 49.864785 -76.975406 no_data -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 12582912 12582912 3 469762048 -1.000000e+12 2 -999 1 -999 -1.000000e+12 2 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 1 1 72120400063, no_data, no_data, no_data 72120400043, no_data, no_data, no_data 256.399994 2.569541 291.0 19982.483 91 308791.019 18231.842622 -1.000000e+12 0 3 1 0 LINESTRING (-77.06133 49.85771, -77.06092 49.8...
4455 72120400051 -1.000000e+12 -1.000000e+12 no_data 49.864785 -76.975406 no_data -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 12582912 12582912 3 469762048 -1.000000e+12 2 -999 1 -999 -1.000000e+12 2 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 1 1 72120400063, no_data, no_data, no_data 72120400043, no_data, no_data, no_data 256.399994 2.569541 291.0 19982.483 91 308791.019 18231.842622 -1.000000e+12 0 3 1 0 LINESTRING (-77.06133 49.85771, -77.06092 49.8...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
3128 76500000131 7.630360e+08 7.630361e+08 2024-03-06T10:26:58Z 18.255350 -66.012657 no_data 5.148830e+01 7.147400e-01 7.090500e-01 -1.000000e+12 -1.000000e+12 -1.896964e-03 1.029344e-05 9.846570e-06 -2.579608e-03 -1.000000e+12 1.179402e-01 8.228150e+02 3.330908e+00 -1.000000e+12 -1.000000e+12 9.494502e+06 3.843551e+04 9.472037e+06 3.843550e+04 9.494502e+06 -1.000000e+12 -1.000000e+12 7.219900e+00 2.269424e+02 3.555010e+01 -9.718222e+03 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 25428408 25428408 2 542734 2.366000e-03 0 -999 0 33 5.409836e-01 0 -4.203993e+01 -5.959560e-05 -1.099997e-01 -7.083979e-03 -9.455572e-03 2.673383e-03 -2.300245e+00 -2.157397e-01 -2.978376e-03 3.877690e-01 1 1 76500000141, no_data, no_data, no_data 76500000123, no_data, no_data, no_data 40.600002 43.251021 63.0 1149.474 61 43590.077 12103.909044 -1.000000e+12 0 2 1 0 LINESTRING (-65.99988 18.21743, -66.00022 18.2...
3736 76500000131 7.648387e+08 7.648388e+08 2024-03-27T07:11:56Z 18.255350 -66.012657 no_data 6.214650e+01 2.573330e+00 2.571760e+00 -1.000000e+12 -1.000000e+12 -3.331055e-03 3.849838e-05 3.838132e-05 -3.053041e-03 -1.000000e+12 2.653730e+00 1.336966e+03 4.963007e+00 -1.000000e+12 -1.000000e+12 1.465627e+07 5.440614e+04 1.461890e+07 5.440610e+04 1.465627e+07 -1.000000e+12 -1.000000e+12 6.300200e+00 2.618109e+02 1.134880e+02 -9.406573e+03 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 25428408 25428408 2 575498 2.549000e-03 0 -999 1 25 4.098361e-01 2 -4.208252e+01 -6.235580e-05 7.611858e-02 1.698115e-03 3.022270e-03 1.955032e-03 -2.290476e+00 -1.451549e-01 -6.110505e-03 0.000000e+00 1 1 76500000141, no_data, no_data, no_data 76500000123, no_data, no_data, no_data 40.600002 43.251021 63.0 1149.474 61 43590.077 12103.909044 -1.000000e+12 0 2 1 0 LINESTRING (-65.99988 18.21743, -66.00022 18.2...
2523 76500000141 7.612333e+08 7.612334e+08 2024-02-14T13:41:54Z 18.214094 -65.999696 no_data 7.122600e+01 9.093000e-02 1.299000e-02 -1.000000e+12 -1.000000e+12 -1.424304e-02 3.561229e-05 3.548571e-05 -4.944832e-02 -1.000000e+12 2.070532e-04 2.976488e+02 7.012993e+00 -1.000000e+12 -1.000000e+12 2.374517e+05 5.594670e+03 2.374517e+05 5.594700e+03 2.374517e+05 -1.000000e+12 -1.000000e+12 1.040700e+00 3.071884e+02 3.960115e+01 -9.825143e+03 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 25428408 25428408 2 542730 0.000000e+00 0 -999 0 2 5.000000e-01 0 -4.162250e+01 -1.538206e-04 -1.459826e-01 -1.125507e-02 -9.715600e-03 3.041269e-03 -2.308736e+00 -1.868137e-01 -9.129797e-03 6.605130e-02 2 1 76500000161, 76500000151, no_data, no_data 76500000131, no_data, no_data, no_data 63.100002 20.898301 30.0 415.706 4 44387.835 797.757834 -1.000000e+12 0 1 1 0 LINESTRING (-66.00018 18.21038, -66.00018 18.2...
3129 76500000141 7.630360e+08 7.630361e+08 2024-03-06T10:26:58Z 18.214094 -65.999696 no_data -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 -1.000000e+12 3.717835e+02 7.669814e+00 -1.000000e+12 -1.000000e+12 2.965932e+05 6.118654e+03 2.965932e+05 6.118700e+03 2.965932e+05 -1.000000e+12 -1.000000e+12 0.000000e+00 2.817323e+02 3.577332e+01 -1.006446e+04 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 29360570 29360570 3 503351296 0.000000e+00 0 -999 1 0 0.000000e+00 2 -4.161941e+01 -1.000000e+12 -1.098480e-01 -6.989030e-03 -9.287705e-03 2.667307e-03 -2.297567e+00 -2.175007e-01 -2.980941e-03 4.020248e-01 2 1 76500000161, 76500000151, no_data, no_data 76500000131, no_data, no_data, no_data 63.100002 20.898301 30.0 415.706 4 44387.835 797.757834 -1.000000e+12 0 1 1 0 LINESTRING (-66.00018 18.21038, -66.00018 18.2...
3737 76500000141 7.648387e+08 7.648388e+08 2024-03-27T07:11:56Z 18.214094 -65.999696 no_data 8.508610e+01 9.025000e-02 6.690000e-03 -1.000000e+12 -1.000000e+12 -9.286700e-03 4.201405e-05 4.190681e-05 -1.123384e-02 -1.000000e+12 1.623781e-04 8.786977e+02 1.250254e+01 -1.000000e+12 -1.000000e+12 7.009880e+05 9.974001e+03 7.009880e+05 9.974000e+03 7.009880e+05 -1.000000e+12 -1.000000e+12 1.628500e+00 1.992412e+02 1.928564e+01 -9.878682e+03 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 -1.000000e+12 -1.000000e+12 -1.000000e+12 -999 25428408 25428408 2 540682 0.000000e+00 0 -999 0 3 7.500000e-01 2 -4.163959e+01 -6.160100e-05 7.617028e-02 1.573288e-03 2.859416e-03 1.950453e-03 -2.290005e+00 -1.457697e-01 -6.110666e-03 0.000000e+00 2 1 76500000161, 76500000151, no_data, no_data 76500000131, no_data, no_data, no_data 63.100002 20.898301 30.0 415.706 4 44387.835 797.757834 -1.000000e+12 0 1 1 0 LINESTRING (-66.00018 18.21038, -66.00018 18.2...

5886 rows × 127 columns

Exploring the dataset

What acquisition dates and rivers do our downloaded files cover?

print('Available dates are:')
print(np.unique([i[:10] for i in SWOT_HR_df['time_str']]))
print('Available rivers are:')
print(np.unique([i for i in SWOT_HR_df['river_name']]))
Available dates are:
['2024-02-04' '2024-02-06' '2024-02-14' '2024-02-25' '2024-02-27'
 '2024-03-06' '2024-03-17' '2024-03-27' 'no_data']
Available rivers are:
['Androscoggin River' 'Batten Kill' 'Bras du Nord' 'Canal de fuite'
 "Chenal de l'Est" 'Concord River' 'Concord River; Sudbury River'
 'Connecticut River' 'Connecticut River; Westfield River'
 'Connecticut River; White River' 'Deerfield River' 'Farmington River'
 'Fleuve Saint-Laurent' 'Hoosic River' 'Housatonic River' 'Howells River'
 'Hudson River' 'Hudson River; Indian River' 'Indian River'
 'Komaktorvik River' 'La Grande River' 'Lac Saint-Louis' 'Lamoille River'
 'Magalloway River' 'Merrimack River' 'Missisquoi River' 'Mohawk River'
 'Ottawa River' 'Otter Creek' 'Passumsic River' 'Pemigewasset River'
 'Quinebaug River' 'Racquette River' 'Sacandaga River' 'Saguenay River'
 'Saint Lawrence River' 'Saint Regis River'
 'Saint Regis River; West Branch of the Saint Regis R' 'Shetucket River'
 'South Nation River' 'Sudbury River' 'Thames River'
 'Vieux-Comptoir River' 'Wappinger Creek' 'West River' 'White River'
 'Winooski River' 'Wood Creek' 'no_data']

Filter dataframe by river name of interest and plot selected reaches:

Note: Some rivers have multiple names, hence using the contains function

# Enter river name
river = "Connecticut River"  # e.g. "Rhine", "Connecticut River"

## Filter dataframe
SWOT_HR_df_river = SWOT_HR_df[(SWOT_HR_df.river_name.str.contains(river))]

# Plot geopandas dataframe with 'explore' by reach id
SWOT_HR_df_river[['reach_id','river_name','geometry']].explore('reach_id', style_kwds=dict(weight=6))
Make this Notebook Trusted to load map: File -> Trust Notebook