- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5
 
Description
In the process of testing CMR collections' compatibility with titiler-cmr, I ran into this error:
  File "/home/jovyan/titiler-cmr-compatibility/titiler_cmr/titiler/cmr/backend.py", line 294, in _reader
    with self.reader(
         ^^^^^^^^^^^^
TypeError: Reader.__init__() got an unexpected keyword argument 's3_credentials'
As background, I am trying to test the tiling capability in titiler-cmr without hitting the API endpoint itself. This is primarily to remove the network call to speed up testing more datasets. Using the code directly also enables me to test using EDL credentials (in theory) so the assignment of "compatible" or "not compatible" has to do with the dataset and the tiling code itself, not having to do with bucket permissions.
So the code I am running on the VEDA JupyterHub to test tiling looks approximately like this:
# AuthSettings in local instance of titiler-cmr are `strategy=environment` and `access=direct`
from titiler_cmr.titiler.cmr.backend import CMRBackend
from titiler.xarray.io import Reader as XarrayReader
auth = earthaccess.login()
# adding for reproducibility, exact values shouldn't matter
concept_id = "C2033151148-GES_DISC"
temporal_extent = ('2007-06-22T03:00:00.000Z', '2007-06-22T03:00:00.000Z')
query = {
    "concept_id": concept_id,
    "temporal": temporal_extent,
}
with CMRBackend(
    reader=XarrayReader,
    auth=auth,
    reader_options={
        "variable": variable,
    },
) as src_dst:
    image, _ = src_dst.tile(
        x,
        y,
        z,
        cmr_query=query,
    )I think what has happened is that in migrating from a custom reader in titiler-cmr to using titiler.xarray.io.Reader we lost some of the parameters we were previously using in instantiating the reader, such as s3_credentials. I could be totally off base as this change was made a while ago, but looking at the files changed in PR #40 I see we exchanged the custom ZarrReader, which accepted s3_credentials, with from titiler.xarray.io import Reader as XarrayReader and titiler.xarray.io.Reader does not accept s3_credentials.
We do still have the capability to pass s3_credentials to the intended opener which is titiler-cmr's own xarray_open_dataset so I think all that is needed is the ability to pass those credentials through the titiler.xarray.io.Reader initiation.
Let me know if you think this assessment is correct @hrodmn @jbusecke