Closed jrbourbeau closed 1 year ago
Hi @jrbourbeau this error (earthaccess
should have a better error handling) is because get_s3fs_session()
requires either a DAAC or the DAAC provider as each NASA DAAC distribute their data under different AWS IAM roles and each DAAC uses their own AWS temporary credentials endpoint. If we were accessing HLS data from LPDAAC we would need
fs = earthaccess.get_s3fs_session("LPDAAC")
# fs can now open/copy data from the LPDAAC S3 buckets (for an hour)
Note: S3 (direct access) can only be used from
us-west-2
If you're using earthaccess
to search for data, earthaccess will use the returned metadata from CMR(NASA's search API) to select the proper set of credentials automatically.
results = earthaccess.search_data(
short_name="HLSS30",
bounding_box=(55.0,68.0,-48.0,71.0)
)
file_handlers = earthaccess.open(results)
if we execute this in the cloud, file_handlers
will be a list of s3fs
file instances initialized with the AWS temporary credentials for LPDAAC (the NASA data center that owns the S3 bucket for this dataset)
Okay, thanks for the explanation @betolink. I pushed a PR here https://github.com/nsidc/earthaccess/pull/249 that raises a more informative error for this case
Using the latest
earthaccess=0.5.2
releaseraised the following error
Because the
s3_credentials
variable may not be defined if it doesn't fall into one of theif
/elif
blocks:https://github.com/nsidc/earthaccess/blob/54b688b906776f5c845483dd00676f6c681feb10/earthaccess/store.py#L129-L135
I'm not sure if we can still return an
s3fs
instance in this case, or if raising an informative error is the correct approach