Skip to content

Commit

Permalink
Merge pull request #302 from asfadmin/master
Browse files Browse the repository at this point in the history
Release V7.1.2
  • Loading branch information
SpicyGarlicAlbacoreRoll authored May 31, 2024
2 parents 38c974a + 1df1e65 commit 36e07f9
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-
-->
------
## [v7.1.2](https://github.com/asfadmin/Discovery-asf_search/compare/v7.1.1...v7.1.2)
### Fixed
- `OPERAS1Product` subclass now properly assigned to PGE v2.0.1 results
### Changed
- `ARIAS1GUNWProduct.is_ARIAS1GUNWProduct()` removed, replaced with `ASFProduct._is_subclass()` implementation

------
## [v7.1.1](https://github.com/asfadmin/Discovery-asf_search/compare/v7.1.0...v7.1.1)
### Changed
Expand Down
11 changes: 11 additions & 0 deletions asf_search/ASFProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,3 +424,14 @@ def umm_cast(f, v):
return f(v)
except TypeError:
return None

@staticmethod
def _is_subclass(item: Dict) -> bool:
"""
Used to determine which subclass to use for specific edge-cases when parsing results in search methods
(Currently implemented for ARIA and OPERA subclasses).
params:
- item (dict): the CMR UMM-G item to read from
"""
raise NotImplementedError()
2 changes: 1 addition & 1 deletion asf_search/Products/ARIAS1GUNWProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_default_baseline_product_type() -> None:
return None

@staticmethod
def is_ARIAS1GUNWProduct(item: Dict) -> bool:
def _is_subclass(item: Dict) -> bool:
platform = ASFProduct.umm_get(item['umm'], 'Platforms', 0, 'ShortName')
if platform in ['SENTINEL-1A', 'SENTINEL-1B']:
asf_platform = ASFProduct.umm_get(item['umm'], 'AdditionalAttributes', ('Name', 'ASF_PLATFORM'), 'Values', 0)
Expand Down
9 changes: 9 additions & 0 deletions asf_search/Products/OPERAS1Product.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class OPERAS1Product(S1Product):
'polarization': {'path': ['AdditionalAttributes', ('Name', 'POLARIZATION'), 'Values']} # dual polarization is in list rather than a 'VV+VH' style format
}

_subclass_concept_ids = { 'C1257995185-ASF', 'C1257995186-ASF', 'C1258354200-ASF', 'C1258354201-ASF', 'C1259974840-ASF', 'C1259976861-ASF', 'C1259981910-ASF', 'C1259982010-ASF', 'C2777436413-ASF', 'C2777443834-ASF', 'C2795135174-ASF', 'C2795135668-ASF','C1260721853-ASF', 'C1260721945-ASF', 'C2803501097-ASF', 'C2803501758-ASF' }

def __init__(self, args: Dict = {}, session: ASFSession = ASFSession()):
super().__init__(args, session)

Expand Down Expand Up @@ -78,3 +80,10 @@ def get_sort_keys(self) -> Tuple[str, str]:
return (self._read_property('validityStartDate', ''), keys[1])

return keys

@staticmethod
def _is_subclass(item: Dict) -> bool:
# not all umm products have this field set,
# but when it's available it's convenient for fast matching
concept_id = item['meta'].get('collection-concept-id')
return concept_id in OPERAS1Product._subclass_concept_ids
2 changes: 1 addition & 1 deletion asf_search/search/baseline_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def stack_from_product(
stack.sort(key=lambda product: product.properties['temporalBaseline'])

for warning in warnings:
ASF_LOGGER.warn(f'{warning}')
ASF_LOGGER.warning(f'{warning}')

return stack

Expand Down
9 changes: 6 additions & 3 deletions asf_search/search/search_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ def as_ASFProduct(item: Dict, session: ASFSession) -> ASFProduct:
:returns the granule as an object of type ASFProduct
"""
if ASFProductType.OPERAS1Product._is_subclass(item):
return ASFProductType.OPERAS1Product(item, session=session)

product_type_key = _get_product_type_key(item)

# if there's a direct entry in our dataset to product type dict
Expand All @@ -283,7 +286,7 @@ def as_ASFProduct(item: Dict, session: ASFSession) -> ASFProduct:

# If the platform exists, try to match it
platform = _get_platform(item=item)
if ASFProductType.ARIAS1GUNWProduct.is_ARIAS1GUNWProduct(item=item):
if ASFProductType.ARIAS1GUNWProduct._is_subclass(item=item):
return dataset_to_product_types.get('ARIA S1 GUNW')(item, session=session)
elif (subclass := dataset_to_product_types.get(platform)) is not None:
return subclass(item, session=session)
Expand All @@ -306,10 +309,10 @@ def _get_product_type_key(item: Dict) -> str:
collection_shortName = ASFProduct.umm_get(item['umm'], 'CollectionReference', 'ShortName')

if collection_shortName is None:
platform = _get_platform(item=item)
if ASFProductType.ARIAS1GUNWProduct.is_ARIAS1GUNWProduct(item=item):
if ASFProductType.ARIAS1GUNWProduct._is_subclass(item=item):
return 'ARIA S1 GUNW'

platform = _get_platform(item=item)
return platform

return collection_shortName
Expand Down

0 comments on commit 36e07f9

Please sign in to comment.