import os
import glob
import s3fs
import requests
import numpy as np
import pandas as pd
import xarray as xr
import hvplot.xarray
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy
import dask
from datetime import datetime
from os.path import isfile, basename, abspath
import earthaccess
from earthaccess import Auth, DataCollections, DataGranules, Store
From the PO.DAAC Cookbook, to access the GitHub version of the notebook, follow this link.
Amazon Estuary Exploration:
In AWS Cloud Version
This tutorial is one of two jupyter notebook versions of the same use case exploring multiple satellite data products over the Amazon Estuary. In this version, we use data products directly in the Amazon Web Services (AWS) Cloud.
Learning Objectives
- Compare cloud access methods (in tandem with notebook “Amazon Estuary Exploration: Cloud Direct Download Version”)
- Search for data products using earthaccess Python library
- Access datasets using direct s3 access in cloud, xarray and visualize using hvplot or plot tools
This tutorial explores the relationships between river height, land water equivalent thickness, sea surface salinity, and sea surface temperature in the Amazon River estuary and coastal region from multiple datasets listed below. The contents are useful for the ocean, coastal, and terrestrial hydrosphere communities, showcasing how to use cloud datasets and services. The notebook is designed to be executed in Amazon Web Services (AWS) (in us-west-2 region where the cloud data is located).
Cloud Datasets
The tutorial itself will use four different datasets:
1. TELLUS_GRAC-GRFO_MASCON_CRI_GRID_RL06.1_V3
The Gravity Recovery And Climate Experiment Follow-On (GRACE-FO) satellite land water equivalent (LWE) thicknesses will be used to observe seasonal changes in water storage around the river. When discharge is high, the change in water storage will increase, thus highlighting a wet season.
2. PRESWOT_HYDRO_GRRATS_L2_DAILY_VIRTUAL_STATION_HEIGHTS_V2
The NASA Pre-SWOT Making Earth System Data Records for Use in Research Environments (MEaSUREs) Program virtual gauges will be used as a proxy for Surface Water and Ocean Topography (SWOT) discharge until SWOT products are available. MEaSUREs contains river height products, not discharge, but river height is directly related to discharge and thus will act as a good substitute.
3. OISSS_L4_multimission_7day_v1
Optimally Interpolated Sea surface salinity (OISSS) is a level 4 product that combines the records from Aquarius (Sept 2011-June 2015), the Soil Moisture Active Passive (SMAP) satellite (April 2015-present), and ESAs Soil Moisture Ocean Salinity (SMOS) data to fill in data gaps.
4. MODIS_AQUA_L3_SST_MID-IR_MONTHLY_9KM_NIGHTTIME_V2019.0
Sea surface temperature is obtained from the Moderate Resolution Imaging Spectrometer (MODIS) instrument on board the Aqua satellite.
More details on available collections are on the PO.DAAC Cloud Earthdata Search Portal. For more information on the PO.DAAC transition to the cloud, please visit: https://podaac.jpl.nasa.gov/cloud-datasets/about
Needed Packages
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. We use earthaccess
to authenticate your login credentials below.
= earthaccess.login(strategy="interactive", persist=True) auth
Liquid Water Equivalent (LWE) Thickness (GRACE & GRACE-FO)
Search for GRACE LWE Thickness data
Suppose we are interested in LWE data from the dataset (DOI:10.5067/TEMSC-3JC63) described on this PO.DAAC dataset landing page: https://podaac.jpl.nasa.gov/dataset/TELLUS_GRAC-GRFO_MASCON_CRI_GRID_RL06.1_V3 From the landing page, we see the dataset Short Name under the Information tab. This is what we will be using to search for the collection with earthaccess.
You can also access the short name of the dataset through Earthdata search at: https://search.earthdata.nasa.gov.
#search for the granules using the short name
= earthaccess.search_data(short_name="TELLUS_GRAC-GRFO_MASCON_CRI_GRID_RL06.1_V3") grace_results
Granules found: 1
Open the .nc file in the s3 bucket and load it into an xarray
dataset
= xr.open_mfdataset(earthaccess.open([grace_results[0]]), engine='h5netcdf')
ds_GRACE ds_GRACE
Opening 1 granules, approx size: 0.0 GB
<xarray.Dataset> Dimensions: (lon: 720, lat: 360, time: 219, bounds: 2) Coordinates: * lon (lon) float64 0.25 0.75 1.25 1.75 ... 358.2 358.8 359.2 359.8 * lat (lat) float64 -89.75 -89.25 -88.75 ... 88.75 89.25 89.75 * time (time) datetime64[ns] 2002-04-17T12:00:00 ... 2023-03-16T1... Dimensions without coordinates: bounds Data variables: lwe_thickness (time, lat, lon) float64 dask.array<chunksize=(219, 360, 720), meta=np.ndarray> uncertainty (time, lat, lon) float64 dask.array<chunksize=(219, 360, 720), meta=np.ndarray> lat_bounds (lat, bounds) float64 dask.array<chunksize=(360, 2), meta=np.ndarray> lon_bounds (lon, bounds) float64 dask.array<chunksize=(720, 2), meta=np.ndarray> time_bounds (time, bounds) datetime64[ns] dask.array<chunksize=(219, 2), meta=np.ndarray> land_mask (lat, lon) float64 dask.array<chunksize=(360, 720), meta=np.ndarray> scale_factor (lat, lon) float64 dask.array<chunksize=(360, 720), meta=np.ndarray> mascon_ID (lat, lon) float64 dask.array<chunksize=(360, 720), meta=np.ndarray> Attributes: (12/53) Conventions: CF-1.6, ACDD-1.3, ISO 8601 Metadata_Conventions: Unidata Dataset Discovery v1.0 standard_name_vocabulary: NetCDF Climate and Forecast (CF) Metadata ... title: JPL GRACE and GRACE-FO MASCON RL06.1Mv03 CRI summary: Monthly gravity solutions from GRACE and G... keywords: Solid Earth, Geodetics/Gravity, Gravity, l... ... ... C_30_substitution: TN-14; Loomis et al., 2019, Geophys. Res. ... user_note_1: The accelerometer on the GRACE-B spacecraf... user_note_2: The accelerometer on the GRACE-D spacecraf... journal_reference: Watkins, M. M., D. N. Wiese, D.-N. Yuan, C... CRI_filter_journal_reference: Wiese, D. N., F. W. Landerer, and M. M. Wa... date_created: 2023-05-22T06:05:03Z
- lonPandasIndex
PandasIndex(Index([ 0.25, 0.75, 1.25, 1.75, 2.25, 2.75, 3.25, 3.75, 4.25, 4.75, ... 355.25, 355.75, 356.25, 356.75, 357.25, 357.75, 358.25, 358.75, 359.25, 359.75], dtype='float64', name='lon', length=720))
- latPandasIndex
PandasIndex(Index([-89.75, -89.25, -88.75, -88.25, -87.75, -87.25, -86.75, -86.25, -85.75, -85.25, ... 85.25, 85.75, 86.25, 86.75, 87.25, 87.75, 88.25, 88.75, 89.25, 89.75], dtype='float64', name='lat', length=360))
- timePandasIndex
PandasIndex(DatetimeIndex(['2002-04-17 12:00:00', '2002-05-10 12:00:00', '2002-08-16 12:00:00', '2002-09-16 00:00:00', '2002-10-16 12:00:00', '2002-11-16 00:00:00', '2002-12-16 12:00:00', '2003-01-16 12:00:00', '2003-02-15 00:00:00', '2003-03-16 12:00:00', ... '2022-06-16 00:00:00', '2022-07-16 12:00:00', '2022-08-16 12:00:00', '2022-09-16 00:00:00', '2022-10-16 12:00:00', '2022-11-16 00:00:00', '2022-12-16 12:00:00', '2023-01-16 12:00:00', '2023-02-15 00:00:00', '2023-03-16 12:00:00'], dtype='datetime64[ns]', name='time', length=219, freq=None))
- Conventions :
- CF-1.6, ACDD-1.3, ISO 8601
- Metadata_Conventions :
- Unidata Dataset Discovery v1.0
- standard_name_vocabulary :
- NetCDF Climate and Forecast (CF) Metadata Convention-1.6
- title :
- JPL GRACE and GRACE-FO MASCON RL06.1Mv03 CRI
- summary :
- Monthly gravity solutions from GRACE and GRACE-FO as determined from the JPL RL06.1Mv03 mascon solution - with CRI filter applied
- keywords :
- Solid Earth, Geodetics/Gravity, Gravity, liquid_water_equivalent_thickness
- keywords_vocabulary :
- NASA Global Change Master Directory (GCMD) Science Keywords
- platform :
- GRACE and GRACE-FO
- institution :
- NASA/JPL
- creator_name :
- David Wiese
- creator_email :
- grace@podaac.jpl.nasa.gov
- creator_url :
- https://grace.jpl.nasa.gov
- creator_type :
- group
- creator_institution :
- NASA/JPL
- publisher_name :
- Physical Oceanography Distributed Active Archive Center
- publisher_email :
- podaac@jpl.nasa.gov
- publisher_url :
- https://podaac.jpl.nasa.gov
- publisher_type :
- group
- publisher_institution :
- NASA/JPL
- project :
- NASA Gravity Recovery and Climate Experiment (GRACE) and NASA Gravity Recovery and Climate Experiment Follow-On (GRACE-FO)
- program :
- NASA Earth Science System Pathfinder and NASA Earth Systematic Missions Program
- id :
- 10.5067/TEMSC-3JC62
- naming_authority :
- org.doi.dx
- source :
- GRACE and GRACE-FO JPL RL06.1Mv03-CRI
- processing_level :
- 2 and 3
- acknowledgement :
- GRACE is a joint mission of NASA (USA) and DLR (Germany). GRACE-FO is a joint mission of NASA (USA) and the German Research Center for Geosciences (GFZ). Use the digital object identifier provided in the id attribute when citing this data. See https://podaac.jpl.nasa.gov/CitingPODAAC
- license :
- https://science.nasa.gov/earth-science/earth-science-data/data-information-policy
- product_version :
- v3.0
- time_epoch :
- 2002-01-01T00:00:00Z
- time_coverage_start :
- 2002-04-16T00:00:00Z
- time_coverage_end :
- 2023-03-16T23:59:59Z
- geospatial_lat_min :
- -89.75
- geospatial_lat_max :
- 89.75
- geospatial_lat_units :
- degrees_north
- geospatial_lat_resolution :
- 0.5 degree grid; however the native resolution of the data is 3-degree equal-area mascons
- geospatial_lon_min :
- 0.25
- geospatial_lon_max :
- 359.75
- geospatial_lon_units :
- degrees_east
- geospatial_lon_resolution :
- 0.5 degree grid; however the native resolution of the data is 3-degree equal-area mascons
- time_mean_removed :
- 2004.000 to 2009.999
- months_missing :
- 2002-06;2002-07;2003-06;2011-01;2011-06;2012-05;2012-10;2013-03;2013-08;2013-09;2014-02;2014-07;2014-12;2015-06;2015-10;2015-11;2016-04;2016-09;2016-10;2017-02;2017-07;2017-08;2017-09;2017-10;2017-11;2017-12;2018-01;2018-02;2018-03;2018-04;2018-05;2018-08-2018-09
- postprocess_1 :
- OCEAN_ATMOSPHERE_DEALIAS_MODEL (GAD), MONTHLY_AVE, ADDED BACK TO OCEAN PIXELS ONLY
- postprocess_2 :
- Water density used to convert to equivalent water height: 1000 kg/m^3
- postprocess_3 :
- Coastline Resolution Improvement (CRI) filter has been applied to separate land/ocean mass within mascons that span coastlines
- GIA_removed :
- ICE6G-D; Peltier, W. R., D. F. Argus, and R. Drummond (2018) Comment on the paper by Purcell et al. 2016 entitled An assessment of ICE-6G_C (VM5a) glacial isostatic adjustment model, J. Geophys. Res. Solid Earth, 122.
- geocenter_correction :
- We use a version of TN-13 based on the JPL mascons
- C_20_substitution :
- TN-14; Loomis et al., 2019, Geophys. Res. Lett., doi:10.1029/2019GL082929
- C_30_substitution :
- TN-14; Loomis et al., 2019, Geophys. Res. Lett., doi:10.1029/2019GL082929. This substitution is made for all months after August 2016.
- user_note_1 :
- The accelerometer on the GRACE-B spacecraft was turned off after August 2016. After this date, the accelerometer on GRACE-A was used to derive the non-gravitational accelerations acting on GRACE-B using a transplant procedure. This has led to a subsequent degradation in the quality of the gravity fields derived. The uncertainties in this file have been scaled to accomodate this degradation.
- user_note_2 :
- The accelerometer on the GRACE-D spacecraft began performing sub-optimally after June 21, 2018. After this date, the accelerometer on GRACE-C is used to derive the non-gravitational accelerations acting on GRACE-D using a transplant procedure. The uncertainties in the file have been scaled to accomodate this degradation using the current best state of knowledge.
- journal_reference :
- Watkins, M. M., D. N. Wiese, D.-N. Yuan, C. Boening, and F. W. Landerer (2015) Improved methods for observing Earth's time variable mass distribution with GRACE using spherical cap mascons, J. Geophys. Res., 120, doi:10.1002/2014JB011547.
- CRI_filter_journal_reference :
- Wiese, D. N., F. W. Landerer, and M. M. Watkins (2016) Quantifying and reducing leakage errors in the JPL RL05M GRACE mascon solution, Water Resour. Res., 52, doi:10.1002/2016WR019344.
- date_created :
- 2023-05-22T06:05:03Z