diff --git a/asf_search/ASFProduct.py b/asf_search/ASFProduct.py index 55f5290a..305352c5 100644 --- a/asf_search/ASFProduct.py +++ b/asf_search/ASFProduct.py @@ -41,7 +41,7 @@ class ASFProduct: def get_classname(cls): return cls.__name__ - _properties_paths = { + _base_properties = { # min viable product 'centerLat': {'path': ['AdditionalAttributes', ('Name', 'CENTER_LAT'), 'Values', 0], 'cast': try_parse_float}, 'centerLon': {'path': ['AdditionalAttributes', ('Name', 'CENTER_LON'), 'Values', 0], 'cast': try_parse_float}, @@ -67,7 +67,7 @@ def get_classname(cls): 'sensor': {'path': [ 'Platforms', 0, 'Instruments', 0, 'ShortName'], }, } """ - _properties_paths dictionary, mapping readable property names to paths and optional type casting + _base_properties dictionary, mapping readable property names to paths and optional type casting entries are organized as such: - `PROPERTY_NAME`: The name the property should be called in `ASFProduct.properties` @@ -282,19 +282,6 @@ def translate_product(self, item: Dict) -> Dict: return {'geometry': geometry, 'properties': properties, 'type': 'Feature'} - # ASFProduct subclasses define extra/override param key + UMM pathing here - @staticmethod - def get_property_paths() -> Dict: - """ - Returns _base_properties of class, subclasses such as `S1Product` (or user provided subclasses) can override this to - define which properties they want in their subclass's properties dict. - - (See `S1Product.get_property_paths()` for example of combining _base_properties of multiple classes) - - :returns dictionary, {`PROPERTY_NAME`: {'path': [umm, path, to, value], 'cast (optional)': Callable_to_cast_value}, ...} - """ - return ASFProduct._base_properties - def get_sort_keys(self) -> Tuple[str, str]: """ Returns tuple of primary and secondary date values used for sorting final search results diff --git a/asf_search/CMR/subquery.py b/asf_search/CMR/subquery.py index d11b7c4c..db48c213 100644 --- a/asf_search/CMR/subquery.py +++ b/asf_search/CMR/subquery.py @@ -137,28 +137,6 @@ def format_query_params(params) -> List[List[dict]]: def translate_param(param_name, param_val) -> List[dict]: - # param_list = [] - - # cmr_input_map = field_map - - # param_input_map = cmr_input_map[param_name] - # cmr_param = param_input_map['key'] - # cmr_format_str = param_input_map['fmt'] - - # if not isinstance(param_val, list): - # param_val = [param_val] - - # for l in param_val: - # format_val = l - - # if isinstance(l, list): - # format_val = ','.join([f'{t}' for t in l]) - - # param_list.append({ - # cmr_param: cmr_format_str.format(format_val) - # }) - - # return param_list param_list = [] if not isinstance(param_val, list): diff --git a/asf_search/Products/AIRSARProduct.py b/asf_search/Products/AIRSARProduct.py index aa1e0e8b..0f5e2902 100644 --- a/asf_search/Products/AIRSARProduct.py +++ b/asf_search/Products/AIRSARProduct.py @@ -7,7 +7,7 @@ class AIRSARProduct(ASFProduct): """ ASF Dataset Overview Page: https://asf.alaska.edu/data-sets/sar-data-sets/airsar/ """ - _properties_paths = { + _base_properties = { **ASFProduct._properties_paths, 'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0], 'cast': try_parse_int}, 'groupID': {'path': [ 'AdditionalAttributes', ('Name', 'GROUP_ID'), 'Values', 0]}, diff --git a/asf_search/Products/ALOSProduct.py b/asf_search/Products/ALOSProduct.py index 035b3d1f..7052186f 100644 --- a/asf_search/Products/ALOSProduct.py +++ b/asf_search/Products/ALOSProduct.py @@ -10,7 +10,7 @@ class ALOSProduct(ASFStackableProduct): ASF Dataset Documentation Page: https://asf.alaska.edu/datasets/daac/alos-palsar/ """ - _properties_paths = { + _base_properties = { **ASFStackableProduct._properties_paths, 'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'FRAME_NUMBER'), 'Values', 0], 'cast': try_parse_int}, 'faradayRotation': {'path': ['AdditionalAttributes', ('Name', 'FARADAY_ROTATION'), 'Values', 0], 'cast': try_parse_float}, diff --git a/asf_search/Products/ARIAS1GUNWProduct.py b/asf_search/Products/ARIAS1GUNWProduct.py index a65b6e24..f75ddb9e 100644 --- a/asf_search/Products/ARIAS1GUNWProduct.py +++ b/asf_search/Products/ARIAS1GUNWProduct.py @@ -12,7 +12,7 @@ class ARIAS1GUNWProduct(S1Product): ASF Dataset Documentation Page: https://asf.alaska.edu/data-sets/derived-data-sets/sentinel-1-interferograms/ """ - _properties_paths = { + _base_properties = { **S1Product._properties_paths, 'perpendicularBaseline': {'path': ['AdditionalAttributes', ('Name', 'PERPENDICULAR_BASELINE'), 'Values', 0], 'cast': try_parse_float}, 'orbit': {'path': ['OrbitCalculatedSpatialDomains']}, diff --git a/asf_search/Products/ERSProduct.py b/asf_search/Products/ERSProduct.py index 4a53d35c..73aa447e 100644 --- a/asf_search/Products/ERSProduct.py +++ b/asf_search/Products/ERSProduct.py @@ -11,7 +11,7 @@ class ERSProduct(ASFStackableProduct): ASF ERS-1 Dataset Documentation Page: https://asf.alaska.edu/datasets/daac/ers-1/ ASF ERS-2 Dataset Documentation Page: https://asf.alaska.edu/datasets/daac/ers-2/ """ - _properties_paths = { + _base_properties = { **ASFStackableProduct._properties_paths, 'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'FRAME_NUMBER'), 'Values', 0]}, 'bytes': {'path': ['AdditionalAttributes', ('Name', 'BYTES'), 'Values', 0], 'cast': try_round_float}, diff --git a/asf_search/Products/JERSProduct.py b/asf_search/Products/JERSProduct.py index f829a760..5ea10e19 100644 --- a/asf_search/Products/JERSProduct.py +++ b/asf_search/Products/JERSProduct.py @@ -7,7 +7,7 @@ class JERSProduct(ASFStackableProduct): """ ASF Dataset Documentation Page: https://asf.alaska.edu/datasets/daac/jers-1/ """ - _properties_paths = { + _base_properties = { **ASFStackableProduct._properties_paths, 'browse': {'path': ['RelatedUrls', ('Type', [('GET RELATED VISUALIZATION', 'URL')])]}, 'groupID': {'path': ['AdditionalAttributes', ('Name', 'GROUP_ID'), 'Values', 0]}, diff --git a/asf_search/Products/NISARProduct.py b/asf_search/Products/NISARProduct.py index cd4956e1..30fc97b0 100644 --- a/asf_search/Products/NISARProduct.py +++ b/asf_search/Products/NISARProduct.py @@ -10,7 +10,7 @@ class NISARProduct(ASFStackableProduct): ASF Dataset Documentation Page: https://asf.alaska.edu/nisar/ """ - _properties_paths = { + _base_properties = { **ASFStackableProduct._properties_paths, 'pgeVersion': {'path': ['PGEVersionClass', 'PGEVersion']} } diff --git a/asf_search/Products/OPERAS1Product.py b/asf_search/Products/OPERAS1Product.py index 0c3c9a6d..91b24a78 100644 --- a/asf_search/Products/OPERAS1Product.py +++ b/asf_search/Products/OPERAS1Product.py @@ -8,7 +8,7 @@ class OPERAS1Product(S1Product): """ ASF Dataset Documentation Page: https://asf.alaska.edu/datasets/daac/opera/ """ - _properties_paths = { + _base_properties = { **S1Product._properties_paths, 'centerLat': {'path': []}, # Opera products lacks these fields 'centerLon': {'path': []}, diff --git a/asf_search/Products/RADARSATProduct.py b/asf_search/Products/RADARSATProduct.py index 7c933fe6..817465c4 100644 --- a/asf_search/Products/RADARSATProduct.py +++ b/asf_search/Products/RADARSATProduct.py @@ -8,7 +8,7 @@ class RADARSATProduct(ASFStackableProduct): """ ASF Dataset Documentation Page: https://asf.alaska.edu/datasets/daac/radarsat-1/ """ - _properties_paths = { + _base_properties = { **ASFStackableProduct._properties_paths, 'faradayRotation': {'path': ['AdditionalAttributes', ('Name', 'FARADAY_ROTATION'), 'Values', 0], 'cast': try_parse_float}, 'md5sum': {'path': ['AdditionalAttributes', ('Name', 'MD5SUM'), 'Values', 0]}, diff --git a/asf_search/Products/S1BurstProduct.py b/asf_search/Products/S1BurstProduct.py index 7d35f923..44462544 100644 --- a/asf_search/Products/S1BurstProduct.py +++ b/asf_search/Products/S1BurstProduct.py @@ -17,7 +17,7 @@ class S1BurstProduct(S1Product): ASF Dataset Documentation Page: https://asf.alaska.edu/datasets/data-sets/derived-data-sets/sentinel-1-bursts/ """ - _properties_paths = { + _base_properties = { **S1Product._properties_paths, 'bytes': {'path': ['AdditionalAttributes', ('Name', 'BYTE_LENGTH'), 'Values', 0]}, 'absoluteBurstID': {'path': ['AdditionalAttributes', ('Name', 'BURST_ID_ABSOLUTE'), 'Values', 0], 'cast': try_parse_int}, diff --git a/asf_search/Products/S1Product.py b/asf_search/Products/S1Product.py index c6f24ff5..16b24d7c 100644 --- a/asf_search/Products/S1Product.py +++ b/asf_search/Products/S1Product.py @@ -15,7 +15,7 @@ class S1Product(ASFStackableProduct): ASF Dataset Overview Page: https://asf.alaska.edu/datasets/daac/sentinel-1/ """ - _properties_paths = { + _base_properties = { **ASFStackableProduct._properties_paths, 'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'FRAME_NUMBER'), 'Values', 0], 'cast': try_parse_int}, #Sentinel and ALOS product alt for frameNumber (ESA_FRAME) 'groupID': {'path': ['AdditionalAttributes', ('Name', 'GROUP_ID'), 'Values', 0]}, diff --git a/asf_search/Products/SEASATProduct.py b/asf_search/Products/SEASATProduct.py index 1158fcf1..90c760e8 100644 --- a/asf_search/Products/SEASATProduct.py +++ b/asf_search/Products/SEASATProduct.py @@ -7,7 +7,7 @@ class SEASATProduct(ASFProduct): """ ASF Dataset Documentation Page: https://asf.alaska.edu/data-sets/sar-data-sets/seasat/ """ - _properties_paths = { + _base_properties = { **ASFProduct._properties_paths, 'bytes': {'path': [ 'AdditionalAttributes', ('Name', 'BYTES'), 'Values', 0], 'cast': try_round_float}, 'insarStackId': {'path': [ 'AdditionalAttributes', ('Name', 'INSAR_STACK_ID'), 'Values', 0]}, diff --git a/asf_search/Products/SIRCProduct.py b/asf_search/Products/SIRCProduct.py index e2b05df3..bdd41821 100644 --- a/asf_search/Products/SIRCProduct.py +++ b/asf_search/Products/SIRCProduct.py @@ -5,7 +5,7 @@ class SIRCProduct(ASFProduct): """ Dataset Documentation Page: https://eospso.nasa.gov/missions/spaceborne-imaging-radar-c """ - _properties_paths = { + _base_properties = { **ASFProduct._properties_paths, 'groupID': {'path': [ 'AdditionalAttributes', ('Name', 'GROUP_ID'), 'Values', 0]}, 'md5sum': {'path': [ 'AdditionalAttributes', ('Name', 'MD5SUM'), 'Values', 0]}, diff --git a/asf_search/Products/SMAPProduct.py b/asf_search/Products/SMAPProduct.py index a2750032..1e4834dd 100644 --- a/asf_search/Products/SMAPProduct.py +++ b/asf_search/Products/SMAPProduct.py @@ -7,7 +7,7 @@ class SMAPProduct(ASFProduct): """ ASF Dataset Documentation Page: https://asf.alaska.edu/data-sets/sar-data-sets/soil-moisture-active-passive-smap-mission/ """ - _properties_paths = { + _base_properties = { **ASFProduct._properties_paths, 'groupID': {'path': [ 'AdditionalAttributes', ('Name', 'GROUP_ID'), 'Values', 0]}, 'insarStackId': {'path': [ 'AdditionalAttributes', ('Name', 'INSAR_STACK_ID'), 'Values', 0]}, diff --git a/asf_search/Products/UAVSARProduct.py b/asf_search/Products/UAVSARProduct.py index f33a39dc..280cf719 100644 --- a/asf_search/Products/UAVSARProduct.py +++ b/asf_search/Products/UAVSARProduct.py @@ -7,7 +7,7 @@ class UAVSARProduct(ASFProduct): """ ASF Dataset Documentation Page: https://asf.alaska.edu/datasets/daac/uavsar/ """ - _properties_paths = { + _base_properties = { **ASFProduct._properties_paths, 'groupID': {'path': [ 'AdditionalAttributes', ('Name', 'GROUP_ID'), 'Values', 0]}, 'insarStackId': {'path': [ 'AdditionalAttributes', ('Name', 'INSAR_STACK_ID'), 'Values', 0]}, diff --git a/asf_search/search/baseline_search.py b/asf_search/search/baseline_search.py index c8cfc926..9ed47163 100644 --- a/asf_search/search/baseline_search.py +++ b/asf_search/search/baseline_search.py @@ -100,7 +100,7 @@ def _cast_to_subclass(product: ASFProduct, subclass: Type[ASFProduct]) -> ASFPro example: ``` class MyCustomClass(ASFProduct): - _properties_paths = { + _base_properties = { **ASFProduct._properties_paths, 'some_unique_property': {'path': ['AdditionalAttributes', 'UNIQUE_PROPERTY', ...]} } diff --git a/examples/5-Download.ipynb b/examples/5-Download.ipynb index 058b068c..43fb651e 100644 --- a/examples/5-Download.ipynb +++ b/examples/5-Download.ipynb @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "db06fa80-4ac3-40b5-9787-256b422d49e6", "metadata": { "tags": [] @@ -52,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "38a2c671-0789-4e7c-b758-5b48745b2877", "metadata": {}, "outputs": [], @@ -322,6 +322,52 @@ "listdir('./downloads3')" ] }, + { + "cell_type": "markdown", + "id": "30760f6f", + "metadata": {}, + "source": [ + "***\n", + "## S3 URIs\n", + "Some products have S3 URIs available (SENTINEL-1, OPERA, and NISAR)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "dd4a81ed", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['s3://asf-cumulus-prod-opera-browse/OPERA_L2_CSLC-S1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1_BROWSE.png.md5',\n", + " 's3://asf-cumulus-prod-opera-browse/OPERA_L2_CSLC-S1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1_BROWSE_low-res.png.md5',\n", + " 's3://asf-cumulus-prod-opera-browse/OPERA_L2_CSLC-S1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1_BROWSE_thumbnail.png.md5',\n", + " 's3://asf-cumulus-prod-opera-products/OPERA_L2_CSLC-S1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1.h5',\n", + " 's3://asf-cumulus-prod-opera-products/OPERA_L2_CSLC-S1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1.h5.md5',\n", + " 's3://asf-cumulus-prod-opera-products/OPERA_L2_CSLC-S1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1.iso.xml',\n", + " 's3://asf-cumulus-prod-opera-products/OPERA_L2_CSLC-S1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1/OPERA_L2_CSLC-S1_T113-241605-IW3_20240610T110743Z_20240611T073356Z_S1A_VV_v1.1.iso.xml.md5']" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "opera_product = asf.search(dataset=asf.DATASET.OPERA_S1, maxResults=1)[0]\n", + "opera_product.properties['s3Urls']" + ] + }, + { + "cell_type": "markdown", + "id": "159b5eb8", + "metadata": {}, + "source": [ + "From there authorized users can use their prefered method for authentication and downloading s3 objects." + ] + }, { "cell_type": "markdown", "id": "8aed3b7c-a557-4cbb-878e-aa9fe8330646", @@ -394,7 +440,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.11.5" }, "toc-autonumbering": false, "toc-showtags": false