Skip to content

Instantly share code, notes, and snippets.

@giswqs
Created February 8, 2025 23:30
Show Gist options
  • Save giswqs/06860357b1bc63db0bd92391ddf19094 to your computer and use it in GitHub Desktop.
Save giswqs/06860357b1bc63db0bd92391ddf19094 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@asjohnston-asf
Copy link

To leverage your temporary S3 credentials, you'll want to use s3:// URIs, rather than https:// URLs. For the ASF RTC example, I expect you'll have success by setting

url = 's3://asf-cumulus-prod-opera-products/OPERA_L2_RTC-S1/OPERA_L2_RTC-S1_T100-213489-IW1_20220103T133500Z_20241217T081326Z_S1A_30_v1.0/OPERA_L2_RTC-S1_T100-213489-IW1_20220103T133500Z_20241217T081326Z_S1A_30_v1.0_VH.tif'

For the PO.DAAC DSWX example, you'll likely see better performance if you set:

url = 's3://podaac-ops-cumulus-protected/OPERA_L3_DSWX-HLS_PROVISIONAL_V1/OPERA_L3_DSWx-HLS_T11SPA_20230409T181446Z_20230411T155818Z_L8_30_v1.0_B01_WTR.tif'

When using an https:// url, I expect xr.open_dataset is using Basic Authentication via your .netrc file, rather than leveraging the s3 credentials you've set up. https://datapool.asf.alaska.edu has a known issue with Basic Authentication and would require some extra code to succeed, while https://archive.podaac.earthdata.nasa.gov works out-of-the-box.

@giswqs
Copy link
Author

giswqs commented Feb 11, 2025

@asjohnston-asf Thanks for the suggestions. I will try it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment