Skip to content

Commit

Permalink
fixes tests, removes filesToWKT.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kim committed Aug 1, 2024
2 parents 151b1f2 + 28f9f1f commit 58390d7
Show file tree
Hide file tree
Showing 16 changed files with 78 additions and 239 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Exposed `asf.validator_map`, which given a ops search param, can be used to look up which method we're going to validate it against.
- Exposed `ASFProduct.get_urls` which returns the URL's for it's products directly. Can control which products with the `fileType` enum.

## [v7.1.4](https://github.com/asfadmin/Discovery-asf_search/compare/v7.1.3...v7.1.4)
### Changed
- replaces `ciso8601` package with `dateutil` for package wheel compatibility. `ciso8601` used when installed via `extra` dependency
### Fixed
- Fixes syntax warning with escaped slash in `translate.py`

------
## [v7.1.3](https://github.com/asfadmin/Discovery-asf_search/compare/v7.1.2...v7.1.3)
### Fixed
- Adds missing values for polarization constants `DUAL_HH`, `DUAL_VV`, `DUAL_HV`, `DUAL_VH`, `HH_3SCAN`, `HH_4SCAN`, `HH_5SCAN`
- processingLevel `RAW` now includes `C1234413256-ASFDEV` in collection alias list (`SENTINEL-1B_RAW`'s collection for ASFDEV provider)

------
## [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 @@ -435,3 +435,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()
1 change: 1 addition & 0 deletions asf_search/CMR/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,7 @@
"C1234413238-ASFDEV",
"C1327985647-ASF",
"C1216244592-ASF",
"C1234413256-ASFDEV",
],
"GRD_MD": [
"C1214471521-ASF",
Expand Down
10 changes: 7 additions & 3 deletions asf_search/CMR/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
from shapely.geometry.base import BaseGeometry
from .field_map import field_map
from .datasets import collections_per_platform
import ciso8601
import logging

try:
from ciso8601 import parse_datetime
except ImportError:
from dateutil.parser import parse as parse_datetime


def translate_opts(opts: ASFSearchOptions) -> List:
# Need to add params which ASFSearchOptions cant support (like temporal),
Expand All @@ -22,7 +26,7 @@ def translate_opts(opts: ASFSearchOptions) -> List:
# intersectsWith, temporal, and other keys you don't want to escape, so keep whitelist instead
for escape_commas in ["campaign"]:
if escape_commas in dict_opts:
dict_opts[escape_commas] = dict_opts[escape_commas].replace(",", "\,")
dict_opts[escape_commas] = dict_opts[escape_commas].replace(",", "\\,")

dict_opts = fix_cmr_shapes(dict_opts)

Expand Down Expand Up @@ -171,7 +175,7 @@ def try_parse_date(value: str) -> Optional[str]:
return None

try:
date = ciso8601.parse_datetime(value)
date = parse_datetime(value)
except ValueError:
return None

Expand Down
2 changes: 1 addition & 1 deletion asf_search/Products/ARIAS1GUNWProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,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 @@ -20,6 +20,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 @@ -72,3 +74,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/Products/RADARSATProduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class RADARSATProduct(ASFStackableProduct):
'beamModeType': {'path': ['AdditionalAttributes', ('Name', 'BEAM_MODE_TYPE'), 'Values', 0]},
'insarStackId': {'path': ['AdditionalAttributes', ('Name', 'INSAR_STACK_ID'), 'Values', 0]},
'frameNumber': {'path': ['AdditionalAttributes', ('Name', 'FRAME_NUMBER'), 'Values', 0], 'cast': try_parse_int}, #Sentinel and ALOS product alt for frameNumber (ESA_FRAME)
'esaFrame': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0]},
'esaFrame': {'path': ['AdditionalAttributes', ('Name', 'CENTER_ESA_FRAME'), 'Values', 0], 'cast': try_parse_int},
}

def __init__(self, args: Dict = {}, session: ASFSession = ASFSession()):
Expand Down
209 changes: 0 additions & 209 deletions asf_search/WKT/FilesToWKT.py

This file was deleted.

1 change: 0 additions & 1 deletion asf_search/WKT/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from .validate_wkt import validate_wkt
from .RepairEntry import RepairEntry
from .FilesToWKT import filesToWKT
2 changes: 1 addition & 1 deletion asf_search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from .download import *
from .CMR import *
from .baseline import *
from .WKT import validate_wkt, filesToWKT
from .WKT import validate_wkt
from .export import *

REPORT_ERRORS=True
Expand Down
8 changes: 6 additions & 2 deletions asf_search/baseline/calc.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from asf_search import ASFProduct
from math import sqrt, cos, sin, radians
from typing import List

import numpy as np
from ciso8601 import parse_datetime

from asf_search import ASFProduct
try:
from ciso8601 import parse_datetime
except ImportError:
from dateutil.parser import parse as parse_datetime

# WGS84 constants
a = 6378137
f = pow((1.0 - 1 / 298.257224), 2)
Expand Down
8 changes: 5 additions & 3 deletions asf_search/baseline/stack.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from asf_search import ASFProduct, ASFStackableProduct, ASFSearchResults
from typing import Tuple, List
from ciso8601 import parse_datetime
import pytz

from .calc import calculate_perpendicular_baselines
from asf_search import ASFProduct, ASFStackableProduct, ASFSearchResults

try:
from ciso8601 import parse_datetime
except ImportError:
from dateutil.parser import parse as parse_datetime

def get_baseline_from_stack(reference: ASFProduct, stack: ASFSearchResults) -> Tuple[ASFSearchResults, List[dict]]:
warnings = []
Expand Down
14 changes: 7 additions & 7 deletions asf_search/constants/POLARIZATION.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
VV = 'VV'
VV_VH = 'VV+VH'
HH_HV = 'HH+HV'
DUAL_HH = ''
DUAL_VV = ''
DUAL_HV = ''
DUAL_VH = ''
HH_3SCAN = ''
HH_4SCAN = ''
HH_5SCAN = ''
DUAL_HH = 'DUAL HH'
DUAL_VV = 'DUAL VV'
DUAL_HV = 'DUAL HV'
DUAL_VH = 'DUAL VH'
HH_3SCAN = 'HH 3SCAN'
HH_4SCAN = 'HH 4SCAN'
HH_5SCAN = 'HH 5SCAN'
QUAD = 'quadrature'
HH_VV = 'HH+VV'
HH_HV_VH_VV = 'HH+HV+VH+VV'
Expand Down
Loading

0 comments on commit 58390d7

Please sign in to comment.