Skip to content

Commit

Permalink
moves several common property fields to ASFProduct base class, adds s…
Browse files Browse the repository at this point in the history
…ubswath to OPERAS1Product class as well as some RTC specific fields
  • Loading branch information
kim committed Dec 19, 2023
1 parent 4329269 commit e08ddd8
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 70 deletions.
6 changes: 6 additions & 0 deletions asf_search/ASFProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ class ASFProduct:
'platform': {'path': [ 'AdditionalAttributes', ('Name', 'ASF_PLATFORM'), 'Values', 0]},
'bytes': {'path': [ 'AdditionalAttributes', ('Name', 'BYTES'), 'Values', 0], 'cast': try_round_float},
'md5sum': {'path': [ 'AdditionalAttributes', ('Name', 'MD5SUM'), 'Values', 0]},
'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0], 'cast': try_parse_int}, # overloaded by S1, ALOS, and ERS
'granuleType': {'path': [ 'AdditionalAttributes', ('Name', 'GRANULE_TYPE'), 'Values', 0]},
'orbit': {'path': [ 'OrbitCalculatedSpatialDomains', 0, 'OrbitNumber'], 'cast': try_parse_int},
'polarization': {'path': [ 'AdditionalAttributes', ('Name', 'POLARIZATION'), 'Values', 0]},
'processingDate': {'path': [ 'DataGranule', 'ProductionDateTime'], },
'sensor': {'path': [ 'Platforms', 0, 'Instruments', 0, 'ShortName'], },
}

def __init__(self, args: dict = {}, session: ASFSession = ASFSession()):
Expand Down
5 changes: 0 additions & 5 deletions asf_search/Products/AIRSARProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@
class AIRSARProduct(ASFProduct):
base_properties = {
'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0], 'cast': try_parse_int},
'granuleType': {'path': [ 'AdditionalAttributes', ('Name', 'GRANULE_TYPE'), 'Values', 0]},
'groupID': {'path': [ 'AdditionalAttributes', ('Name', 'GROUP_ID'), 'Values', 0]},
'insarStackId': {'path': [ 'AdditionalAttributes', ('Name', 'INSAR_STACK_ID'), 'Values', 0]},
'md5sum': {'path': [ 'AdditionalAttributes', ('Name', 'MD5SUM'), 'Values', 0]},
'offNadirAngle': {'path': [ 'AdditionalAttributes', ('Name', 'OFF_NADIR_ANGLE'), 'Values', 0], 'cast': try_parse_float},
'orbit': {'path': [ 'OrbitCalculatedSpatialDomains', 0, 'OrbitNumber'], 'cast': try_parse_int},
'polarization': {'path': [ 'AdditionalAttributes', ('Name', 'POLARIZATION'), 'Values', 0]},
'processingDate': {'path': [ 'DataGranule', 'ProductionDateTime']},
'sensor': {'path': [ 'Platforms', 0, 'Instruments', 0, 'ShortName']}
}

def __init__(self, args: dict = {}, session: ASFSession = ASFSession()):
Expand Down
5 changes: 0 additions & 5 deletions asf_search/Products/ALOSProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ class ALOSProduct(ASFProduct):
'faradayRotation': {'path': [ 'AdditionalAttributes', ('Name', 'FARADAY_ROTATION'), 'Values', 0], 'cast': try_parse_float},
'offNadirAngle': {'path': [ 'AdditionalAttributes', ('Name', 'OFF_NADIR_ANGLE'), 'Values', 0], 'cast': try_parse_float},
'bytes': {'path': [ 'AdditionalAttributes', ('Name', 'BYTES'), 'Values', 0], 'cast': try_round_float},
'granuleType': {'path': [ 'AdditionalAttributes', ('Name', 'GRANULE_TYPE'), 'Values', 0], },
'orbit': {'path': [ 'OrbitCalculatedSpatialDomains', 0, 'OrbitNumber'], 'cast': try_parse_int},
'polarization': {'path': [ 'AdditionalAttributes', ('Name', 'POLARIZATION'), 'Values', 0]},
'processingDate': {'path': [ 'DataGranule', 'ProductionDateTime'], },
'sensor': {'path': [ 'Platforms', 0, 'Instruments', 0, 'ShortName'], },
'insarStackId': {'path': [ 'AdditionalAttributes', ('Name', 'INSAR_STACK_ID'), 'Values', 0]},
}

Expand Down
12 changes: 2 additions & 10 deletions asf_search/Products/ERSProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,17 @@
class ERSProduct(ASFProduct):
base_properties = {
'bytes': {'path': [ 'AdditionalAttributes', ('Name', 'BYTES'), 'Values', 0], 'cast': try_round_float},
'esaFrame': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0], 'cast': try_parse_int},
'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'FRAME_NUMBER'), 'Values', 0], 'cast': try_parse_int},
'granuleType': {'path': [ 'AdditionalAttributes', ('Name', 'GRANULE_TYPE'), 'Values', 0]},
'esaFrame': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0]},
'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'FRAME_NUMBER'), 'Values', 0]},
'insarStackId': {'path': [ 'AdditionalAttributes', ('Name', 'INSAR_STACK_ID'), 'Values', 0]},
'md5sum': {'path': [ 'AdditionalAttributes', ('Name', 'MD5SUM'), 'Values', 0]},
'offNadirAngle': {'path': [ 'AdditionalAttributes', ('Name', 'OFF_NADIR_ANGLE'), 'Values', 0], 'cast': try_parse_float},
'orbit': {'path': [ 'OrbitCalculatedSpatialDomains', 0, 'OrbitNumber'], 'cast': try_parse_int},
'polarization': {'path': [ 'AdditionalAttributes', ('Name', 'POLARIZATION'), 'Values', 0]},
'processingDate': {'path': [ 'DataGranule', 'ProductionDateTime'], },
'sensor': {'path': [ 'Platforms', 0, 'Instruments', 0, 'ShortName'], },
'beamModeType': {'path': ['AdditionalAttributes', ('Name', 'BEAM_MODE_TYPE'), 'Values', 0]},
}

def __init__(self, args: dict = {}, session: ASFSession = ASFSession()):
super().__init__(args, session)
self.baseline = self.get_baseline_calc_properties()

self.properties['frameNumber'] = str(self.properties['frameNumber'])
self.properties['esaFrame'] = str(self.properties['esaFrame'])

def get_baseline_calc_properties(self) -> dict:
insarBaseline = umm_cast(float, umm_get(self.umm, 'AdditionalAttributes', ('Name', 'INSAR_BASELINE'), 'Values', 0))
Expand Down
6 changes: 0 additions & 6 deletions asf_search/Products/JERSProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@
class JERSProduct(ASFProduct):
base_properties = {
'browse': { 'path': ['RelatedUrls', ('Type', [('GET RELATED VISUALIZATION', 'URL')])]},
'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0], 'cast': try_parse_int},
'granuleType': {'path': [ 'AdditionalAttributes', ('Name', 'GRANULE_TYPE'), 'Values', 0]},
'groupID': {'path': [ 'AdditionalAttributes', ('Name', 'GROUP_ID'), 'Values', 0]},
'insarStackId': {'path': [ 'AdditionalAttributes', ('Name', 'INSAR_STACK_ID'), 'Values', 0]},
'md5sum': {'path': [ 'AdditionalAttributes', ('Name', 'MD5SUM'), 'Values', 0]},
'offNadirAngle': {'path': [ 'AdditionalAttributes', ('Name', 'OFF_NADIR_ANGLE'), 'Values', 0], 'cast': try_parse_float},
'orbit': {'path': [ 'OrbitCalculatedSpatialDomains', 0, 'OrbitNumber'], 'cast': try_parse_int},
'polarization': {'path': [ 'AdditionalAttributes', ('Name', 'POLARIZATION'), 'Values', 0]},
'processingDate': {'path': [ 'DataGranule', 'ProductionDateTime']},
'sensor': {'path': [ 'Platforms', 0, 'Instruments', 0, 'ShortName']},
'beamModeType': {'path': ['AdditionalAttributes', ('Name', 'BEAM_MODE_TYPE'), 'Values', 0]}
}

Expand Down
14 changes: 12 additions & 2 deletions asf_search/Products/OPERAS1Product.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class OPERAS1Product(S1Product):
'operaBurstID': {'path': ['AdditionalAttributes', ('Name', 'OPERA_BURST_ID'), 'Values', 0]},
'validityStartDate': {'path': ['TemporalExtent', 'SingleDateTime']},
'bytes': {'path': ['DataGranule', 'ArchiveAndDistributionInformation']},
'subswath': {'path': ['AdditionalAttributes', ('Name', 'SUBSWATH_NAME'), 'Values', 0]},
}

def __init__(self, args: dict = {}, session: ASFSession = ASFSession()):
Expand All @@ -30,10 +31,19 @@ def __init__(self, args: dict = {}, session: ASFSession = ASFSession()):
self.properties['operaBurstID'] = umm_get(self.umm, 'AdditionalAttributes', ('Name', 'OPERA_BURST_ID'), 'Values', 0)
self.properties['bytes'] = {entry['Name']: {'bytes': entry['SizeInBytes'], 'format': entry['Format']} for entry in self.properties['bytes']}

self.properties.pop('centerLat')
self.properties.pop('centerLon')
center = self.centroid()
self.properties['centerLat'] = center.y
self.properties['centerLon'] = center.x

self.properties.pop('frameNumber')

if (processingLevel := self.properties['processingLevel']) in ['RTC', 'RTC-STATIC']:
self.properties['bistaticDelayCorrection'] = umm_get(self.umm, 'AdditionalAttributes', ('Name', 'BISTATIC_DELAY_CORRECTION'), 'Values', 0)
if processingLevel == 'RTC':
self.properties['noiseCorrection'] = umm_get(self.umm, 'AdditionalAttributes', ('Name', 'NOISE_CORRECTION'), 'Values', 0)
self.properties['postProcessingFilter'] = umm_get(self.umm, 'AdditionalAttributes', ('Name', 'POST_PROCESSING_FILTER'), 'Values', 0)


def get_stack_opts(self):
return {}

Expand Down
6 changes: 0 additions & 6 deletions asf_search/Products/RadarsatProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ class RadarsatProduct(ASFProduct):
'faradayRotation': {'path': [ 'AdditionalAttributes', ('Name', 'FARADAY_ROTATION'), 'Values', 0], 'cast': try_parse_float},
'offNadirAngle': {'path': [ 'AdditionalAttributes', ('Name', 'OFF_NADIR_ANGLE'), 'Values', 0], 'cast': try_parse_float},
'insarStackId': {'path': [ 'AdditionalAttributes', ('Name', 'INSAR_STACK_ID'), 'Values', 0]},
'processingDate': {'path': [ 'DataGranule', 'ProductionDateTime'], },
'orbit': {'path': [ 'OrbitCalculatedSpatialDomains', 0, 'OrbitNumber'], 'cast': try_parse_int},
'polarization': {'path': [ 'AdditionalAttributes', ('Name', 'POLARIZATION'), 'Values', 0]},
'md5sum': {'path': [ 'AdditionalAttributes', ('Name', 'MD5SUM'), 'Values', 0]},
'sensor': {'path': [ 'Platforms', 0, 'Instruments', 0, 'ShortName'], },
'granuleType': {'path': [ 'AdditionalAttributes', ('Name', 'GRANULE_TYPE'), 'Values', 0]},
'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0], 'cast': try_parse_int},
'beamModeType': {'path': ['AdditionalAttributes', ('Name', 'BEAM_MODE_TYPE'), 'Values', 0]}
}

Expand Down
5 changes: 0 additions & 5 deletions asf_search/Products/S1Product.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@
class S1Product(ASFProduct):
base_properties = {
'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'FRAME_NUMBER'), 'Values', 0], 'cast': try_parse_int}, #Sentinel and ALOS product alt for frameNumber (ESA_FRAME)
'polarization': {'path': [ 'AdditionalAttributes', ('Name', 'POLARIZATION'), 'Values', 0]},
'granuleType': {'path': [ 'AdditionalAttributes', ('Name', 'GRANULE_TYPE'), 'Values', 0], },
'groupID': {'path': [ 'AdditionalAttributes', ('Name', 'GROUP_ID'), 'Values', 0], },
'md5sum': {'path': [ 'AdditionalAttributes', ('Name', 'MD5SUM'), 'Values', 0], },
'orbit': {'path': [ 'OrbitCalculatedSpatialDomains', 0, 'OrbitNumber'], 'cast': try_parse_int},
'pgeVersion': {'path': ['PGEVersionClass', 'PGEVersion'], },
'processingDate': {'path': [ 'DataGranule', 'ProductionDateTime'], },
'sensor': {'path': [ 'Platforms', 0, 'Instruments', 0, 'ShortName'], },
}

def __init__(self, args: dict = {}, session: ASFSession = ASFSession()):
Expand Down
6 changes: 0 additions & 6 deletions asf_search/Products/SEASATProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@
class SEASATProduct(ASFProduct):
base_properties = {
'bytes': {'path': [ 'AdditionalAttributes', ('Name', 'BYTES'), 'Values', 0], 'cast': try_round_float},
'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0], 'cast': try_parse_int},
'granuleType': {'path': [ 'AdditionalAttributes', ('Name', 'GRANULE_TYPE'), 'Values', 0]},
'insarStackId': {'path': [ 'AdditionalAttributes', ('Name', 'INSAR_STACK_ID'), 'Values', 0]},
'md5sum': {'path': [ 'AdditionalAttributes', ('Name', 'MD5SUM'), 'Values', 0]},
'offNadirAngle': {'path': [ 'AdditionalAttributes', ('Name', 'OFF_NADIR_ANGLE'), 'Values', 0], 'cast': try_parse_float},
'orbit': {'path': [ 'OrbitCalculatedSpatialDomains', 0, 'OrbitNumber'], 'cast': try_parse_int},
'polarization': {'path': [ 'AdditionalAttributes', ('Name', 'POLARIZATION'), 'Values', 0]},
'processingDate': {'path': [ 'DataGranule', 'ProductionDateTime']},
'sensor': {'path': [ 'Platforms', 0, 'Instruments', 0, 'ShortName']}
}

def __init__(self, args: dict = {}, session: ASFSession = ASFSession()):
Expand Down
7 changes: 0 additions & 7 deletions asf_search/Products/SIRCProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,10 @@

class SIRCProduct(ASFProduct):
base_properties = {
'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0], 'cast': try_parse_int},
'polarization': {'path': [ 'AdditionalAttributes', ('Name', 'POLARIZATION'), 'Values', 0]},
'granuleType': {'path': [ 'AdditionalAttributes', ('Name', 'GRANULE_TYPE'), 'Values', 0]},
'groupID': {'path': [ 'AdditionalAttributes', ('Name', 'GROUP_ID'), 'Values', 0]},
'md5sum': {'path': [ 'AdditionalAttributes', ('Name', 'MD5SUM'), 'Values', 0]},
'orbit': {'path': [ 'OrbitCalculatedSpatialDomains', 0, 'OrbitNumber'], 'cast': try_parse_int},
'pgeVersion': {'path': ['PGEVersionClass', 'PGEVersion'] },
'processingDate': {'path': [ 'DataGranule', 'ProductionDateTime']},
'sensor': {'path': [ 'Platforms', 0, 'Instruments', 0, 'ShortName']},
'beamModeType': {'path': ['AdditionalAttributes', ('Name', 'BEAM_MODE_TYPE'), 'Values', 0]},
'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0], 'cast': try_parse_int},
}

def __init__(self, args: dict = {}, session: ASFSession = ASFSession()):
Expand Down
6 changes: 0 additions & 6 deletions asf_search/Products/SMAPProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@

class SMAPProduct(ASFProduct):
base_properties = {
'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0], 'cast': try_parse_int},
'granuleType': {'path': [ 'AdditionalAttributes', ('Name', 'GRANULE_TYPE'), 'Values', 0]},
'groupID': {'path': [ 'AdditionalAttributes', ('Name', 'GROUP_ID'), 'Values', 0]},
'insarStackId': {'path': [ 'AdditionalAttributes', ('Name', 'INSAR_STACK_ID'), 'Values', 0]},
'md5sum': {'path': [ 'AdditionalAttributes', ('Name', 'MD5SUM'), 'Values', 0]},
'offNadirAngle': {'path': [ 'AdditionalAttributes', ('Name', 'OFF_NADIR_ANGLE'), 'Values', 0], 'cast': try_parse_float},
'orbit': {'path': [ 'OrbitCalculatedSpatialDomains', 0, 'OrbitNumber'], 'cast': try_parse_int},
'polarization': {'path': [ 'AdditionalAttributes', ('Name', 'POLARIZATION'), 'Values', 0]},
'processingDate': {'path': [ 'DataGranule', 'ProductionDateTime']},
'sensor': {'path': [ 'Platforms', 0, 'Instruments', 0, 'ShortName']}
}

def __init__(self, args: dict = {}, session: ASFSession = ASFSession()):
Expand Down
6 changes: 0 additions & 6 deletions asf_search/Products/UAVSARProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@

class UAVSARProduct(ASFProduct):
base_properties = {
'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0], 'cast': try_parse_int},
'granuleType': {'path': [ 'AdditionalAttributes', ('Name', 'GRANULE_TYPE'), 'Values', 0]},
'groupID': {'path': [ 'AdditionalAttributes', ('Name', 'GROUP_ID'), 'Values', 0]},
'insarStackId': {'path': [ 'AdditionalAttributes', ('Name', 'INSAR_STACK_ID'), 'Values', 0]},
'md5sum': {'path': [ 'AdditionalAttributes', ('Name', 'MD5SUM'), 'Values', 0]},
'offNadirAngle': {'path': [ 'AdditionalAttributes', ('Name', 'OFF_NADIR_ANGLE'), 'Values', 0], 'cast': try_parse_float},
'orbit': {'path': [ 'OrbitCalculatedSpatialDomains', 0, 'OrbitNumber'], 'cast': try_parse_int},
'polarization': {'path': [ 'AdditionalAttributes', ('Name', 'POLARIZATION'), 'Values', 0]},
'processingDate': {'path': [ 'DataGranule', 'ProductionDateTime']},
'sensor': {'path': [ 'Platforms', 0, 'Instruments', 0, 'ShortName']}
}

def __init__(self, args: dict = {}, session: ASFSession = ASFSession()):
Expand Down
10 changes: 4 additions & 6 deletions asf_search/Products/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
from .S1Product import S1Product
from .S1BURSTProduct import S1BURSTProduct
from .OPERAS1Product import OPERAS1Product
from .ARIAS1GUNWProduct import ARIAS1GUNWProduct

from .ALOSProduct import ALOSProduct
from .RadarsatProduct import RadarsatProduct

from .AIRSARProduct import AIRSARProduct
from .ERSProduct import ERSProduct
from .JERSProduct import JERSProduct
from .UAVSARProduct import UAVSARProduct
from .SIRCProduct import SIRCProduct
from .SEASATProduct import SEASATProduct
from .SMAPProduct import SMAPProduct
from .SMAPProduct import SMAPProduct
from .S1BURSTProduct import S1BURSTProduct
from .OPERAS1Product import OPERAS1Product
from .ARIAS1GUNWProduct import ARIAS1GUNWProduct

0 comments on commit e08ddd8

Please sign in to comment.