fraymio / modis-tools

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

Ds 5469 additional file formats #31

Closed iamchrisearle closed 1 year ago

iamchrisearle commented 1 year ago

Description

Whitelist additional file extension in granule handler. Allows for netcdf and h5 files to be downloaded in addition to hdf and xml. File extensions are validated on get_url_from_ganule method. We may want to do away with extension validation all together, but this expands product use without opening the system too wide without knowing potential consequences. This will deprecate the ParamType as a tuple is now used to check file extensions.

Closes https://github.com/fraymio/modis-tools/issues/30 and https://github.com/fraymio/modis-tools/issues/8

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

These will fail on main with No matching link error.

Attempt again in this branch with the same changes above, .nc and .h5 files will download.

Checklist:

Next Steps

On behalf of the Modis Tools Dev Team, thank you for your hard work! ✨

MohammadJavadSoltani commented 1 year ago

Thank you so much for your kindness and precious time. It worked out perfectly.

iamchrisearle commented 1 year ago

Agreed. Because we return on the first match in the loop in this function, the tuple here would essentially set a ranking of file preferences that the user still couldn't change in download_from_granules

@lmcindewar would it be preferable to download all files with any of the passed file extensions, instead of moving forward from the first match?

lmcindewar commented 1 year ago

Agreed. Because we return on the first match in the loop in this function, the tuple here would essentially set a ranking of file preferences that the user still couldn't change in download_from_granules

@lmcindewar would it be preferable to download all files with any of the passed file extensions, instead of moving forward from the first match?

I think that might change the behavior of the function enough to cause issues, or at least download a lot of extra files. I do think the logic for choosing which link to download could use some improvement