Skip to content

Commit

Permalink
Merge pull request #307 from asfadmin/topic-dateparsing-wheel
Browse files Browse the repository at this point in the history
using dateutil for date validation, ciso8601 optionalized
  • Loading branch information
SpicyGarlicAlbacoreRoll authored Jul 15, 2024
2 parents 899f57f + c1a814f commit a607661
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-->
------
## [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`

Expand Down
8 changes: 6 additions & 2 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 Down Expand Up @@ -158,7 +162,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
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
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"importlib_metadata",
"numpy",
"dateparser",
"python-dateutil",
"tenacity == 8.2.2",
"ciso8601"
]

test_requirements = [
Expand All @@ -25,7 +25,8 @@
]

extra_requirements = [
"remotezip>=0.10.0"
"remotezip>=0.10.0",
"ciso8601",
]


Expand Down

0 comments on commit a607661

Please sign in to comment.