| 1 | from typing import Sequence |
| 2 | from copy import copy |
| 3 | |
| 4 | from asf_search.search import search |
| 5 | from asf_search.ASFSearchOptions import ASFSearchOptions |
| 6 | from asf_search.ASFSearchResults import ASFSearchResults |
| 7 | |
| 8 | |
| 9 | def granule_search(granule_list: Sequence[str], opts: ASFSearchOptions = None) -> ASFSearchResults: |
| 10 | """ |
| 11 | Performs a granule name search using the ASF SearchAPI |
| 12 | |
| 13 | Parameters |
| 14 | ---------- |
| 15 | granule_list: |
| 16 | List of specific granules. |
| 17 | Search results may include several products per granule name. |
| 18 | opts: |
| 19 | An ASFSearchOptions object describing the search parameters to be used. |
| 20 | Search parameters specified outside this object will override in event of a conflict. |
| 21 | |
| 22 | Returns |
| 23 | ------- |
| 24 | `asf_search.ASFSearchResults` (list of search results of subclass ASFProduct) |
| 25 | """ |
| 26 | |
| 27 | opts = ASFSearchOptions() if opts is None else copy(opts) |
| 28 | |
| 29 | opts.merge_args(granule_list=granule_list) |
| 30 | |
| 31 | return search(opts=opts) |