Closed JessicaS11 closed 1 year ago
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.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
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
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.
@weiji14 We're all set!
Check out this pull request on
See visual diffs & provide feedback on Jupyter Notebooks.
Powered by ReviewNB