earthdata can now persist user's credentials into a `.netrc` file
python
from earthdata import Auth, DataCollections, DataGranules, Store
auth = Auth().login(strategy="netrc")
are we authenticated?
if not auth.authenticated:
ask for credentials and persist them in a .netrc file
auth.login(strategy="interactive", persist=True)
We can also renew our CMR token to make sure our authenticated queries work:
python
auth.refresh_token()
collections = DataCollections(auth).concept_id("c-some-restricted-dataset").get()
We can get authenticated `fsspec` file sessions. closes 41
python
store = Store(auth)
fs = store.get_https_session()
we can use fsspec to get any granule from any DAAC!
fs.get("https://DAAC/granule", "./data")
We can use `Store` to get our files from a URL list. closes 43
python
store = Store(auth)
files = store.get(["https://GRANULE_URL"], "./data/")
Lastly, we can stream certain datasets directly into xarray (even if we are not in AWS)
python
%%time
import xarray as xr
query_results = DataGranules().concept_id("C2036880672-POCLOUD").temporal("2018-01-01", "2018-12-31").get()
ds = xr.open_mfdataset(store.open(query_results))
ds