diff --git a/icepyx/quest/quest.py b/icepyx/quest/quest.py index 19150b3fe..c54e49b73 100644 --- a/icepyx/quest/quest.py +++ b/icepyx/quest/quest.py @@ -131,13 +131,18 @@ def search_all(self): for i in self.datasets.values(): print() - if isinstance(i, Query): - print("---ICESat-2---") - msg = i.avail_granules() - print(msg) - else: - print(i) - i.search_data() + try: + # querying ICESat-2 data + if isinstance(i, Query): + print("---ICESat-2---") + msg = i.avail_granules() + print(msg) + else: # querying all other data sets + print(i) + i.search_data() + except: + dataset_name = type(i).__name__ + print("Error querying data from {0}".format(dataset_name)) # error handling? what happens when one of i fails... def download_all(self, path=""): @@ -155,25 +160,3 @@ def download_all(self, path=""): print(i) # DEVNOTE: see colocated data branch and phyto team files for code that expands quest functionality - - -# Todo: remove this later -- just here for debugging -if __name__ == "__main__": - bounding_box = [-150, 30, -120, 60] - date_range = ["2022-06-07", "2022-06-14"] - my_quest = Quest(spatial_extent=bounding_box, date_range=date_range) - # print(my_quest.spatial) - # print(my_quest.temporal) - - # my_quest.add_argo(params=["down_irradiance412", "temperature"]) - # print(my_quest.datasets["argo"].params) - - my_quest.add_icesat2(product="ATL06") - # print(my_quest.datasets["icesat2"].product) - - print(my_quest) - - my_quest.search_all() - - # this one still needs work for IS2 because of auth... - my_quest.download_all() diff --git a/icepyx/tests/test_quest.py b/icepyx/tests/test_quest.py index 46fdb94c9..043ee159e 100644 --- a/icepyx/tests/test_quest.py +++ b/icepyx/tests/test_quest.py @@ -45,6 +45,26 @@ def test_add_is2(quest_instance): # assert type(obs[exp_key]) == exp_type # assert quest_instance.datasets[exp_key].params == params +# def test_add_multiple_datasets(): +# bounding_box = [-150, 30, -120, 60] +# date_range = ["2022-06-07", "2022-06-14"] +# my_quest = Quest(spatial_extent=bounding_box, date_range=date_range) +# +# # print(my_quest.spatial) +# # print(my_quest.temporal) +# +# # my_quest.add_argo(params=["down_irradiance412", "temperature"]) +# # print(my_quest.datasets["argo"].params) +# +# my_quest.add_icesat2(product="ATL06") +# # print(my_quest.datasets["icesat2"].product) +# +# print(my_quest) +# +# # my_quest.search_all() +# # +# # # this one still needs work for IS2 because of auth... +# # my_quest.download_all() ########## ALL DATASET METHODS TESTS ##########