icesat2py / icepyx

Python tools for obtaining and working with ICESat-2 data
https://icepyx.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
207 stars 106 forks source link

v0.6.4 release #386

Closed JessicaS11 closed 1 year ago

review-notebook-app[bot] commented 1 year ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

github-actions[bot] commented 1 year ago

Binder :point_left: Launch a binder notebook on this branch for commit 4015a3dacec54687c77e3c526011d4759cfc134f

I will automatically update this comment whenever this PR is modified

Binder :point_left: Launch a binder notebook on this branch for commit 66201bd8e74e9609941b60acc9e4193116d72fe2

codecov-commenter commented 1 year ago

Codecov Report

Base: 54.70% // Head: 57.57% // Increases project coverage by +2.87% :tada:

Coverage data is based on head (4015a3d) compared to base (b46e673). Patch coverage: 87.22% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #386 +/- ## ========================================== + Coverage 54.70% 57.57% +2.87% ========================================== Files 31 31 Lines 2053 2251 +198 Branches 424 433 +9 ========================================== + Hits 1123 1296 +173 - Misses 859 872 +13 - Partials 71 83 +12 ``` | [Impacted Files](https://codecov.io/gh/icesat2py/icepyx/pull/386?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py) | Coverage Δ | | |---|---|---| | [icepyx/core/validate\_inputs.py](https://codecov.io/gh/icesat2py/icepyx/pull/386/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py#diff-aWNlcHl4L2NvcmUvdmFsaWRhdGVfaW5wdXRzLnB5) | `77.64% <ø> (-3.38%)` | :arrow_down: | | [icepyx/tests/test\_behind\_NSIDC\_API\_login.py](https://codecov.io/gh/icesat2py/icepyx/pull/386/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py#diff-aWNlcHl4L3Rlc3RzL3Rlc3RfYmVoaW5kX05TSURDX0FQSV9sb2dpbi5weQ==) | `0.00% <0.00%> (ø)` | | | [icepyx/tests/test\_query.py](https://codecov.io/gh/icesat2py/icepyx/pull/386/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py#diff-aWNlcHl4L3Rlc3RzL3Rlc3RfcXVlcnkucHk=) | `100.00% <ø> (ø)` | | | [icepyx/tests/test\_validate\_inputs.py](https://codecov.io/gh/icesat2py/icepyx/pull/386/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py#diff-aWNlcHl4L3Rlc3RzL3Rlc3RfdmFsaWRhdGVfaW5wdXRzLnB5) | `100.00% <ø> (ø)` | | | [icepyx/core/visualization.py](https://codecov.io/gh/icesat2py/icepyx/pull/386/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py#diff-aWNlcHl4L2NvcmUvdmlzdWFsaXphdGlvbi5weQ==) | `63.09% <50.00%> (ø)` | | | [icepyx/core/granules.py](https://codecov.io/gh/icesat2py/icepyx/pull/386/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py#diff-aWNlcHl4L2NvcmUvZ3JhbnVsZXMucHk=) | `38.86% <58.33%> (+0.81%)` | :arrow_up: | | [icepyx/core/query.py](https://codecov.io/gh/icesat2py/icepyx/pull/386/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py#diff-aWNlcHl4L2NvcmUvcXVlcnkucHk=) | `50.21% <64.28%> (+0.21%)` | :arrow_up: | | [icepyx/core/spatial.py](https://codecov.io/gh/icesat2py/icepyx/pull/386/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py#diff-aWNlcHl4L2NvcmUvc3BhdGlhbC5weQ==) | `75.48% <75.48%> (ø)` | | | [icepyx/core/APIformatting.py](https://codecov.io/gh/icesat2py/icepyx/pull/386/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py#diff-aWNlcHl4L2NvcmUvQVBJZm9ybWF0dGluZy5weQ==) | `75.73% <100.00%> (+0.09%)` | :arrow_up: | | [icepyx/tests/test\_APIformatting.py](https://codecov.io/gh/icesat2py/icepyx/pull/386/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py#diff-aWNlcHl4L3Rlc3RzL3Rlc3RfQVBJZm9ybWF0dGluZy5weQ==) | `97.01% <100.00%> (-0.49%)` | :arrow_down: | | ... and [1 more](https://codecov.io/gh/icesat2py/icepyx/pull/386/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py) | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=icesat2py)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

weiji14 commented 1 year ago

Maybe check what's up with the failed tests at https://app.travis-ci.com/github/icesat2py/icepyx/jobs/587007195#L2828-L2829 before releasing. Could push it to next week :slightly_smiling_face:

=================================== FAILURES ===================================
________________________ test_get_custom_options_output ________________________

session = <requests.sessions.Session object at 0x7fa207175c10>

    def test_get_custom_options_output(session):
        obs = is2ref._get_custom_options(session, "ATL06", "004")
>       with open("ATL06v04_options.json") as exp_json:
E       FileNotFoundError: [Errno 2] No such file or directory: 'ATL06v04_options.json'

icepyx/tests/test_behind_NSIDC_API_login.py:43: FileNotFoundError
____________________ test_download_granules_with_subsetting ____________________

reg = <icepyx.core.query.Query object at 0x7fa20602b450>
session = <requests.sessions.Session object at 0x7fa207175c10>

    def test_download_granules_with_subsetting(reg, session):
        path = "./downloads_subset"
        reg._session = session
>       reg.order_granules()

icepyx/tests/test_behind_NSIDC_API_login.py:54: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
icepyx/core/query.py:1073: in order_granules
    geom_filepath=self._spatial._geom_file,
icepyx/core/granules.py:323: in place_order
    self.get_avail(CMRparams, reqparams)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <icepyx.core.granules.Granules object at 0x7fa2058a9690>
CMRparams = {'bounding_box': '-55.0,68.0,-48.0,71.0', 'short_name': 'ATL06', 'temporal': '2019-02-22T00:00:00Z,2019-02-28T23:59:59Z', 'version': '004'}
reqparams = {'client_string': 'icepyx', 'include_meta': 'Y', 'page_num': 0, 'page_size': 2000, ...}
cloud = False

    def get_avail(self, CMRparams, reqparams, cloud=False):
        """
        Get a list of available granules for the query object's parameters.
        Generates the `avail` attribute of the granules object.

        Parameters
        ----------
        CMRparams : dictionary
            Dictionary of properly formatted CMR search parameters.
        reqparams : dictionary
            Dictionary of properly formatted parameters required for searching, ordering,
            or downloading from NSIDC.
        cloud : boolean, default False
            Whether or not you want data available in the cloud (versus on premises).

        Notes
        -----
        This function is used by query.Query.avail_granules(), which automatically
        feeds in the required parameters.

        See Also
        --------
        APIformatting.Parameters
        query.Query.avail_granules
        """

        assert (
            CMRparams is not None and reqparams is not None
        ), "Missing required input parameter dictionaries"

        # if not hasattr(self, 'avail'):
        self.avail = []

        granule_search_url = "https://cmr.earthdata.nasa.gov/search/granules"

        headers = {"Accept": "application/json", "Client-Id": "icepyx"}
        # note we should also check for errors whenever we ping NSIDC-API - make a function to check for errors

        if cloud:
            prov_flag = "NSIDC_CPRD"
        else:
            prov_flag = "NSIDC_ECS"

        params = apifmt.combine_params(
            CMRparams, {k: reqparams[k] for k in ["page_size"]}, {"provider": prov_flag}
        )

        cmr_search_after = None

        while True:
            if cmr_search_after is not None:
                headers["CMR-Search-After"] = cmr_search_after

            response = requests.get(
                granule_search_url,
                headers=headers,
                params=apifmt.to_string(params),
            )

            try:
                cmr_search_after = response.headers["CMR-Search-After"]
            except KeyError:
                cmr_search_after = None

            try:
                response.raise_for_status()
            except requests.HTTPError as e:
                if (
                    b"errors" in response.content
                ):  # If CMR returns a bad status with extra information, display that
                    raise icepyx.core.exceptions.NsidcQueryError(
                        response.json()["errors"]
                    )  # exception chaining will display original exception too
                else:  # If no 'errors' key, just reraise original exception
                    raise e

            results = json.loads(response.content)
            if not results["feed"]["entry"]:
                assert len(self.avail) == int(
                    response.headers["CMR-Hits"]
                ), "Search failure - unexpected number of results"
                break

            # Collect results
            self.avail.extend(results["feed"]["entry"])

        assert (
            len(self.avail) > 0
>       ), "Your search returned no results; try different search parameters"
E       AssertionError: Your search returned no results; try different search parameters

icepyx/core/granules.py:260: AssertionError
JessicaS11 commented 1 year ago
icepyx/tests/test_behind_NSIDC_API_login.py:43: FileNotFoundError

Not sure why the file can't be found, though the test would fail anyway because...

E       AssertionError: Your search returned no results; try different search parameters

version 004 is no longer available. @sjh1024 was planning to work on this (#330), but didn't get to it before the semester started and is now trying to finish up her thesis.

EDIT: I've completed #330 with #387.

JessicaS11 commented 1 year ago

@weiji14 We're all set!