diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..95911c4f --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,60 @@ + + + + +
Pull Request (PR) draft checklist - click to expand + +- [ ] Please review our + [contributing documentation](https://earthaccess.readthedocs.io/en/latest/contributing/) + before getting started. +- [ ] Ensure an issue exists representing the problem being solved in this PR. +- [ ] Populate a descriptive title. For example, instead of "Updated README.md", use a + title such as "Add testing details to the contributor section of the README". +- [ ] Populate the body of the pull request with: + - A clear description of the change you are proposing. + - Links to any issues resolved by this PR with text in the PR description, for + example `closes #1`. See + [GitHub docs - Linking a pull request to an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue). +- [ ] Update `CHANGELOG.md` with details about your change in a section titled + `## Unreleased`. If such a section does not exist, please create one. Follow + [Common Changelog](https://common-changelog.org/) for your additions. +- [ ] Update the documentation and/or the `README.md` with details of changes to the + earthaccess interface, if any. Consider new environment variables, function names, + decorators, etc. + +Click the "Ready for review" button at the bottom of the "Conversation" tab in GitHub +once these requirements are fulfilled. Don't worry if you see any test failures in +GitHub at this point! + +
+ +
Pull Request (PR) merge checklist - click to expand + +Please do your best to complete these requirements! If you need help with any of these +requirements, you can ping the `@nsidc/earthaccess-support` team in a comment and we +will help you out! + +- [ ] Add unit tests for any new features. +- [ ] Apply formatting and linting autofixes. You can add a GitHub comment in this Pull + Request containing "pre-commit.ci autofix" to automate this. +- [ ] Ensure all automated PR checks (seen at the bottom of the "conversation" tab) pass. +- [ ] Get at least one approving review. + +
diff --git a/CHANGELOG.md b/CHANGELOG.md index c5ee95ac..882538ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,248 +1,344 @@ # Changelog -## [Unreleased] +## Unreleased ### Changed -* Use `yamlfmt` instead of `prettier` for YAML formatting - ([#555](https://github.com/nsidc/earthaccess/issues/555)) -* Replace `print` calls with `logging` calls where appropriate, and add T20 Ruff - rule to produce lint errors for usages of `print` +- Perform YAML formatting with `yamlfmt` instead of + `prettier` ([#555](https://github.com/nsidc/earthaccess/issues/555)) + ([**@chuckwondo**](https://github.com/chuckwondo),[**@mfisher87**](https://github.com/mfisher87)) +- Replace `print` calls with `logging` calls where appropriate and add T20 Ruff rule ([#511](https://github.com/nsidc/earthaccess/issues/511)) + ([**@botanical**](https://github.com/botanical),[**@chuckwondo**](https://github.com/chuckwondo), + [**@mfisher87**](https://github.com/mfisher87)) +- Update `CHANGELOG.md` to follow Common Changelog conventions + ([#584](https://github.com/nsidc/earthaccess/pull/584)) + ([**@danielfromearth**](https://github.com/danielfromearth),[**@chuckwondo**](https://github.com/chuckwondo), + [**@jhkennedy**](https://github.com/jhkennedy),[**@mfisher87**](https://github.com/mfisher87)) ### Added -* Enable queries to Earthdata User Acceptance Testing (UAT) system for - authenticated accounts +- Enable queries to Earthdata User Acceptance Testing (UAT) system for authenticated accounts ([#421](https://github.com/nsidc/earthaccess/issues/421)) -* Add support for Python 3.12 + ([**@danielfromearth**](https://github.com/danielfromearth),[**@mfisher87**](https://github.com/mfisher87), + [**@jhkennedy**](https://github.com/jhkennedy),[**@chuckwondo**](https://github.com/chuckwondo), + [**@betolink**](https://github.com/betolink)) +- Add support for Python 3.12 ([#457](https://github.com/nsidc/earthaccess/issues/457)) + ([**@chuckwondo**](https://github.com/chuckwondo),[**@mfisher87**](https://github.com/mfisher87)) ### Removed -* **Breaking:** Remove support for Python 3.8 +- **Breaking:** Remove support for Python 3.8 ([#457](https://github.com/nsidc/earthaccess/issues/457)) -* **Breaking:** Remove the `get_user_profile` method and the `email_address` and - `profile` attributes from the `Auth` class. Calling the EDL API to get user - profile information is not intended for library access and is not necessary - for this library's intended use cases. - ([#421](https://github.com/nsidc/earthaccess/issues/421)) + ([**@mfisher87**](https://github.com/mfisher87),[**@chuckwondo**](https://github.com/chuckwondo)) +- **Breaking:** Remove the + `get_user_profile` method and the `email_address` and `profile` attributes + from the `Auth` class. Calling the EDL API to get user profile information + is not intended for library access and is not necessary for this library's + intended use cases. ([#421](https://github.com/nsidc/earthaccess/issues/421)) + ([**@danielfromearth**](https://github.com/danielfromearth),[**@mfisher87**](https://github.com/mfisher87), + [**@jhkennedy**](https://github.com/jhkennedy),[**@chuckwondo**](https://github.com/chuckwondo), + [**@betolink**](https://github.com/betolink)) + +### Fixed + +- Use [Search After](https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#search-after) + for collection and granule searches to support deep-paging through large result sets + ([#483](https://github.com/nsidc/earthaccess/issues/483)) + ([**@doug-newman-nasa**](https://github.com/doug-newman-nasa),[**@chuckwondo**](https://github.com/chuckwondo), + [**@mfisher87**](https://github.com/mfisher87),[**@betolink**](https://github.com/betolink)) +- Correct and enhance static type hints for functions and methods that make CMR queries + or handle CMR query results ([#508](https://github.com/nsidc/earthaccess/issues/508)) + ([**@mfisher87**](https://github.com/mfisher87),[**@jhkennedy**](https://github.com/jhkennedy), + [**@chuckwondo**](https://github.com/chuckwondo),[**@betolink**](https://github.com/betolink)) +- Create destination path prior to direct S3 downloads, if it doesn't already + exist ([#562](https://github.com/nsidc/earthaccess/issues/562)) + ([**@itcarroll**](https://github.com/itcarroll),[**@mfisher87**](https://github.com/mfisher87), + [**@chuckwondo**](https://github.com/chuckwondo)) +-Fix broken image link in sea level rise tutorial + (([#427](https://github.com/nsidc/earthaccess/issues/427))([**@jbrownrs**](https://github.com/jbrownrs)) + +## [0.9.0] - 2024-02-28 + +### Added + +- Improve search by adding instrument and project to collection queries + ([#427](https://github.com/nsidc/earthaccess/issues/427)) + ([**@betolink**](https://github.com/betolink),[**@mfisher87**](https://github.com/mfisher87), + [**@jhkennedy**](https://github.com/jhkennedy)) +- Add user-agent in the request to track usage ([#436](https://github.com/nsidc/earthaccess/issues/436)) + ([**@asteiker**](https://github.com/asteiker),[**@@mikedorfman**](https://github.com/@mikedorfman), + [**@betolink**](https://github.com/betolink)) + +### Fixed + +- Implement more trusted domains in the SessionWithRedirection ([#439](https://github.com/nsidc/earthaccess/issues/439))([**@cmspeed**](https://github.com/cmspeed), [**@mfisher87**](https://github.com/mfisher87), [**@betolink**](https://github.com/betolink), [**@jhkennedy**](https://github.com/jhkennedy)) +- Use an authenticated session for hits() instead of calling parent's class super() ([#438](https://github.com/nsidc/earthaccess/issues/438))([**@betolink**](https://github.com/betolink), [**@mfisher87**](https://github.com/mfisher87), [**@jhkennedy**](https://github.com/jhkennedy)) + +## [0.8.2] - 2023-12-06 + +### Changed + +- Update poetry lockfile ([#403](https://github.com/nsidc/earthaccess/pull/403))([**@jrbourbeau**](https://github.com/jrbourbeau)) +- Use YAML formatting (prettier) ([#398](https://github.com/nsidc/earthaccess/pull/398))([**@jrbourbeau**](https://github.com/jrbourbeau)) + +### Added + +- Add CI tests with minimum supported versions ([#402](https://github.com/nsidc/earthaccess/pull/402))([**@jrbourbeau**](https://github.com/jrbourbeau), [**@mfisher87**](https://github.com/mfisher87), [**@jhkennedy**](https://github.com/jhkennedy)) +- Add `python-dateutil` as a direct dependency ([#397](https://github.com/nsidc/earthaccess/pull/397))([**@jrbourbeau**](https://github.com/jrbourbeau)) + +### Removed + +- Remove binder PR comments ([#400](https://github.com/nsidc/earthaccess/pull/400))([**@jrbourbeau**](https://github.com/jrbourbeau)) + +### Fixed + +- Enable AWS check with IMDSv2 ([#391](https://github.com/nsidc/earthaccess/pull/391))([**@jrbourbeau**](https://github.com/jrbourbeau), [**@mfisher87**](https://github.com/mfisher87), [**@itcarroll**](https://github.com/itcarroll)) +- Add region to running in AWS check ([#395](https://github.com/nsidc/earthaccess/pull/395))([**@jrbourbeau**](https://github.com/jrbourbeau), [**@betolink**](https://github.com/betolink)) +- Handle opening multi-file granules ([#394](https://github.com/nsidc/earthaccess/pull/394))([**@jrbourbeau**](https://github.com/jrbourbeau), [**@betolink**](https://github.com/betolink)) + +## [0.8.1] - 2023-12-01 + +### Changed + +- Handle S3 credential expiration more gracefully ([#354](https://github.com/nsidc/earthaccess/pull/354))([**@jrbourbeau**](https://github.com/jrbourbeau), [**@mfisher87**](https://github.com/mfisher87)) +- Use dependabot to update GitHub Actions ([#373](https://github.com/nsidc/earthaccess/pull/373))([**@jhkennedy**](https://github.com/jhkennedy)) +- Consolidate dependabot updates ([#380](https://github.com/nsidc/earthaccess/pull/380))([**@mfisher87**](https://github.com/mfisher87)) +- Switch to `ruff` for formatting ([#372](https://github.com/nsidc/earthaccess/pull/372))([**@jrbourbeau**](https://github.com/jrbourbeau), [**@mfisher87**](https://github.com/mfisher87)) + +### Added + +- Add `kerchunk` metadata consolidation utility ([#278](https://github.com/nsidc/earthaccess/pull/278)) + ([**@jrbourbeau**](https://github.com/jrbourbeau), [**@mfisher87**](https://github.com/mfisher87), + [**@betolink**](https://github.com/betolink), [**@martindurant**](https://github.com/martindurant), + [**lsterzinger**](https://github.com/lsterzinger), [**mrocklin**](https://github.com/mrocklin)) + +## [0.8.0] - 2023-11-29 + +### Changed + +- earthaccess will `raise` errors instead of `print`ing them in more cases ([#351](https://github.com/nsidc/earthaccess/pull/351))([**@jrbourbeau**](https://github.com/jrbourbeau)) +- `daac` and `provider` parameters are now normalized to uppercase, since lowercase + characters are never valid ([#355](https://github.com/nsidc/earthaccess/pull/355))([**@jrbourbeau**](https://github.com/jrbourbeau), [**@mfisher87**](https://github.com/mfisher87)) +- Allow single file URL inputs for `earthaccess.download` ([#347](https://github.com/nsidc/earthaccess/pull/347))([**@jrbourbeau**](https://github.com/jrbourbeau), [**@mfisher87**](https://github.com/mfisher87)) + +### Fixed + +- Fix zero granules being reported for restricted datasets ([#358](https://github.com/nsidc/earthaccess/pull/358))([**@danielfromearth**](https://github.com/danielfromearth)) + +## [0.7.1] - 2023-11-08 ### Fixed -* Use - [Search After](https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#search-after) - for collection and granule searches to support deep-paging through large - result sets ([#483](https://github.com/nsidc/earthaccess/issues/483)) -* Correct and enhance static type hints for functions and methods that make CMR - queries or handle CMR query results - ([#508](https://github.com/nsidc/earthaccess/issues/508)) -* Create destination directory prior to direct S3 downloads, if it doesn't - already exist ([#562](https://github.com/nsidc/earthaccess/issues/562)) - -## [v0.9.0] 2024-02-28 - -* Bug fixes: - * fixed #439 by implementing more trusted domains in the SessionWithRedirection - * fixed #438 by using an authenticated session for hits() -* Enhancements: - * addressing #427 by adding parameters to collection query - * added user-agent in the request to track usage, closes #436 - -## [v0.8.2] 2023-12-06 - -* Bug fixes: - * Enable AWS check with IMDSv2 - * Add region to running in AWS check - * Handle opening multi-file granules -* Maintenance: - * Add CI tests with minimum supported versions - * Update poetry lockfile - * Add `python-dateutil` as a direct dependency - * Remove binder PR comments - * Add YAML formatting (prettier) - -## [v0.8.1] 2023-12-01 - -* New Features: - * Add `kerchunk` metadata consolidation utility. -* Enhancements: - * Handle S3 credential expiration more gracefully. -* Maintenanece: - * Use dependabot to update Github Actions. - * Consolidate dependabot updates. - * Switch to `ruff` for formatting. - -## [v0.8.0] 2023-11-29 - -* Bug fixes: - * Fix zero granules being reported for restricted datasets. -* Enhancements: - * earthaccess will `raise` errors instead of `print`ing them in more cases. - * `daac` and `provider` parameters are now normalized to uppercase, since lowercase - characters are never valid. - -## [v0.7.1] 2023-11-08 - -* Bug Fixes: - * Treat granules without `RelatedUrls` as not cloud-hosted. - -## [v0.7.0] 2023-10-31 - -* Bug Fixes: - * Fix spelling mistake in `access` variable assignment (`direc` -> `direct`) - in `earthaccess.store._get_granules`. - * Pass `threads` arg to `_open_urls_https` in - `earthaccess.store._open_urls`, replacing the hard-coded value of 8. - * Return S3 data links by default when in region. -* Enhancements: - * `earthaccess.download` now accepts a single granule as input in addition to a list of granules. - * `earthaccess.download` now returns fully qualified local file paths. -* New Features: - * Earthaccess will now automatically search for Earthdata authentication. ``earthaccess.login()`` +- Treat granules without `RelatedUrls` as not cloud-hosted ([#339](https://github.com/nsidc/earthaccess/pull/339))([**@mfisher87**](https://github.com/mfisher87)) + +## [0.7.0] - 2023-10-31 + +### Changed + +- `earthaccess.download` now accepts a single granule as input in addition to a list of granules ([#317](https://github.com/nsidc/earthaccess/pull/317))([**@jrbourbeau**](https://github.com/jrbourbeau)) +- `earthaccess.download` now returns fully qualified local file paths ([#317](https://github.com/nsidc/earthaccess/pull/317))([**@jrbourbeau**](https://github.com/jrbourbeau)) + +### Added + +- Earthaccess will now automatically search for Earthdata authentication. ``earthaccess.login()`` still works as before, but is no longer required if you have a ``~/.netrc`` file for have set - ``EARTHDATA_USERNAME`` and ``EARTHDATA_PASSWORD`` environment variables. - * Add `earthaccess.auth_environ()` utility for getting Earthdata authentication environment variables. + ``EARTHDATA_USERNAME`` and ``EARTHDATA_PASSWORD`` environment variables ([#300](https://github.com/nsidc/earthaccess/pull/300))([**@jrbourbeau**](https://github.com/jrbourbeau), [**@mfisher87**](https://github.com/mfisher87), [**@mfisher87**](https://github.com/mfisher87)) +- Add `earthaccess.auth_environ()` utility for getting Earthdata authentication environment variables ([#316](https://github.com/nsidc/earthaccess/pull/316))([**@jrbourbeau**](https://github.com/jrbourbeau), [**@mfisher87**](https://github.com/mfisher87)) -## [v0.6.0] 2023-09-20 - -* bug fixes: - * earthaccess.search_datasets() and earthaccess.search_data() can find restricted datasets #296 - * distributed serialization fixed for EarthAccessFile #301 and #276 -* new features: - * earthaccess.get_s3fs_session() can use the results to find the right set of S3 credentials +### Fixed -## [v0.5.3] 2023-08-01 +- Fix spelling mistake in `access` variable assignment (`direc` -> `direct`) + in `earthaccess.store._get_granules` ([#308](https://github.com/nsidc/earthaccess/pull/308))([**@trey-stafford**](https://github.com/trey-stafford)) +- Pass `threads` arg to `_open_urls_https` in + `earthaccess.store._open_urls`, replacing the hard-coded value of 8 ([#308](https://github.com/nsidc/earthaccess/pull/308))([**@trey-stafford**](https://github.com/trey-stafford)) +- Return S3 data links by default when in region ([#318](https://github.com/nsidc/earthaccess/pull/318))([**@jrbourbeau**](https://github.com/jrbourbeau), [**@mfisher87**](https://github.com/mfisher87), [**@jhkennedy**](https://github.com/jhkennedy)) -* bug fixes: - * granule's size() returned zero - * Added exception handling for fsspec sessions, thanks to @jrbourbeau -* CI changes: - * integration tests are now only run when we push to main (after a merge) - * unit tests run for any branch and opened PR +## [0.6.0] - 2023-09-20 -## [v0.5.2] 2023-04-21 +### Added -* bug fixes: - * Fixing #230 by removing Benedict as the dict handler, thanks to @psarka! - * S3 credential endpoints are tried with tokens and basic auth until all the DAACs accept the same auth +- `earthaccess.get_s3fs_session()` can use the results to find the right set of S3 credentials ([#296](https://github.com/nsidc/earthaccess/pull/296))([**@betolink**](https://github.com/betolink)) -* Core dependencies: - * Removed Benedict as the default dict for JSON coming from CMR. +### Fixed -## [v0.5.1] 2023-03-20 +- `earthaccess.search_datasets()` and `earthaccess.search_data()` can find restricted datasets ([#296](https://github.com/nsidc/earthaccess/pull/296))([**@betolink**](https://github.com/betolink)) +- Fix distributed serialization for EarthAccessFile ([#301](https://github.com/nsidc/earthaccess/pull/301))([**@jrbourbeau**](https://github.com/jrbourbeau)) and ([#276](https://github.com/nsidc/earthaccess/pull/276))([**@jrbourbeau**](https://github.com/jrbourbeau), [**@betolink**](https://github.com/betolink)) -* bug fixes: - * get_s3_credentials() only worked when a netrc file was present, bug reported by @scottyhq and @JessicaS11 - * including tests for all DAAC S3 endpoints - * Notebooks updated to use the new top level API - * removed magic from dependencies (not available in windows and not used but just in tests) +## [0.5.3] - 2023-08-01 -* CI changes: - * documentation for readthedocs fixed by including poetry as the default tool - * injected new secrets to test Auth using the icepyx convention (EARTHDATA_USERNAME) -* New Features - * we can get the user's profile with auth.user_profile which includes the user email - * added LAAD as a supported DAAC +### Added -## [v0.5.0] 2023-02-23 +- Add download from onprem how-to ([#265](https://github.com/nsidc/earthaccess/pull/265))([**@andypbarrett**](https://github.com/andypbarrett)) -* bug fixes: - * @JessicaS11 fixed a bug where the Auth class was invoked without the proper parameters - * if a user specifies the netrc strategy and there is no netrc an exception is raised - * S3 URLs broke the Store class when opened outside AWS - * Opening files using URLs was not working properly on AWS, thanks to @amfriesz for reporting it! -* CI changes: - * documentation is now only built for the main, dev and documentation branches - * notebooks are executed every time the documentation gets published! -* New features: - * we can now use the top level API to get S3 credentials, authenticated fsspec and requests sessions! - * ASF direct access for Sentinel1 products is now available +### Changed -## [v0.4.7] 2022-12-11 +- For CI, integration tests are now only run when we push to main (after a merge) ([#267](https://github.com/nsidc/earthaccess/pull/267))([**@betolink**](https://github.com/betolink)) +- For CI, unit tests are run for any branch and opened PR ([#267](https://github.com/nsidc/earthaccess/pull/267))([**@betolink**](https://github.com/betolink)) +- Update example in `search_datasets` ([#247](https://github.com/nsidc/earthaccess/pull/247))([**@jrbourbeau**](https://github.com/jrbourbeau)) +- Improve remote cluster performance ([#259](https://github.com/nsidc/earthaccess/pull/259))([**@jrbourbeau**](https://github.com/jrbourbeau), [**@mrocklin**](https://github.com/mrocklin), [**@mfisher87**](https://github.com/mfisher87)) +- Return useful error message for failed download ([#263](https://github.com/nsidc/earthaccess/pull/263))([**@andypbarrett**](https://github.com/andypbarrett)) -* bug fixes: - * fixed open() for direct access - * python-magic is a test dependency so moved to the dev section. - * Minor edits in the README +### Fixed -## [v0.4.6] 2022-12-08 +- Granule's size() returned zero ([#267](https://github.com/nsidc/earthaccess/pull/267))([**@betolink**](https://github.com/betolink)) +- Add exception handling for fsspec sessions, thanks to @jrbourbeau ([#249](https://github.com/nsidc/earthaccess/pull/249))([**@jrbourbeau**](https://github.com/jrbourbeau)) -* Features: - * search collections by DOI - * new API documentation and simplified notation to access data -* CI changes: - * only run the publish workflow after a release on github +## [0.5.2] - 2023-04-21 -## [v0.4.1] 2022-11-02 +### Removed -* improved documentation: - * reimplemented python_cmr methods for docstring compatibility - * added types to method signatures -* Using `CMR-Search-After` see #145 +- Remove Benedict (core dependency) as the default dict for JSON coming from CMR ([#229](https://github.com/nsidc/earthaccess/pull/229), [#230](https://github.com/nsidc/earthaccess/issues/230))([**@psarka**](https://github.com/psarka)) -* CI changes: - * Poetry is installed using the new script - * Dependabot alerts to monthly +### Fixed -* Added GES_DISC S3 endpoint +- S3 credential endpoints are tried with tokens and basic auth until all the DAACs accept the same auth ([#234](https://github.com/nsidc/earthaccess/pull/234))([**@betolink**](https://github.com/betolink)) -## [v0.4.0] 2022-08-17 +## [0.5.1] - 2023-03-20 -* `store` - * uses fsspec s3fs for in cloud access and https sessions for out of region access - * we can open files with fsspec in and out of region (stream into xarray) -* `auth` - * we can persist our credentials into a `.netrc` file +### Changed -* Documentation - * added store, auth to docs and updated mkdocs config +- For CI, documentation for readthedocs fixed by including poetry as the default tool ([#214](https://github.com/nsidc/earthaccess/pull/214))([**@betolink**](https://github.com/betolink)) +- For CI, injected new secrets to test Auth using the icepyx convention (EARTHDATA_USERNAME) ([#214](https://github.com/nsidc/earthaccess/pull/214))([**@JessicaS11**](https://github.com/JessicaS11), [**@betolink**](https://github.com/betolink)) -## [v0.3.0] 2022-04-28 +### Added -* Fixed bug with CMR tokens -* dropped python 3.7 support -* updated python-cmr to NASA fork -* added documentation for readthedocs and github -* verifying git tag and poetry version are the same before publish to pypi -* Auth can refresh CMR tokens -* Dropped unused `pydantic` dependency -* Added missing `python-datutil` dependency +- Add ability to get the user's profile with auth.user_profile which includes the user email ([#214](https://github.com/nsidc/earthaccess/pull/214))([**@betolink**](https://github.com/betolink)) +- Add LAAD as a supported DAAC ([#214](https://github.com/nsidc/earthaccess/pull/214))([**@betolink**](https://github.com/betolink)) -## [v0.2.2] 2022-03-23 +### Removed -* Bug fixes to store to download multi-file granules +- Remove magic from dependencies (not available in windows and not used but just in tests) ([#214](https://github.com/nsidc/earthaccess/pull/214))([**@betolink**](https://github.com/betolink)) -* Fix granule formatting +### Fixed + +- `get_s3_credentials()` only worked when a netrc file was present, bug reported by @scottyhq and @JessicaS11 ([#214](https://github.com/nsidc/earthaccess/pull/214))([**@betolink**](https://github.com/betolink), [**@JessicaS11**](https://github.com/JessicaS11), [**@scottyhq**](https://github.com/scottyhq)) +- Include tests for all DAAC S3 endpoints ([#214](https://github.com/nsidc/earthaccess/pull/214))([**@betolink**](https://github.com/betolink)) +- Update notebooks to use the new top level API ([#214](https://github.com/nsidc/earthaccess/pull/214))([**@betolink**](https://github.com/betolink)) + +## [0.5.0] - 2023-02-23 + +### Changed + +- For CI, documentation is now only built for the main, dev and documentation branches ([#202](https://github.com/nsidc/earthaccess/pull/202))([**@betolink**](https://github.com/betolink)) +- For CI, notebooks are executed every time the documentation gets published! ([#202](https://github.com/nsidc/earthaccess/pull/202))([**@betolink**](https://github.com/betolink), [**@asteiker**](https://github.com/asteiker)) + +### Added + +- Add ability to use the top level API to get S3 credentials, authenticated fsspec and requests sessions! ([#202](https://github.com/nsidc/earthaccess/pull/202))([**@betolink**](https://github.com/betolink)) +- Make available ASF direct access for Sentinel1 products ([#202](https://github.com/nsidc/earthaccess/pull/202))([**@betolink**](https://github.com/betolink)) + +### Fixed + +- Fix a bug where the Auth class is invoked without the proper parameters ([#202](https://github.com/nsidc/earthaccess/pull/202))([**@JessicaS11**](https://github.com/JessicaS11)) +- Raise and exception if a user specifies the netrc strategy and there is no netrc ([#202](https://github.com/nsidc/earthaccess/pull/202))([**@betolink**](https://github.com/betolink)) +- S3 URLs broke the Store class when opened outside AWS ([#202](https://github.com/nsidc/earthaccess/pull/202))([**@betolink**](https://github.com/betolink)) +- Opening files using URLs was not working properly on AWS, thanks to @amfriesz for reporting it! ([#202](https://github.com/nsidc/earthaccess/pull/202))([**@betolink**](https://github.com/betolink), ([**@amfriesz**](https://github.com/amfriesz))) + +## [0.4.7] - 2022-12-11 + +### Fixed + +- Fix open() for direct access ([#186](https://github.com/nsidc/earthaccess/pull/186))([**@betolink**](https://github.com/betolink)) +- Move python-magic to the dev section because it is a test dependency ([#186](https://github.com/nsidc/earthaccess/pull/186))([**@betolink**](https://github.com/betolink)) +- Make minor edits in the README ([#186](https://github.com/nsidc/earthaccess/pull/186))([**@betolink**](https://github.com/betolink)) + +## [0.4.6] - 2022-12-08 + +### Changed + +- For CI, only run the publish workflow after a release on GitHub ([#183](https://github.com/nsidc/earthaccess/pull/183))([**@betolink**](https://github.com/betolink)) + +### Added + +- Add feature to search collections by DOI ([#183](https://github.com/nsidc/earthaccess/pull/183))([**@betolink**](https://github.com/betolink)) +- Add new API documentation and simplify notation to access data ([#183](https://github.com/nsidc/earthaccess/pull/183)) ([**@jroebuck932**](https://github.com/jroebuck932)) -## [v0.2.1] 2022-03-19 +## [0.4.1] - 2022-11-02 + +### Changed + +- For CI, install Poetry using the new script ([#131](https://github.com/nsidc/earthaccess/pull/131)) ([**@betolink**](https://github.com/betolink)) +- For CI, change dependabot alerts to monthly ([#131](https://github.com/nsidc/earthaccess/pull/131)) ([**@betolink**](https://github.com/betolink)) +- Improve documentation by reimplementing python_cmr methods for docstring compatibility ([#131](https://github.com/nsidc/earthaccess/pull/131)) ([**@betolink**](https://github.com/betolink)) +- Use `CMR-Search-After` see #145 ([#131](https://github.com/nsidc/earthaccess/pull/131)) ([**@betolink**](https://github.com/betolink)) + +### Added -* Renamed Accessor to Store +- Add GES_DISC S3 endpoint ([#131](https://github.com/nsidc/earthaccess/pull/131)) ([**@betolink**](https://github.com/betolink)) +- Improve documentation by adding types to method signatures ([#131](https://github.com/nsidc/earthaccess/pull/131)) ([**@betolink**](https://github.com/betolink)) -* relaxed dependency requirements -* Store can download plain links if they are on prem +## [0.4.0] - 2022-08-17 -## [v0.1.0-beta.1] - 2021-09-21 +### Added + +- Add store, auth to docs and update mkdocs config ([#119](https://github.com/nsidc/earthaccess/pull/119))([**@betolink**](https://github.com/betolink)) +- For `auth`, add the ability to persist credentials into a `.netrc` file ([#119](https://github.com/nsidc/earthaccess/pull/119))([**@betolink**](https://github.com/betolink)) +- For `store`, use fsspec s3fs for in cloud access and https sessions for out of region access ([#43](https://github.com/nsidc/earthaccess/issues/43))([**@betolink**](https://github.com/betolink)) +- For `store`, can open files with fsspec in and out of region (stream into xarray) ([#41](https://github.com/nsidc/earthaccess/issues/41))([**@betolink**](https://github.com/betolink)) + +## [0.3.0] - 2022-04-28 + +### Changed + +- Update python-cmr to NASA fork ([#75](https://github.com/nsidc/earthaccess/pull/75))([**@jhkennedy**](https://github.com/jhkennedy)) +- Drop unused `pydantic` dependency ([`5761548`](https://github.com/nsidc/earthaccess/pull/75/commits/5761548fcd8ba8733ce4f5ff9b8ce7967c3a8398))([**@jhkennedy**](https://github.com/jhkennedy)) +- Auth can refresh CMR tokens ([#82](https://github.com/nsidc/earthaccess/pull/82))([**@betolink**](https://github.com/betolink)) +- Verify git tag and poetry version are the same before publishing to PyPI + +### Added + +- Add documentation for readthedocs and GitHub ([#82](https://github.com/nsidc/earthaccess/pull/82))([**@betolink**](https://github.com/betolink)) + +### Removed + +- **Breaking**: Drop python 3.7 support ([#82](https://github.com/nsidc/earthaccess/pull/82))([**@betolink**](https://github.com/betolink)) + +### Fixed + +- Fix bug with CMR tokens +- Add missing `python-datutil` dependency ([`747e992`](https://github.com/nsidc/earthaccess/pull/75/commits/747e9926a5ab83d75bbf7f17d4c52f24b563147b))([**@jhkennedy**](https://github.com/jhkennedy)) + +## [0.2.2] - 2022-03-23 + +### Fixed + +- Fix store to download multi-file granules ([#73](https://github.com/nsidc/earthaccess/pull/73))([**@betolink**](https://github.com/betolink)) +- Fix granule formatting ([#73](https://github.com/nsidc/earthaccess/pull/73))([**@betolink**](https://github.com/betolink)) + +## [0.2.1] - 2022-03-19 + +### Changed + +- Rename Accessor to Store ([`4bd618d`](https://github.com/nsidc/earthaccess/pull/66/commits/4bd618d4d48c3cd256a077fb8329f40df2d5b7ff))([**@betolink**](https://github.com/betolink)) +- Relax dependency requirements ([`c9a5ed6`](https://github.com/nsidc/earthaccess/pull/66/commits/c9a5ed6b917435e7c4ece58485939065fa71cc8f))([**@betolink**](https://github.com/betolink)) +- Store can download plain links if they are on prem ([`92d2919`](https://github.com/nsidc/earthaccess/commit/92d291962e5b72b458c2971eae8a6b813d4bae39))([**@betolink**](https://github.com/betolink)) + +## [0.1.0-beta.1] - 2021-09-21 + +_Conception!_ + +### Added -* Conception! -* Add basic classes to interact with NASA CMR, EDL and cloud access. -* Basic object formatting. +- Add basic classes to interact with NASA CMR, EDL and cloud access. +- Basic object formatting. [Unreleased]: https://github.com/nsidc/earthaccess/compare/v0.9.0...HEAD -[v0.8.2]: https://github.com/nsidc/earthaccess/releases/tag/v0.8.2 -[v0.8.1]: https://github.com/nsidc/earthaccess/releases/tag/v0.8.1 -[v0.8.0]: https://github.com/nsidc/earthaccess/releases/tag/v0.8.0 -[v0.7.1]: https://github.com/nsidc/earthaccess/releases/tag/v0.7.1 -[v0.7.0]: https://github.com/nsidc/earthaccess/releases/tag/v0.7.0 -[v0.6.0]: https://github.com/nsidc/earthaccess/releases/tag/v0.6.0 -[v0.5.3]: https://github.com/nsidc/earthaccess/releases/tag/v0.5.3 -[v0.5.2]: https://github.com/nsidc/earthaccess/releases/tag/v0.5.2 -[v0.5.1]: https://github.com/nsidc/earthaccess/releases/tag/v0.5.1 -[v0.5.0]: https://github.com/nsidc/earthaccess/releases/tag/v0.5.0 -[v0.4.7]: https://github.com/nsidc/earthaccess/releases/tag/v0.4.7 -[v0.4.6]: https://github.com/nsidc/earthaccess/releases/tag/v0.4.6 -[v0.4.1]: https://github.com/nsidc/earthaccess/releases/tag/v0.4.1 -[v0.3.0]: https://github.com/betolink/earthaccess/releases/tag/v0.3.0 -[v0.2.2]: https://github.com/betolink/earthaccess/releases/tag/v0.2.2 -[v0.2.1]: https://github.com/betolink/earthaccess/releases/tag/v0.2.1 -[v0.1.0-beta.1]: https://github.com/betolink/earthaccess/releases/tag/v0.1.0-beta.1 +[0.8.2]: https://github.com/nsidc/earthaccess/releases/tag/v0.8.2 +[0.8.1]: https://github.com/nsidc/earthaccess/releases/tag/v0.8.1 +[0.8.0]: https://github.com/nsidc/earthaccess/releases/tag/v0.8.0 +[0.7.1]: https://github.com/nsidc/earthaccess/releases/tag/v0.7.1 +[0.7.0]: https://github.com/nsidc/earthaccess/releases/tag/v0.7.0 +[0.6.0]: https://github.com/nsidc/earthaccess/releases/tag/v0.6.0 +[0.5.3]: https://github.com/nsidc/earthaccess/releases/tag/v0.5.3 +[0.5.2]: https://github.com/nsidc/earthaccess/releases/tag/v0.5.2 +[0.5.1]: https://github.com/nsidc/earthaccess/releases/tag/v0.5.1 +[0.5.0]: https://github.com/nsidc/earthaccess/releases/tag/v0.5.0 +[0.4.7]: https://github.com/nsidc/earthaccess/releases/tag/v0.4.7 +[0.4.6]: https://github.com/nsidc/earthaccess/releases/tag/v0.4.6 +[0.4.1]: https://github.com/nsidc/earthaccess/releases/tag/v0.4.1 +[0.3.0]: https://github.com/betolink/earthaccess/releases/tag/v0.3.0 +[0.2.2]: https://github.com/betolink/earthaccess/releases/tag/v0.2.2 +[0.2.1]: https://github.com/betolink/earthaccess/releases/tag/v0.2.1 +[0.1.0-beta.1]: https://github.com/betolink/earthaccess/releases/tag/v0.1.0-beta.1 diff --git a/docs/contributing/index.md b/docs/contributing/index.md index 3d149637..a8b9f624 100644 --- a/docs/contributing/index.md +++ b/docs/contributing/index.md @@ -19,7 +19,7 @@ Please note that we have a [code of conduct](./code-of-conduct.md). Please follo From here, you might want to fix and issue or bug, or add a new feature. Jump to the relevant section to proceed. -### ...to fix an issue or bug +### Fixing an Issue or Bug - Create a GitHub issue with a [minimal reproducible example](https://en.wikipedia.org/wiki/Minimal_reproducible_example), @@ -33,7 +33,7 @@ relevant section to proceed. Once you've completed these steps, you are ready to submit your contribution. -### ...to contribute a new feature +### Contributing a New Feature - Create an issue and discuss the feature's scope and its fit for this package with the team - Create a branch for your new feature in your fork @@ -43,6 +43,28 @@ Once you've completed these steps, you are ready to submit your contribution. Once you've completed these steps, you are ready to submit your contribution. + +### Contributing to Documentation + +#### Documentation Style + +To ensure that our code is well-documented and easy to understand, we use [Google-style docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) to document all functions, classes, and methods in this library. + +#### Locally rendering the documentation + +To work on documentation locally, we provide a script that will automatically re-render the docs when you make changes: + +``` +./scripts/docs-live.sh +``` + +If you encounter any issues while setting up the documentation using the provided steps, please refer to our [tutorial]( https://www.youtube.com/watch?v=mNjlMZ4F3So) for additional guidance. + +##### Caveats and considerations + +Our mkdocs setup has a known limitation: the hot reloader won't auto-reload when changing docstrings. To see updates, manually rebuild and re-serve docs. We're working to improve the developer experience and appreciate your patience. + + ## Submitting your contribution - Run all unit tests successfully in your branch @@ -53,34 +75,23 @@ Once you've completed these steps, you are ready to submit your contribution. ### Please format and lint as you go -```bash -make format lint -``` -We attempt to provide comprehensive type annotations within this repository. If -you do not provide fully annotated functions or methods, the `lint` command will -fail. Over time, we plan to increase type-checking strictness in order to -ensure more precise, beneficial type annotations. +#### Usage of Pre-Commit + +To maintain code quality, we use pre-commit for automated checks before committing changes. Install and configure pre-commit to ensure high-quality contributions. + +To set up pre-commit, follow these steps: -We have included type stubs for the untyped `python-cmr` library, which we -intend to eventually upstream. Since `python-cmr` exposes the `cmr` package, -the stubs appear under `stubs/cmr`. +- `pip install pre-commit` ([official installation docs](https://pre-commit.com/#install)) +- `pre-commit install` to enable it to run automatically +- `pre-commit run -a` to run it manually -### Requirements to merge code (Pull Request Process) -- you must include test coverage -- you must update the documentation -- you must format and lint +We have included type stubs for the untyped `python-cmr` library, which we intend to eventually upstream. Since `python-cmr` exposes the `cmr` package, the stubs appear under `stubs/cmr`. ## Pull Request process -1. Ensure you include test coverage for all changes -1. Ensure your code is formatted properly following this document -1. Update the documentation and the `README.md` with details of changes to the - interface, this includes new environment variables, function names, - decorators, etc. -1. Update `CHANGELOG.md` with details about your change in a section titled - `Unreleased`. If one does not exist, please create one. -1. You may merge the Pull Request once you have the sign-off of another - developer, or if you do not have permission to do that, you may request the - reviewer to merge it for you. +Fork the repository using the "Fork" button on the [repository +homepage](https://github.com/nsidc/earthaccess), create a branch with your changes in the fork, then open +a draft pull request from your fork. Starting a pull request provides additional instructions and requirements, and +there is no harm in starting a draft pull request while still developing. diff --git a/docs/contributing/maintainers-guide.md b/docs/contributing/maintainers-guide.md index 1ac2fc79..2d54a354 100644 --- a/docs/contributing/maintainers-guide.md +++ b/docs/contributing/maintainers-guide.md @@ -53,6 +53,3 @@ The GitHub Actions CI services handle the project's building, testing, and manag ## Continuous Documentation [ReadTheDocs](https://readthedocs.org/projects/earthaccess/) is used to generate and host [our documentation website](https://earthaccess.readthedocs.io/) as well as the preview for documentation changes made in pull requests. This service uses a configuration file in the root of the project, `.readthedocs.yml`. - - - diff --git a/docs/tutorials/SSL.ipynb b/docs/tutorials/SSL.ipynb index 75182d4b..265f1fd7 100644 --- a/docs/tutorials/SSL.ipynb +++ b/docs/tutorials/SSL.ipynb @@ -10,7 +10,7 @@ "\n", "### This notebook is entirely based on Jinbo Wang's [tutorial](https://github.com/betolink/the-coding-club/blob/main/notebooks/Earthdata_webinar_20220727.ipynb)\n", "\n", - "\n", + "\"Sea\n", "\n", "--- \n", "\n", @@ -157,11 +157,11 @@ " * not fully tested with Dask distributed\n", "* Data is gridded\n", " * xarray works better with homogeneous coordinates, working with swath data will be cumbersome.\n", - "* Data is chunked using reasonable large sizes(1MB or more)\n", + "* Data is chunked using reasonable large sizes (1MB or more)\n", " * If our files are chunked in small pieces the access time will be orders of magnitude bigger than just downloading the data and accessing it locally.\n", " \n", - "Opening a year of SSH (SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL1812) data (1.1 GB approx) can take up to 5 minutes streaming the data out of region(not in AWS)\n", - "The reason for this is not that the data transfer is order of magintude slower but due the client libraries not fetching data concurrently and the metadata of the files in HDF is usually not consolidated like in Zaar, hence h5netcdf has to issue a lot of requests to get the info it needs.\n", + "Opening a year of SSH (SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL1812) data (1.1 GB approx) can take up to 5 minutes streaming the data out of region (not in AWS)\n", + "The reason for this is not that the data transfer is order of magnitude slower but due the client libraries not fetching data concurrently and the metadata of the files in HDF is usually not consolidated like in Zaar, hence h5netcdf has to issue a lot of requests to get the info it needs.\n", "\n", "> Note: we are looping through each year and getting the metadata for the first granule in May" ] @@ -195,7 +195,7 @@ "id": "8b63ca2f-c94c-4d4a-a620-a086ee66137f", "metadata": {}, "source": [ - "### What `earthaccess.open()` do?\n", + "### What does `earthaccess.open()` do?\n", "\n", "`earthaccess.open()` takes a list of results from `earthaccess.search_data()` or a list of URLs and creates a list of Python File-like objects that can be used in our code as if the remote files were local. When executed in AWS the file system used is [S3FS](https://github.com/fsspec/s3fs) when we open files outside of AWS we get a regular HTTPS file session. \n" ] diff --git a/earthaccess/api.py b/earthaccess/api.py index 8522dbbb..0418d69f 100644 --- a/earthaccess/api.py +++ b/earthaccess/api.py @@ -68,7 +68,9 @@ def search_datasets(count: int = -1, **kwargs: Any) -> List[DataCollection]: ``` """ if not validate.valid_dataset_parameters(**kwargs): - logger.warn("A valid set of parameters is needed to search for datasets on CMR") + logger.warning( + "A valid set of parameters is needed to search for datasets on CMR" + ) return [] if earthaccess.__auth__.authenticated: query = DataCollections(auth=earthaccess.__auth__).parameters(**kwargs) diff --git a/earthaccess/store.py b/earthaccess/store.py index 147e6ce8..f3b1054c 100644 --- a/earthaccess/store.py +++ b/earthaccess/store.py @@ -113,7 +113,7 @@ def __init__(self, auth: Any, pre_authorize: bool = False) -> None: self.set_requests_session(url) else: - logger.warn("The current session is not authenticated with NASA") + logger.warning("The current session is not authenticated with NASA") self.auth = None self.in_region = self._running_in_us_west_2() diff --git a/pyproject.toml b/pyproject.toml index 0e15f45d..316a4ac7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -144,8 +144,8 @@ line-length = 88 src = ["earthaccess", "stubs", "tests"] [tool.ruff.lint] -extend-select = ["I", "T20", "D"] -ignore = ["D1", "D205", "D401", "D417"] +extend-select = ["I", "T20", "D", "G"] +ignore = ["D1", "D205", "D401", "D417", "G004"] [tool.ruff.lint.pydocstyle] convention = "google" diff --git a/scripts/integration-test.sh b/scripts/integration-test.sh index 2d55064f..7a7b6551 100755 --- a/scripts/integration-test.sh +++ b/scripts/integration-test.sh @@ -1,7 +1,18 @@ #!/usr/bin/env bash -set -e set -x +pytest tests/integration --cov=earthaccess --cov=tests/integration --cov-report=term-missing ${@} --capture=no --tb=native --log-cli-level=INFO +RET=$? +set +x + +set -e +# NOTE: 99 is a special return code we selected for this case, it has no other meaning. +if [[ $RET == 99 ]]; then + echo -e "\e[0;31mWARNING: The integration test suite has been permitted to return 0 because the failure rate was less than a hardcoded threshold.\e[0m" + echo "For more details, see conftest.py." + exit 0 +elif [[ $RET != 0 ]]; then + exit $RET +fi -pytest --cov=earthaccess --cov=tests/integration --cov-report=term-missing ${@} -s --tb=native --log-cli-level=INFO bash ./scripts/lint.sh diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 8be3de59..c2d4a3c2 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -5,8 +5,27 @@ @pytest.hookimpl() def pytest_sessionfinish(session, exitstatus): - if exitstatus == 0: + """Return exit code 99 if up to N% of tests have failed. + + N = ACCEPTABLE_FAILURE_RATE + + 99 was chosen arbitrarily to avoid conflict with current and future pytest error + codes (https://docs.pytest.org/en/stable/reference/exit-codes.html), and avoid + other exit codes with special meanings + (https://tldp.org/LDP/abs/html/exitcodes.html). + + IMPORTANT: This is calculated against every test collected in the session, so the + ratio will change depending on which tests are executed! E.g. executing integration + tests and unit tests at the same time allows more tests to fail than executing + integration tests alone. + """ + if exitstatus != pytest.ExitCode.TESTS_FAILED: + # Exit status 1 in PyTest indicates "Tests were collected and run but some of + # the tests failed". In all other cases, for example "an internal error happened + # while executing the tests", or "test execution interrupted by the user", we + # want to defer to original pytest behavior. return + failure_rate = (100.0 * session.testsfailed) / session.testscollected if failure_rate <= ACCEPTABLE_FAILURE_RATE: - session.exitstatus = 0 + session.exitstatus = 99