Skip to content

Commit

Permalink
Merge pull request #276 from asfadmin/feature-nisar-dataset
Browse files Browse the repository at this point in the history
NISAR Dataset
  • Loading branch information
SpicyGarlicAlbacoreRoll authored Mar 4, 2024
2 parents 24bc97b + aaf673f commit 4ba56a8
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 16 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-
-->
------
## [v7.0.5](https://github.com/asfadmin/Discovery-asf_search/compare/v7.0.4...v7.0.5)
### Added
- Adds basic NISAR dataset search and product functionality for test data

------
## [v7.0.4](https://github.com/asfadmin/Discovery-asf_search/compare/v7.0.3...v7.0.4)
### Changed
Expand Down
132 changes: 118 additions & 14 deletions asf_search/CMR/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,46 @@


dataset_collections = {
"NISAR": {
"NISAR_UR_L0B_RRSD": ["C1258125097-ASFDEV", "C1258836794-ASF"],
"NISAR_UR_L1": ["C1258290319-ASFDEV", "C1258836797-ASF", "C1258290319-ASF"],
"NISAR_UR_L2": ["C1258301530-ASFDEV", "C1258836800-ASF"],
"NISAR_STUF": ["C1256535568-ASFDEV", "C1257349089-ASF", "C2727913056-ASF"],
"NISAR_OE": ["C1256574227-ASFDEV", "C1257349088-ASF", "C2727908375-ASF"],
"NISAR_RP": ["C1256579794-ASFDEV", "C1257349083-ASF", "C2727912431-ASF"],
"NISAR_COP": ["C1256535570-ASFDEV", "C1257349082-ASF", "C2727904608-ASF"],
"NISAR_ANTPAT": ["C1256583888-ASFDEV", "C1257349081-ASF", "C2727903976-ASF"],
"NISAR_BFPQ": ["C1257088418-ASFDEV", "C1257349079-ASF", "C2727904134-ASF"],
"NISAR_OROST": ["C1256578011-ASFDEV", "C1257349074-ASF", "C2727911748-ASF"],
"NISAR_TFDB": ["C1256583659-ASFDEV", "C1257349073-ASF", "C2727913362-ASF"],
"NISAR_LDF": ["C1256737727-ASFDEV", "C1257349072-ASF", "C2727907155-ASF"],
"NISAR_LRCLK": ["C1256729502-ASFDEV", "C1257349067-ASF", "C2727907520-ASF"],
"NISAR_L_CHAN_DATA": [
"C1256832018-ASFDEV",
"C1257349066-ASF",
"C2727908129-ASF",
],
"NISAR_SM_STATIC": ["C1256944038-ASFDEV", "C1257349065-ASF", "C2727912739-ASF"],
"NISAR_TEC": ["C1256802323-ASFDEV", "C1257349063-ASF", "C2727913160-ASF"],
"NISAR_DC_RADAR": ["C1256938783-ASFDEV", "C1257349059-ASF", "C2727904769-ASF"],
"NISAR_FT_WAVEFORM": [
"C1256621478-ASFDEV",
"C1257349054-ASF",
"C2727905298-ASF",
],
"NISAR_FT_PARAM": ["C1256622937-ASFDEV", "C1257349053-ASF", "C2727905020-ASF"],
"NISAR_LSAR_EXT_CAL": [
"C1256983900-ASFDEV",
"C1257349048-ASF",
"C2727904288-ASF",
],
"NISAR_LSAR_INT_CAL": [
"C1256984645-ASFDEV",
"C1257349023-ASF",
"C2727907902-ASF",
],
"NISAR_ANC_AUX": ["C1261630276-ASFDEV"],
},
"SENTINEL-1": {
"SENTINEL-1A_SLC": ["C1214470488-ASF", "C1205428742-ASF", "C1234413245-ASFDEV"],
"SENTINEL-1B_SLC": ["C1327985661-ASF", "C1216244348-ASF", "C1234413263-ASFDEV"],
Expand Down Expand Up @@ -230,7 +270,7 @@
"SENTINEL-1_INTERFEROGRAMS_UNWRAPPED_PHASE": [
"C1595765183-ASF",
"C1225776659-ASF",
]
],
},
"SMAP": {
"SPL1A_RO_METADATA_003": ["C1243122884-ASF", "C1233103964-ASF"],
Expand Down Expand Up @@ -735,6 +775,72 @@
"C1210599503-ASF",
"C1210599673-ASF",
],
"NISAR": [ # TEST ASFDEV
"C1258125097-ASFDEV",
"C1258290319-ASFDEV",
"C1258301530-ASFDEV",
"C1256535568-ASFDEV",
"C1256574227-ASFDEV",
"C1256579794-ASFDEV",
"C1256535570-ASFDEV",
"C1256583888-ASFDEV",
"C1257088418-ASFDEV",
"C1256578011-ASFDEV",
"C1256583659-ASFDEV",
"C1256737727-ASFDEV",
"C1256729502-ASFDEV",
"C1256832018-ASFDEV",
"C1256944038-ASFDEV",
"C1256802323-ASFDEV",
"C1256938783-ASFDEV",
"C1256621478-ASFDEV",
"C1256622937-ASFDEV",
"C1256983900-ASFDEV",
"C1256984645-ASFDEV",
"C1261630276-ASFDEV",
"C1258290319-ASFDEV",
# TEST
"C1258836794-ASF",
"C1258836797-ASF",
"C1258836800-ASF",
"C1257349089-ASF",
"C1257349088-ASF",
"C1257349083-ASF",
"C1257349082-ASF",
"C1257349081-ASF",
"C1257349079-ASF",
"C1257349074-ASF",
"C1257349073-ASF",
"C1257349072-ASF",
"C1257349067-ASF",
"C1257349066-ASF",
"C1257349065-ASF",
"C1257349063-ASF",
"C1257349059-ASF",
"C1257349054-ASF",
"C1257349053-ASF",
"C1257349048-ASF",
"C1257349023-ASF",
# PROD
"C2727913056-ASF",
"C2727908375-ASF",
"C2727912431-ASF",
"C2727904608-ASF",
"C2727903976-ASF",
"C2727904134-ASF",
"C2727911748-ASF",
"C2727913362-ASF",
"C2727907155-ASF",
"C2727907520-ASF",
"C2727908129-ASF",
"C2727912739-ASF",
"C2727913160-ASF",
"C2727904769-ASF",
"C2727905298-ASF",
"C2727905020-ASF",
"C2727904288-ASF",
"C2727907902-ASF",
],
}


Expand Down Expand Up @@ -896,14 +1002,8 @@
"C1595765183-ASF",
"C1225776659-ASF",
],
"CSLC-STATIC": [
"C1259982010-ASF",
"C2795135668-ASF"
],
"RTC-STATIC": [
"C1259981910-ASF",
"C2795135174-ASF"
],
"CSLC-STATIC": ["C1259982010-ASF", "C2795135668-ASF"],
"RTC-STATIC": ["C1259981910-ASF", "C2795135174-ASF"],
"GRD": [
"C1661710583-ASF",
"C1661710586-ASF",
Expand Down Expand Up @@ -1077,23 +1177,25 @@

#################### Helper Methods ####################


def get_concept_id_alias(param_list: List[str], collections_dict: dict) -> List[str]:
"""
param: param_list (List[str]): list of search values to alias
param: collections_dict (dict): The search value to concept-id dictionary to read from
returns List[str]: Returns a list of concept-ids that correspond to the given list of search values
If any of the search values are not keys in the collections_dict, this will instead returns an empty list.
If any of the search values are not keys in the collections_dict, this will instead returns an empty list.
"""
concept_id_aliases = []
for param in param_list:
if alias := collections_dict.get(param):
concept_id_aliases.extend(alias)
else:
return []

return concept_id_aliases


def get_dataset_concept_ids(datasets: List[str]) -> List[str]:
"""
Returns concept-ids for provided dataset(s)
Expand All @@ -1108,6 +1210,8 @@ def get_dataset_concept_ids(datasets: List[str]) -> List[str]:
for concept_ids in collections_by_short_name.values():
output.extend(concept_ids)
else:
raise ValueError(f'Could not find dataset named "{dataset}" provided for dataset keyword.')

return output
raise ValueError(
f'Could not find dataset named "{dataset}" provided for dataset keyword.'
)

return output
69 changes: 69 additions & 0 deletions asf_search/Products/NISARProduct.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
from typing import Dict, Union
from asf_search import ASFSearchOptions, ASFSession, ASFStackableProduct
from asf_search.CMR.translate import try_parse_float, try_parse_int, try_round_float
from asf_search.constants import PRODUCT_TYPE


class NISARProduct(ASFStackableProduct):
"""
Used for NISAR dataset products
ASF Dataset Documentation Page: https://asf.alaska.edu/nisar/
"""
_base_properties = {
'pgeVersion': {'path': ['PGEVersionClass', 'PGEVersion']}
}

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

accessUrls = []

if related_data_urls := self.umm_get(self.umm, 'RelatedUrls', ('Type', [('GET DATA', 'URL')]), 0):
accessUrls.extend(related_data_urls)
if related_metadata_urls := self.umm_get(self.umm, 'RelatedUrls', ('Type', [('EXTENDED METADATA', 'URL')]), 0):
accessUrls.extend(related_metadata_urls)

self.properties['additionalUrls'] = sorted([
url for url in list(set(accessUrls)) if not url.endswith('.md5')
and not url.startswith('s3://')
and 's3credentials' not in url
and not url.endswith('.png')
and url != self.properties['url']
])

if self.properties.get('groupID') is None:
self.properties['groupID'] = self.properties['sceneName']

@staticmethod
def get_default_baseline_product_type() -> Union[str, None]:
"""
Returns the product type to search for when building a baseline stack.
"""
return None

def is_valid_reference(self):
return False

def get_stack_opts(self, opts: ASFSearchOptions = None) -> ASFSearchOptions:
"""
Build search options that can be used to find an insar stack for this product
:return: ASFSearchOptions describing appropriate options for building a stack from this product
"""
return None

@staticmethod
def get_property_paths() -> Dict:
return {
**ASFStackableProduct.get_property_paths(),
**NISARProduct._base_properties
}

def get_sort_keys(self):
keys = super().get_sort_keys()

if keys[0] is None:
return (self.properties.get('processingDate', ''), keys[1])

return keys
1 change: 1 addition & 0 deletions asf_search/Products/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
from .S1BurstProduct import S1BurstProduct
from .OPERAS1Product import OPERAS1Product
from .ARIAS1GUNWProduct import ARIAS1GUNWProduct
from .NISARProduct import NISARProduct
3 changes: 2 additions & 1 deletion asf_search/constants/DATASET.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
ERS = 'ERS'
JERS_1 = 'JERS-1'
AIRSAR = 'AIRSAR'
SEASAT = 'SEASAT'
SEASAT = 'SEASAT'
NISAR = 'NISAR'
1 change: 1 addition & 0 deletions asf_search/constants/PLATFORM.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
SEASAT = 'SEASAT 1'
SMAP = 'SMAP'
UAVSAR = 'UAVSAR'
NISAR = 'NISAR'
4 changes: 3 additions & 1 deletion asf_search/search/search_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,5 +315,7 @@ def _get_product_type_key(item: Dict) -> str:
'DC-8': ASFProductType.AIRSARProduct,

'SEASAT': ASFProductType.SEASATProduct,
'SEASAT 1': ASFProductType.SEASATProduct
'SEASAT 1': ASFProductType.SEASATProduct,

'NISAR': ASFProductType.NISARProduct
}

0 comments on commit 4ba56a8

Please sign in to comment.