From b78c80400769e501a92381cf7a96bae5be165746 Mon Sep 17 00:00:00 2001 From: Quarto GHA Workflow Runner Date: Tue, 13 Feb 2024 18:44:10 +0000 Subject: [PATCH] Built site for gh-pages --- .nojekyll | 2 +- Tutorials/SWOTHR_s3Access_real_data_v11.html | 1199 ++++++++++------- .../figure-html/cell-14-output-1.png | Bin 13363 -> 12370 bytes .../figure-html/cell-18-output-1.png | Bin 153112 -> 0 bytes .../figure-html/cell-20-output-1.png | Bin 0 -> 137181 bytes .../figure-html/cell-23-output-1.png | Bin 61501 -> 0 bytes .../figure-html/cell-26-output-1.png | Bin 0 -> 96974 bytes .../figure-html/cell-8-output-1.png | Bin 16262 -> 12476 bytes search.json | 104 +- site_libs/bootstrap/bootstrap-dark.min.css | 2 +- site_libs/bootstrap/bootstrap.min.css | 2 +- sitemap.xml | 24 +- 12 files changed, 756 insertions(+), 577 deletions(-) delete mode 100644 Tutorials/SWOTHR_s3Access_real_data_v11_files/figure-html/cell-18-output-1.png create mode 100644 Tutorials/SWOTHR_s3Access_real_data_v11_files/figure-html/cell-20-output-1.png delete mode 100644 Tutorials/SWOTHR_s3Access_real_data_v11_files/figure-html/cell-23-output-1.png create mode 100644 Tutorials/SWOTHR_s3Access_real_data_v11_files/figure-html/cell-26-output-1.png diff --git a/.nojekyll b/.nojekyll index 0f863ed..5e4a5a4 100644 --- a/.nojekyll +++ b/.nojekyll @@ -1 +1 @@ -cc445e26 \ No newline at end of file +18fa4608 \ No newline at end of file diff --git a/Tutorials/SWOTHR_s3Access_real_data_v11.html b/Tutorials/SWOTHR_s3Access_real_data_v11.html index 872dea7..f3d791e 100644 --- a/Tutorials/SWOTHR_s3Access_real_data_v11.html +++ b/Tutorials/SWOTHR_s3Access_real_data_v11.html @@ -883,12 +883,6 @@

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. If you don’t already have one, 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.

auth = earthaccess.login()
-
-
EARTHDATA_USERNAME and EARTHDATA_PASSWORD are not set in the current environment, try setting them or use a different strategy (netrc, interactive)
-You're now authenticated with NASA Earthdata Login
-Using token with expiration date: 01/07/2024
-Using .netrc file for EDL
-
@@ -902,12 +896,13 @@

1. River V

Search for the data of interest

-
#Retrieves granule from the day we want, in this case by passing to `earthdata.search_data` function the data collection shortname, temporal bounds, and for restricted data one must specify the search count
-river_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_RIVERSP_1.1', 
-                                        temporal = ('2023-04-08 00:00:00', '2023-04-22 23:59:59'),
-                                        granule_name = '*Reach*_013_NA*') # here we filter by Reach files (not node), pass #13 and continent code=NA
+
# Retrieves granule from the day we want, in this case by passing to `earthdata.search_data` function the data collection shortname, temporal bounds, and for restricted data one must specify the search count
+river_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_RIVERSP_1.1', 
+                                        temporal = ('2023-04-08 00:00:00', '2023-04-22 23:59:59'),
+                                        granule_name = '*Reach*_024_NA*') # here we filter by Reach files (not node), pass #24 and continent code=NA for North America
+                                        # granule_name = '*Reach*_013_NA*') # here we filter by Reach files (not node), pass #13 and continent code=NA
-
Granules found: 14
+
Granules found: 15
@@ -915,31 +910,31 @@

Search for

Set up an s3fs session for Direct Cloud Access

s3fs sessions are used for authenticated access to s3 bucket and allows for typical file-system style operations. Below we create session by passing in the data access information.

-
fs_s3 = earthaccess.get_s3fs_session(results=river_results)
+
fs_s3 = earthaccess.get_s3fs_session(results=river_results)

Create Fiona session to work with zip and embedded shapefiles in the AWS Cloud

The native format for this data is a .zip file, and we want the .shp file within the .zip file, so we will create a Fiona AWS session using the credentials from setting up the s3fs session above to access the shapefiles within the zip files. If we don’t do this, the alternative would be to download the data to the cloud environment (e.g. EC2 instance, user S3 bucket) and extract the .zip file there.

-
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"]
-    )
+
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"]
+    )
-
# Get the link for the first zip file
-river_link = earthaccess.results.DataGranule.data_links(river_results[0], access='direct')[0]
-
-# We use the zip+ prefix so fiona knows that we are operating on a zip file
-river_shp_url = f"zip+{river_link}"
-
-with fiona.Env(session=fiona_session):
-    SWOT_HR_shp1 = gpd.read_file(river_shp_url) 
-
-#view the attribute table
-SWOT_HR_shp1 
+
# Get the link for the first zip file
+river_link = earthaccess.results.DataGranule.data_links(river_results[0], access='direct')[0]
+
+# We use the zip+ prefix so fiona knows that we are operating on a zip file
+river_shp_url = f"zip+{river_link}"
+
+with fiona.Env(session=fiona_session):
+    SWOT_HR_shp1 = gpd.read_file(river_shp_url) 
+
+#view the attribute table
+SWOT_HR_shp1 
@@ -974,123 +969,123 @@

0 -77460000013 -7.342535e+08 -7.342536e+08 -2023-04-08T07:18:42Z -40.621824 --124.244823 -Eel River -2.320100e+00 -9.653000e-02 -3.490000e-02 +71185400013 +7.342856e+08 +7.342856e+08 +2023-04-08T16:12:43Z +55.405348 +-106.628388 +no_data +3.864838e+02 +1.139410e+00 +1.135850e+00 ... -23702.805 -96 -19376.986 -19194.609276 +7863771.149 +48 +61917.017 +9521.873154 -1.000000e+12 0 -4 -1 +10 +2 0 -LINESTRING (-124.29069 40.66364, -124.29104 40... +LINESTRING (-106.60903 55.44509, -106.60930 55... 1 -77460000021 -7.342535e+08 -7.342536e+08 -2023-04-08T07:18:42Z -40.542406 --124.156177 -Eel River -9.248800e+00 -9.071000e-02 -1.130000e-02 +71185400021 +7.342856e+08 +7.342856e+08 +2023-04-08T16:12:43Z +55.452342 +-106.601114 +no_data +-1.000000e+12 +-1.000000e+12 +-1.000000e+12 ... -3435.524 -51 -29478.836 -10101.849934 +0.000 +10 +53346.297 +1902.305299 -1.000000e+12 0 -2 +5 1 0 -LINESTRING (-124.16119 40.58421, -124.16097 40... +LINESTRING (-106.59293 55.45986, -106.59320 55... 2 -77460000031 -7.342535e+08 -7.342536e+08 -2023-04-08T07:18:42Z -40.494638 --124.107178 -Eel River -1.970160e+01 -5.754600e-01 -5.683800e-01 +71185400033 +-1.000000e+12 +-1.000000e+12 +no_data +55.632220 +-106.451323 +no_data +-1.000000e+12 +-1.000000e+12 +-1.000000e+12 ... -1202.549 -50 -39553.707 -10074.871060 +758315.173 +14 +28676.430 +2858.149671 -1.000000e+12 0 +7 2 -1 0 -LINESTRING (-124.13864 40.50871, -124.13829 40... +LINESTRING (-106.47121 55.62881, -106.47073 55... 3 -77460000041 -7.342535e+08 -7.342536e+08 -2023-04-08T07:18:42Z -40.447111 --124.021272 -Eel River -3.471650e+01 -1.486718e+01 -1.486691e+01 +71185400041 +7.342856e+08 +7.342856e+08 +2023-04-08T16:12:43Z +55.361687 +-106.646694 +no_data +3.861999e+02 +9.139000e-02 +1.588000e-02 ... -645.984 -81 -55843.425 -16289.718636 +0.000 +5 +62976.523 +1059.505878 -1.000000e+12 0 -1 +5 1 0 -LINESTRING (-124.09611 40.46269, -124.09575 40... +LINESTRING (-106.64608 55.36668, -106.64607 55... 4 -77460000051 -7.342535e+08 -7.342536e+08 -2023-04-08T07:18:42Z -40.395990 --123.930243 -Eel River -3.229870e+01 -9.148000e-02 -1.638000e-02 +71185400053 +7.342856e+08 +7.342856e+08 +2023-04-08T16:12:43Z +55.350062 +-106.647210 +no_data +3.861795e+02 +1.022600e-01 +4.855000e-02 ... -1532.658 -51 -66073.910 -10230.484650 +3214.190 +8 +64492.945 +1516.422084 -1.000000e+12 0 -2 +1 1 0 -LINESTRING (-123.95755 40.42295, -123.95719 40... +LINESTRING (-106.64728 55.35669, -106.64736 55... ... @@ -1117,129 +1112,129 @@

-355 -78322900143 +594 +75211000291 -1.000000e+12 -1.000000e+12 no_data -50.998910 --119.011806 -no_data +26.100287 +-98.270345 +Rio Bravo -1.000000e+12 -1.000000e+12 -1.000000e+12 ... -116183.841 -15 -59585.535 -2935.007230 +123.027 +53 +238333.030 +10660.888100 -1.000000e+12 0 1 1 0 -LINESTRING (-119.03134 51.00406, -119.03105 51... +LINESTRING (-98.25015 26.07251, -98.25039 26.0... -356 -78322900153 -7.342537e+08 -7.342537e+08 -2023-04-08T07:21:51Z -51.047442 --119.042215 +595 +75211000301 +-1.000000e+12 +-1.000000e+12 no_data -3.451806e+02 -1.114110e+00 -1.110470e+00 +26.115209 +-98.305631 +Rio Grande +-1.000000e+12 +-1.000000e+12 +-1.000000e+12 ... -41059.043 -51 -30434.699 -10168.113068 +242.204 +53 +248976.010 +10642.980241 -1.000000e+12 0 -2 +1 1 0 -LINESTRING (-119.03140 51.09147, -119.03165 51... +LINESTRING (-98.27467 26.11517, -98.27497 26.1... -357 -78322900173 --1.000000e+12 --1.000000e+12 -no_data -50.916115 --119.036919 -no_data --1.000000e+12 --1.000000e+12 --1.000000e+12 +596 +75211000683 +7.342861e+08 +7.342861e+08 +2023-04-08T16:21:20Z +25.955223 +-97.159176 +Rio Grande +2.871000e-01 +9.005000e-02 +3.080000e-03 ... -186564.361 -98 -39488.857 -19642.879384 +436.214 +18 +9238.006 +3611.160551 -1.000000e+12 0 -4 +1 1 0 -LINESTRING (-118.99201 50.99421, -118.99200 50... +LINESTRING (-97.14980 25.95092, -97.15011 25.9... -358 -78322900183 -7.342537e+08 -7.342537e+08 -2023-04-08T07:21:52Z -51.060235 --118.938606 -no_data --1.000000e+12 --1.000000e+12 --1.000000e+12 +597 +75211000691 +7.342861e+08 +7.342861e+08 +2023-04-08T16:21:20Z +25.957129 +-97.209134 +Rio Grande +3.374000e-01 +9.102000e-02 +1.360000e-02 ... -177029.325 -86 -56650.527 -17161.670624 +348.855 +53 +19926.935 +10688.929343 -1.000000e+12 0 -4 +1 1 0 -LINESTRING (-118.99200 50.99394, -118.99201 50... +LINESTRING (-97.16943 25.96060, -97.16972 25.9... -359 -78322900211 --1.000000e+12 --1.000000e+12 -no_data -50.549433 --119.062048 -Shuswap River --1.000000e+12 --1.000000e+12 --1.000000e+12 +598 +75211000701 +7.342861e+08 +7.342861e+08 +2023-04-08T16:21:20Z +25.945001 +-97.279869 +Rio Grande +4.375000e-01 +9.212000e-02 +1.965000e-02 ... -122.690 -50 -103956.987 -10074.432813 +203.786 +53 +30608.499 +10681.563344 -1.000000e+12 0 -2 +1 1 0 -LINESTRING (-119.11242 50.54684, -119.11207 50... +LINESTRING (-97.25170 25.94769, -97.25200 25.9... -

360 rows × 127 columns

+

599 rows × 127 columns

@@ -1247,9 +1242,9 @@

Quickly plot the SWOT river data

-
# Simple plot
-fig, ax = plt.subplots(figsize=(7,5))
-SWOT_HR_shp1.plot(ax=ax, color='black')
+
# Simple plot
+fig, ax = plt.subplots(figsize=(7,5))
+SWOT_HR_shp1.plot(ax=ax, color='black')
@@ -1259,8 +1254,183 @@

Quickly p

-
# # Another way to plot geopandas dataframes is with `explore`, which also plots a basemap
-# SWOT_HR_shp1.explore()
+
# # Another way to plot geopandas dataframes is with `explore`, which also plots a basemap
+SWOT_HR_shp1.explore()
+
+
Make this Notebook Trusted to load map: File -> Trust Notebook
+
@@ -1271,11 +1441,12 @@

2. Lake Vec

Search for data of interest

-
lake_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_LAKESP_1.1', 
-                                       temporal = ('2023-04-08 00:00:00', '2023-04-22 23:59:59'),
-                                       granule_name = '*Obs*_013_NA*') # here we filter by files with 'Obs' in the name (This collection has three options: Obs, Unassigned, and Prior), pass #13 and continent code=NA
+
lake_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_LAKESP_1.1', 
+                                       temporal = ('2023-04-08 00:00:00', '2023-04-22 23:59:59'),
+                                       granule_name = '*Obs*_024_NA*')
+                                       # granule_name = '*Obs*_013_NA*') # here we filter by files with 'Obs' in the name (This collection has three options: Obs, Unassigned, and Prior), pass #13 and continent code=NA
-
Granules found: 14
+
Granules found: 15
@@ -1283,31 +1454,31 @@

Search for dat

Set up an s3fs session for Direct Cloud Access

s3fs sessions are used for authenticated access to s3 bucket and allows for typical file-system style operations. Below we create session by passing in the data access information.

-
fs_s3 = earthaccess.get_s3fs_session(results=lake_results)
+
fs_s3 = earthaccess.get_s3fs_session(results=lake_results)

Create Fiona session to work with zip and embedded shapefiles in the AWS Cloud

The native format for this data is a .zip file, and we want the .shp file within the .zip file, so we will create a Fiona AWS session using the credentials from setting up the s3fs session above to access the shapefiles within the zip files. If we don’t do this, the alternative would be to download the data to the cloud environment (e.g. EC2 instance, user S3 bucket) and extract the .zip file there.

-
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"]
-    )
+
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"]
+    )
-
# Get the link for the first zip file
-lake_link = earthaccess.results.DataGranule.data_links(lake_results[0], access='direct')[0]
-
-# We use the zip+ prefix so fiona knows that we are operating on a zip file
-lake_shp_url = f"zip+{lake_link}"
-
-with fiona.Env(session=fiona_session):
-    SWOT_HR_shp2 = gpd.read_file(lake_shp_url) 
-
-#view the attribute table
-SWOT_HR_shp2
+
# Get the link for the first zip file
+lake_link = earthaccess.results.DataGranule.data_links(lake_results[0], access='direct')[0]
+
+# We use the zip+ prefix so fiona knows that we are operating on a zip file
+lake_shp_url = f"zip+{lake_link}"
+
+with fiona.Env(session=fiona_session):
+    SWOT_HR_shp2 = gpd.read_file(lake_shp_url) 
+
+#view the attribute table
+SWOT_HR_shp2
@@ -1342,123 +1513,123 @@

0 -781229R000006 -7810001133 -85 +711056R000000 +7110058862 +43 1 no_data -7.342536e+08 -7.342536e+08 -2023-04-08T07:19:21Z -593.993 -0.011 +7.342856e+08 +7.342856e+08 +2023-04-08T16:12:42Z +456.591 +0.068 ... --0.019138 --0.018407 --0.002311 --2.164411 --0.074947 --0.003339 +0.012544 +0.011979 +-0.001644 +-2.171307 +-0.096968 +-0.004681 -1.000000e+12 -APPLEGATE RESERVOIR;APPLEGATE LAKE -116 -MULTIPOLYGON (((-123.10728 42.03437, -123.1073... +no_data +-99999999 +POLYGON ((-108.10263 55.82828, -108.10271 55.8... 1 -782232R000018 -7820002572;7820002253 -86;80 +711056R000006 +7110057883;7110044502 +32;0 2 -no_data -7.342536e+08 -7.342536e+08 -2023-04-08T07:19:51Z -439.811 -0.167 +71185900011;71185900023;71185900031;7118590004... +7.342856e+08 +7.342856e+08 +2023-04-08T16:12:47Z +420.100 +0.043 ... --0.016663 --0.016105 --0.002303 --2.199668 --0.069287 --0.003153 +0.012521 +0.011962 +-0.001645 +-2.179560 +-0.095098 +-0.004694 -1.000000e+12 -HILLS CREEK RESERVOIR +ILE-A-LA-CROSSE -99999999 -MULTIPOLYGON (((-122.45387 43.68914, -122.4539... +MULTIPOLYGON (((-108.04803 55.51018, -108.0481... 2 -782243R000013 -7820039162 -10 -1 +711056R000002 +7110044512;7110045352 +93;2 +2 no_data -7.342537e+08 -7.342537e+08 -2023-04-08T07:21:40Z -341.457 -0.003 +7.342856e+08 +7.342856e+08 +2023-04-08T16:12:43Z +423.307 +0.130 ... --0.009852 --0.009920 --0.002187 --2.211506 --0.079803 --0.002515 +0.012743 +0.012195 +-0.001671 +-2.177715 +-0.099736 +-0.004680 -1.000000e+12 -WHITEMAN CREEK;OKANAGAN LAKE;OKANAGAN +PETER POND;NISKA LAKE -99999999 -MULTIPOLYGON (((-119.72285 49.72639, -119.7227... +MULTIPOLYGON (((-108.63716 55.67995, -108.6372... 3 -782243R015586 -7820039162 -17 +711056R000003 +7110044502 +0 1 no_data -7.342537e+08 -7.342537e+08 -2023-04-08T07:21:48Z -341.513 -0.028 +7.342856e+08 +7.342856e+08 +2023-04-08T16:12:42Z +421.265 +0.718 ... --0.009454 --0.009599 --0.002172 --2.209661 --0.079193 --0.002491 +0.012595 +0.012031 +-0.001651 +-2.178498 +-0.098505 +-0.004681 -1.000000e+12 -WHITEMAN CREEK;OKANAGAN LAKE;OKANAGAN +FROBISHER LAKE;NIPAWIN BAY;PETER POND LAKE;CHU... -99999999 -MULTIPOLYGON (((-119.49606 50.06182, -119.4961... +MULTIPOLYGON (((-108.22462 55.77025, -108.2251... 4 -783245R000005 -7830263943 -32 +711056R001623 +7110061392 +70 1 -78322700063;78322700091;78322800011;7832290001... -7.342537e+08 -7.342537e+08 -2023-04-08T07:22:01Z -344.832 -0.014 +no_data +7.342856e+08 +7.342856e+08 +2023-04-08T16:12:52Z +433.682 +0.159 ... --0.009029 --0.009206 --0.002157 --2.207273 --0.082830 --0.002465 +0.012518 +0.011977 +-0.001648 +-2.176805 +-0.093354 +-0.004701 -1.000000e+12 -ROSS CREEK;EAGLE RIVER;SHUSWAP;LITTLE RIVER;SC... +AMYOT LAKE -99999999 -MULTIPOLYGON (((-119.35814 50.94441, -119.3580... +MULTIPOLYGON (((-107.87588 55.21497, -107.8759... ... @@ -1485,129 +1656,129 @@

-831 -783246R009013 -7830249372;7830249352 -81;71 -2 +5084 +753111R000533 +7530074612 +33 +1 no_data -7.342537e+08 -7.342538e+08 -2023-04-08T07:22:13Z -1837.232 -0.563 +7.342861e+08 +7.342861e+08 +2023-04-08T16:21:48Z +1.204 +0.151 ... --0.008546 --0.008791 --0.002133 --2.094712 --0.066065 --0.002440 +0.003597 +0.004175 +-0.001930 +-2.332590 +-0.261529 +-0.010383 -1.000000e+12 no_data -99999999 -MULTIPOLYGON (((-118.98292 51.59811, -118.9830... +MULTIPOLYGON (((-97.73272 25.04506, -97.73275 ... -832 -783246R009931 -7830249332 -87 +5085 +753111R000813 +7530075482 +9 1 no_data -7.342537e+08 -7.342538e+08 -2023-04-08T07:22:14Z -1635.514 -0.325 +7.342861e+08 +7.342861e+08 +2023-04-08T16:21:48Z +0.851 +0.166 ... --0.008539 --0.008785 --0.002132 --2.136184 --0.071612 --0.002440 +0.003638 +0.004185 +-0.001905 +-2.332652 +-0.261308 +-0.010385 -1.000000e+12 no_data -99999999 -POLYGON ((-118.98463 51.61215, -118.98453 51.6... +POLYGON ((-97.74014 25.04083, -97.74030 25.041... -833 -783246R010740 -7830243082 +5086 +753111R000849 +7530072312 82 1 no_data -7.342537e+08 -7.342538e+08 -2023-04-08T07:22:14Z -2094.295 -5.792 +7.342861e+08 +7.342861e+08 +2023-04-08T16:21:48Z +0.507 +0.058 ... --0.008558 --0.008815 --0.002135 --1.942940 --0.048756 --0.002438 +0.003659 +0.004194 +-0.001900 +-2.332774 +-0.261139 +-0.010385 -1.000000e+12 no_data -99999999 -MULTIPOLYGON (((-119.07615 51.67504, -119.0759... +POLYGON ((-97.75064 25.04090, -97.75067 25.041... -834 -783246R010910 -7830256902 -21 +5087 +753111R000883 +7530075482 +66 1 no_data -7.342537e+08 -7.342538e+08 -2023-04-08T07:22:14Z -1996.670 -0.303 +7.342861e+08 +7.342861e+08 +2023-04-08T16:21:48Z +0.577 +0.027 ... --0.008524 --0.008775 --0.002132 --1.863152 --0.041920 --0.002443 +0.003676 +0.004200 +-0.001788 +-2.332951 +-0.261053 +-0.010387 -1.000000e+12 no_data -99999999 -POLYGON ((-118.97489 51.63692, -118.97478 51.6... +MULTIPOLYGON (((-97.76046 25.03127, -97.76049 ... -835 -782246R012796 -7820071012 -75 +5088 +753111R000978 +7530075052 +50 1 no_data -7.342537e+08 -7.342538e+08 -2023-04-08T07:22:15Z -1962.504 -0.385 +7.342861e+08 +7.342861e+08 +2023-04-08T16:21:48Z +3.190 +0.062 ... --0.008469 --0.008730 --0.002128 --2.104326 --0.068847 --0.002438 +0.003768 +0.004261 +-0.001394 +-2.332381 +-0.260291 +-0.010385 -1.000000e+12 no_data -99999999 -POLYGON ((-118.88701 51.66364, -118.88710 51.6... +MULTIPOLYGON (((-97.79919 25.02889, -97.79933 ... -

836 rows × 36 columns

+

5089 rows × 36 columns

@@ -1615,8 +1786,8 @@

Quickly plot the SWOT lakes data

-
fig, ax = plt.subplots(figsize=(7,5))
-SWOT_HR_shp2.plot(ax=ax, color='black')
+
fig, ax = plt.subplots(figsize=(7,5))
+SWOT_HR_shp2.plot(ax=ax, color='black')
@@ -1625,6 +1796,15 @@

Quickly p

+
+
# # Another way to plot geopandas dataframes is with `explore`, which also plots a basemap
+# SWOT_HR_shp2.explore()
+
+
+
# # [Optional] Diving a bit deeper, plotting riversP and lakeSP overlaid on same map
+# m = SWOT_HR_shp1.explore()  #define the riverSP map
+# SWOT_HR_shp2.explore(m=m, color="orange")  #plot the riverSP with the lakesSP data, where lakes are in orange
+

Accessing the remaining files is different than the shp files above. We do not need to read the shapefiles within a zip file using something like Fiona session (or to download and unzip in the cloud) because the following SWOT HR collections are stored in netCDF files in the cloud. For the rest of the products, we will open via xarray, not geopandas.

@@ -1633,34 +1813,35 @@

3. W

Search for data collection and time of interest

For additional tips on spatial searching of SWOT HR L2 data, see also PO.DAAC Cookbook - SWOT Chapter tips section.

-
-
pixc_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_PIXC_1.1',
-                                       temporal = ('2023-04-22 00:00:00', '2023-04-22 23:59:59'), 
-                                       granule_name = '*_498_013_*') # here we filter by cycle=498 and pass=013                                       
+
+
pixc_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_PIXC_1.1',
+                                       temporal = ('2023-04-22 00:00:00', '2023-04-22 23:59:59'), 
+                                       granule_name = '*_498_024_101L*')
+                                       # granule_name = '*_498_013_*') # here we filter by cycle=498 and pass=013                                       
-
Granules found: 164
+
Granules found: 1

Set up an s3fs session for Direct Cloud Access

s3fs sessions are used for authenticated access to s3 bucket and allows for typical file-system style operations. Below we create session by passing in the data access information.

-
-
fs_s3 = earthaccess.get_s3fs_session(results=pixc_results)
-
-# get link for file 100
-pixc_link = earthaccess.results.DataGranule.data_links(pixc_results[100], access='direct')[0]
-
-s3_file_obj3 = fs_s3.open(pixc_link, mode='rb')
+
+
fs_s3 = earthaccess.get_s3fs_session(results=pixc_results)
+
+# get link for file 1
+pixc_link = earthaccess.results.DataGranule.data_links(pixc_results[0], access='direct')[0]
+
+s3_file_obj3 = fs_s3.open(pixc_link, mode='rb')

Open data using xarray

The pixel cloud netCDF files are formatted with three groups titled, “pixel cloud”, “tvp”, or “noise” (more detail here). In order to access the coordinates and variables within the file, a group must be specified when calling xarray open_dataset.

-
-
ds_PIXC = xr.open_dataset(s3_file_obj3, group = 'pixel_cloud', engine='h5netcdf')
-ds_PIXC
-
+
+
ds_PIXC = xr.open_dataset(s3_file_obj3, group = 'pixel_cloud', engine='h5netcdf')
+ds_PIXC
+
@@ -2025,8 +2206,8 @@

Open data using xar fill: currentColor; }
<xarray.Dataset>
-Dimensions:                                (points: 5180594, complex_depth: 2,
-                                            num_pixc_lines: 3239)
+Dimensions:                                (points: 6842667, complex_depth: 2,
+                                            num_pixc_lines: 3249)
 Coordinates:
     latitude                               (points) float64 ...
     longitude                              (points) float64 ...
@@ -2047,70 +2228,75 @@ 

Open data using xar pixc_line_to_tvp (num_pixc_lines) float32 ... Attributes: description: cloud of geolocated interferogram pixels - interferogram_size_azimuth: 3239 - interferogram_size_range: 5526 - looks_to_efflooks: 1.5309342049156023 + interferogram_size_azimuth: 3249 + interferogram_size_range: 4758 + looks_to_efflooks: 1.5368636877472777 num_azimuth_looks: 7.0 - azimuth_offset: 3

    • description :
      cloud of geolocated interferogram pixels
      interferogram_size_azimuth :
      3249
      interferogram_size_range :
      4758
      looks_to_efflooks :
      1.5368636877472777
      num_azimuth_looks :
      7.0
      azimuth_offset :
      8
    • Simple plot of the results

      -
      -
      # This could take a few minutes to plot
      -plt.scatter(x=ds_PIXC.longitude, y=ds_PIXC.latitude, c=ds_PIXC.height)
      -plt.colorbar().set_label('Height (m)')
      +
      +
      # This could take a few minutes to plot
      +plt.scatter(x=ds_PIXC.longitude, y=ds_PIXC.latitude, c=ds_PIXC.height)
      +plt.colorbar().set_label('Height (m)')
      -

      +

      +
      +
      # plt.scatter(x=ds_PIXC.longitude, y=ds_PIXC.latitude, c=ds_PIXC.classification)
      +# plt.colorbar().set_label('Classification')
      +

      4. Water Mask Pixel Cloud Vector Attribute NetCDF

      Search for data of interest

      -
      -
      pixcvec_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_PIXCVEC_1.1', 
      -                                          temporal = ('2023-04-08 00:00:00', '2023-04-22 23:59:59'), 
      -                                          granule_name = '*_498_013_*') # here we filter by cycle=498 and pass=013 
      +
      +
      pixcvec_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_PIXCVEC_1.1', 
      +                                          temporal = ('2023-04-08 00:00:00', '2023-04-22 23:59:59'), 
      +                                          granule_name = '*_498_024_101L*')
      +                                          # granule_name = '*_498_013_*') # here we filter by cycle=498 and pass=013 
      -
      Granules found: 100
      +
      Granules found: 1

      Set up an s3fs session for Direct Cloud Access

      s3fs sessions are used for authenticated access to s3 bucket and allows for typical file-system style operations. Below we create session by passing in the data access information.

      -
      -
      fs_s3 = earthaccess.get_s3fs_session(results=pixcvec_results)
      -
      -# get link for file 0
      -pixcvec_link = earthaccess.results.DataGranule.data_links(pixcvec_results[0], access='direct')[0]
      -
      -s3_file_obj4 = fs_s3.open(pixcvec_link, mode='rb')
      +
      +
      fs_s3 = earthaccess.get_s3fs_session(results=pixcvec_results)
      +
      +# get link for file 0
      +pixcvec_link = earthaccess.results.DataGranule.data_links(pixcvec_results[0], access='direct')[0]
      +
      +s3_file_obj4 = fs_s3.open(pixcvec_link, mode='rb')

      Open data using xarray

      -
      -
      ds_PIXCVEC = xr.open_dataset(s3_file_obj4, decode_cf=False,  engine='h5netcdf')
      -ds_PIXCVEC
      -
      +
      +
      ds_PIXCVEC = xr.open_dataset(s3_file_obj4, decode_cf=False,  engine='h5netcdf')
      +ds_PIXCVEC
      +
      @@ -2475,7 +2661,7 @@

      Open data using x fill: currentColor; }
      <xarray.Dataset>
      -Dimensions:               (points: 11174047, nchar_reach_id: 11,
      +Dimensions:               (points: 6842667, nchar_reach_id: 11,
                                  nchar_node_id: 14, nchar_lake_id: 10,
                                  nchar_obs_id: 13)
       Dimensions without coordinates: points, nchar_reach_id, nchar_node_id,
      @@ -2498,38 +2684,36 @@ 

      Open data using x short_name: L2_HR_PIXCVec institution: JPL source: Level 1B KaRIn High Rate Single Look Com... - history: 2023-09-07T04:43:11.652934Z: Creation + history: 2023-10-03T00:34:10.665297Z: Creation ... ... xref_prior_river_db_file: - xref_prior_lake_db_file: SWOT_LakeDatabase_Cal_013_20000101T00000... + xref_prior_lake_db_file: SWOT_LakeDatabase_Cal_024_20000101T00000... xref_reforbittrack_files: SWOT_RefOrbitTrackTileBoundary_Cal_20000... xref_param_l2_hr_laketile_file: SWOT_Param_L2_HR_LakeTile_20000101T00000... ellipsoid_semi_major_axis: 6378137.0 - ellipsoid_flattening: 0.0033528106647474805

      + ellipsoid_flattening: 0.0033528106647474805

      Simple plot

      -
      -
      pixcvec_htvals = ds_PIXCVEC.height_vectorproc.compute()
      -pixcvec_latvals = ds_PIXCVEC.latitude_vectorproc.compute()
      -pixcvec_lonvals = ds_PIXCVEC.longitude_vectorproc.compute()
      -
      -#Before plotting, we set all fill values to nan so that the graph shows up better spatially
      -pixcvec_htvals[pixcvec_htvals > 15000] = np.nan
      -pixcvec_latvals[pixcvec_latvals > 80] = np.nan
      -pixcvec_latvals[pixcvec_latvals < -80] = np.nan
      -pixcvec_lonvals[pixcvec_lonvals > 180] = np.nan
      -pixcvec_lonvals[pixcvec_lonvals < -180] = np.nan
      +
      +
      pixcvec_htvals = ds_PIXCVEC.height_vectorproc.compute()
      +pixcvec_latvals = ds_PIXCVEC.latitude_vectorproc.compute()
      +pixcvec_lonvals = ds_PIXCVEC.longitude_vectorproc.compute()
      +
      +#Before plotting, we set all fill values to nan so that the graph shows up better spatially
      +pixcvec_htvals[pixcvec_htvals > 15000] = np.nan
      +pixcvec_latvals[pixcvec_latvals < 1] = np.nan
      +pixcvec_lonvals[pixcvec_lonvals > -1] = np.nan
      -
      -
      plt.scatter(x=pixcvec_lonvals, y=pixcvec_latvals, c=pixcvec_htvals)
      -plt.colorbar().set_label('Height (m)')
      +
      +
      plt.scatter(x=pixcvec_lonvals, y=pixcvec_latvals, c=pixcvec_htvals)
      +plt.colorbar().set_label('Height (m)')
      -

      +

      @@ -2541,11 +2725,12 @@

      5. Raster NetCDF

      Search for data of interest

      For additional tips on spatial searching of SWOT HR L2 data, see also PO.DAAC Cookbook - SWOT Chapter tips section.

      -
      -
      #Say we know the exact cycle, pass & scene. We can search for one data granule!
      -raster_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_Raster_1.1', 
      -                                         temporal = ('2023-04-01 00:00:00', '2023-04-22 23:59:59'), 
      -                                         granule_name = '*100m*_498_013_130F*') # here we filter by files with '100m' in the name (This collection has two resolution options: 100m & 250m), cycle=498, pass=013, scene = 130F 
      +
      +
      #Say we know the exact cycle, pass & scene. We can search for one data granule!
      +raster_results = earthaccess.search_data(short_name = 'SWOT_L2_HR_Raster_1.1', 
      +                                         temporal = ('2023-04-01 00:00:00', '2023-04-22 23:59:59'), 
      +                                         granule_name = '*100m*_498_024_051F*')
      +                                         # granule_name = '*100m*_498_013_130F*') # here we filter by files with '100m' in the name (This collection has two resolution options: 100m & 250m), cycle=498, pass=013, scene = 130F 
      Granules found: 1
      @@ -2554,27 +2739,21 @@

      Search for d

      Set up an s3fs session for Direct Cloud Access

      s3fs sessions are used for authenticated access to s3 bucket and allows for typical file-system style operations. Below we create session by passing in the data access information.

      -
      -
      fs_s3 = earthaccess.get_s3fs_session(results=raster_results)
      -
      -# get link for file 
      -raster_link = earthaccess.results.DataGranule.data_links(raster_results[0], access='direct')[0]
      -
      -s3_file_obj5 = fs_s3.open(raster_link, mode='rb')
      +
      +
      fs_s3 = earthaccess.get_s3fs_session(results=raster_results)
      +
      +# get link for file 
      +raster_link = earthaccess.results.DataGranule.data_links(raster_results[0], access='direct')[0]
      +
      +s3_file_obj5 = fs_s3.open(raster_link, mode='rb')

      Open data with xarray

      -
      -
      ds_raster = xr.open_dataset(s3_file_obj5, engine='h5netcdf')
      -ds_raster
      -
      -
      /srv/conda/envs/notebook/lib/python3.10/site-packages/xarray/coding/times.py:254: RuntimeWarning: invalid value encountered in cast
      -  flat_num_dates_ns_int = (flat_num_dates * _NS_PER_TIME_DELTA[delta]).astype(
      -/srv/conda/envs/notebook/lib/python3.10/site-packages/xarray/coding/times.py:254: RuntimeWarning: invalid value encountered in cast
      -  flat_num_dates_ns_int = (flat_num_dates * _NS_PER_TIME_DELTA[delta]).astype(
      -
      -
      +
      +
      ds_raster = xr.open_dataset(s3_file_obj5, engine='h5netcdf')
      +ds_raster
      +
      @@ -2939,10 +3118,10 @@

      Open data with xarra fill: currentColor; }
      <xarray.Dataset>
      -Dimensions:                  (x: 1652, y: 1651)
      +Dimensions:                  (x: 1505, y: 1505)
       Coordinates:
      -  * x                        (x) float64 5.438e+05 5.439e+05 ... 7.089e+05
      -  * y                        (y) float64 6.468e+06 6.468e+06 ... 6.633e+06
      +  * x                        (x) float64 4.855e+05 4.856e+05 ... 6.359e+05
      +  * y                        (y) float64 3.272e+06 3.272e+06 ... 3.422e+06
       Data variables: (12/39)
           crs                      object ...
           longitude                (y, x) float64 ...
      @@ -2961,49 +3140,49 @@ 

      Open data with xarra Conventions: CF-1.7 title: Level 2 KaRIn High Rate Raster Data Product source: Ka-band radar interferometer - history: 2023-09-13T20:22:58Z : Creation + history: 2023-10-04T10:18:05Z : Creation platform: SWOT reference_document: JPL D-56416 - Revision B - October 24, 2022 ... ... - x_max: 708900.0 - y_min: 6467900.0 - y_max: 6632900.0 + x_max: 635900.0 + y_min: 3271900.0 + y_max: 3422300.0 institution: JPL references: V1.0 - product_version: 01

      + 3421400.0, 3421500.0, 3421600.0, 3421700.0, 3421800.0, 3421900.0, + 3422000.0, 3422100.0, 3422200.0, 3422300.0], + dtype='float64', name='y', length=1505))
    • Conventions :
      CF-1.7
      title :
      Level 2 KaRIn High Rate Raster Data Product
      source :
      Ka-band radar interferometer
      history :
      2023-10-04T10:18:05Z : Creation
      platform :
      SWOT
      reference_document :
      JPL D-56416 - Revision B - October 24, 2022
      contact :
      alexander.t.corben[at]jpl.nasa.gov
      cycle_number :
      498
      pass_number :
      24
      scene_number :
      51
      tile_numbers :
      [100 101 102 103 100 101 102 103]
      tile_names :
      024_100L, 024_101L, 024_102L, 024_103L, 024_100R, 024_101R, 024_102R, 024_103R
      tile_polarizations :
      H, H, H, H, V, V, V, V
      coordinate_reference_system :
      Universal Transverse Mercator
      resolution :
      100.0
      short_name :
      L2_HR_Raster
      descriptor_string :
      100m_UTM14R_N_x_x_x
      crid :
      PIB0
      pge_name :
      PGE_L2_HR_RASTER
      pge_version :
      4.3.1
      time_granule_start :
      2023-04-22T14:08:59.773882Z
      time_granule_end :
      2023-04-22T14:09:20.715685Z
      time_coverage_start :
      2023-04-22T14:09:00.310942Z
      time_coverage_end :
      2023-04-22T14:09:20.176743Z
      geospatial_lon_min :
      -99.15144259381215
      geospatial_lon_max :
      -97.59361273278951
      geospatial_lat_min :
      29.57685751046376
      geospatial_lat_max :
      30.929033865009067
      left_first_longitude :
      -97.83833737461467
      left_first_latitude :
      30.929033865009067
      left_last_longitude :
      -97.59361273278951
      left_last_latitude :
      29.793281951000594
      right_first_longitude :
      -99.15144259381215
      right_first_latitude :
      30.708483340005156
      right_last_longitude :
      -98.89264426789154
      right_last_latitude :
      29.57685751046376
      xref_l2_hr_pixc_files :
      SWOT_L2_HR_PIXC_498_024_100L_20230422T140849_20230422T140900_PIB0_01.nc, SWOT_L2_HR_PIXC_498_024_101L_20230422T140859_20230422T140910_PIB0_01.nc, SWOT_L2_HR_PIXC_498_024_102L_20230422T140909_20230422T140920_PIB0_01.nc, SWOT_L2_HR_PIXC_498_024_103L_20230422T140919_20230422T140930_PIB0_01.nc, SWOT_L2_HR_PIXC_498_024_100R_20230422T140849_20230422T140900_PIB0_01.nc, SWOT_L2_HR_PIXC_498_024_101R_20230422T140859_20230422T140910_PIB0_01.nc, SWOT_L2_HR_PIXC_498_024_102R_20230422T140909_20230422T140920_PIB0_01.nc, SWOT_L2_HR_PIXC_498_024_103R_20230422T140919_20230422T140930_PIB0_01.nc
      xref_l2_hr_pixcvec_files :
      SWOT_L2_HR_PIXCVec_498_024_100L_20230422T140849_20230422T140900_PIB0_01.nc, SWOT_L2_HR_PIXCVec_498_024_101L_20230422T140859_20230422T140910_PIB0_01.nc, SWOT_L2_HR_PIXCVec_498_024_102L_20230422T140909_20230422T140920_PIB0_01.nc, SWOT_L2_HR_PIXCVec_498_024_103L_20230422T140919_20230422T140930_PIB0_01.nc, SWOT_L2_HR_PIXCVec_498_024_100R_20230422T140849_20230422T140900_PIB0_01.nc, SWOT_L2_HR_PIXCVec_498_024_101R_20230422T140859_20230422T140910_PIB0_01.nc, SWOT_L2_HR_PIXCVec_498_024_102R_20230422T140909_20230422T140920_PIB0_01.nc, SWOT_L2_HR_PIXCVec_498_024_103R_20230422T140919_20230422T140930_PIB0_01.nc
      xref_param_l2_hr_raster_file :
      SWOT_Param_L2_HR_Raster_20000101T000000_21000101T000000_20230321T100000_v301.rdf
      xref_reforbittrack_files :
      SWOT_RefOrbitTrackTileBoundary_Cal_20000101T000000_21000101T000000_20200617T193054_v101.txt, SWOT_RefOrbitTrack125mPass1_Cal_20000101T000000_21000101T000000_20200617T193054_v101.txt, SWOT_RefOrbitTrack125mPass2_Cal_20000101T000000_21000101T000000_20200617T193054_v101.txt
      utm_zone_num :
      14
      mgrs_latitude_band :
      R
      x_min :
      485500.0
      x_max :
      635900.0
      y_min :
      3271900.0
      y_max :
      3422300.0
      institution :
      JPL
      references :
      V1.0
      product_version :
      01
    • Quick interactive plot with hvplot

      -
      -
      ds_raster.wse.hvplot.image(y='y', x='x')
      +
      +
      ds_raster.wse.hvplot.image(y='y', x='x')
      -
      +
      -
      +