diff --git a/asf_search/search/search.py b/asf_search/search/search.py index bf7b0529..c2967d7e 100644 --- a/asf_search/search/search.py +++ b/asf_search/search/search.py @@ -12,6 +12,7 @@ def search( beamMode: Union[str, Iterable[str]] = None, beamSwath: Union[str, Iterable[str]] = None, campaign: Union[str, Iterable[str]] = None, + circle: Tuple[float, float, float] = None, maxDoppler: float = None, minDoppler: float = None, end: Union[datetime.datetime, str] = None, @@ -51,6 +52,7 @@ def search( :param beamMode: The beam mode used to acquire the data. :param beamSwath: Encompasses a look angle and beam mode. :param campaign: For UAVSAR and AIRSAR data collections only. Search by general location, site description, or data grouping as supplied by flight agency or project. + :param circle: Search by circle defined by list of three floats: [longitude, latitude, radius in meters] :param maxDoppler: Doppler provides an indication of how much the look direction deviates from the ideal perpendicular flight direction acquisition. :param minDoppler: Doppler provides an indication of how much the look direction deviates from the ideal perpendicular flight direction acquisition. :param end: End date of data acquisition. Supports timestamps as well as natural language such as "3 weeks ago" @@ -95,6 +97,9 @@ def search( results.searchComplete = page.searchComplete results.searchOptions = page.searchOptions + # Raise if they didn't get everything. If you're okay with partial + # results, use asf.search_generator directly + results.raise_if_incomplete() results.sort(key=lambda p: (p.properties['stopTime'], p.properties['fileID']), reverse=True) return results diff --git a/asf_search/search/search_generator.py b/asf_search/search/search_generator.py index b43de86e..d0dd2a22 100644 --- a/asf_search/search/search_generator.py +++ b/asf_search/search/search_generator.py @@ -27,6 +27,7 @@ def search_generator( beamMode: Union[str, Iterable[str]] = None, beamSwath: Union[str, Iterable[str]] = None, campaign: Union[str, Iterable[str]] = None, + circle: Tuple[float, float, float] = None, maxDoppler: float = None, minDoppler: float = None, end: Union[datetime.datetime, str] = None, @@ -94,7 +95,13 @@ def search_generator( logging.error(message) report_search_error(query, message) opts.session.headers.pop('CMR-Search-After', None) - raise + # If it's a CMRIncompleteError, we can just stop here and return what we have + # It's up to the user to call .raise_if_incomplete() if they're using the + # generator directly. + if type(exc) == CMRIncompleteError: + return + else: + raise opts.session.headers.update({'CMR-Search-After': cmr_search_after_header}) last_page = process_page(items, maxResults, subquery_max_results, total, subquery_count, opts)