fraymio / modis-tools

Tools for working with the MODIS API and MODIS data.
Apache License 2.0
23 stars 12 forks source link

Update authentication architecture to accommodate additional DAAC data sources #11

Open ShengpeiWang opened 2 years ago

ShengpeiWang commented 2 years ago

Is your feature request related to a problem? Please describe.

Given that all of the DAAC sources use the same login info, we might be able to expand modis-tools to download from many of the DAAC sources with minimal overhead. This is motivated by @jtanwk's and my work on on issue#3: https://github.com/fraymio/modis-tools/pull/9, we updated authentication checking to accommodate the downloading from NSIDC in addition to Land Processes data (LP DAAC). The changes we implemented were quick but specific to the two sources of data, and a more flexible approach would make our code both more powerful and more maintainable.

Describe the solution you'd like

Instead of a single function checking authentication status (modis_tools.auth.has_download_cookies), expand to have different authenticator classes to handle different DAAC sources.

Describe alternatives you've considered We currently use a try and except block to accommodate LP and NSIDC sources in modis_tools.auth.has_download_cookies, but this is a very rigid solution.

Additional context