earthdata: Python-R Handoff

The dream

Create once, use often: using earthdata python package for NASA Earthdata authorization and identifying the s3 links (i.e. the locations where the data are stored on Amazon Web Services), then passing those python objects to R through Quarto for analysis by R folks. These notes are a work-in-progress by Julie and Luis and we’ll tidy them up as we develop them further.

Note: this dream is currently not working but we are sharing our progress.

Dev notes

Chat with Andy May 26

Maybe have a python script that takes arguments, compiled in a way that then in MatLab you can sys.admin that python script. Then he doesn’t need to know python

Other approach would be MatLab to re-write earthdata in MatLab

Our dream, revised: the code should be language-agnostic


This was Luis’ original example code, but it downloads data. The examples above access it in the cloud. From

from earthdata import Auth, DataGranules, Store

# first we authenticate with NASA EDL
auth = Auth().login(strategy="netrc")

# Then we build a Query with spatiotemporal parameters
GranuleQuery = DataGranules().concept_id("C1575731655-LPDAAC_ECS").bounding_box(-134.7,58.9,-133.9,59.2)

# We get the metadata records from CMR
granules = GranuleQuery.get()

# Now it{s time to download (or open) our data granules list with get()
files = Store(auth).get(granules, local_path='./data')