Skip to content

Commit

Permalink
Merge pull request #295 from asfadmin/topic-ASFProduct_date-speedup
Browse files Browse the repository at this point in the history
`ciso8601` Result Date Parsing
  • Loading branch information
SpicyGarlicAlbacoreRoll authored Apr 19, 2024
2 parents 249d9c4 + c281857 commit d8ac6ff
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-->
------
## [v7.0.10](https://github.com/asfadmin/Discovery-asf_search/compare/v7.0.9...v7.0.10)
## [v7.1.0](https://github.com/asfadmin/Discovery-asf_search/compare/v7.0.9...v7.1.0)
### Added
- Improved logging in `ASFSession` authentication methods

### Changed
- Uses `ciso8601` module for parsing dates from CMR response, significant performance improvement post-query
- `ASFSession` now allows for authorized user access to hidden/restricted CMR datasets via `auth_with_creds()` or `auth_with_cookiejar()` authentication methods (previously only supported via `auth_with_token()` method)
- `ASFSession.auth_with_token()` now authenticates directly against EDL endpoint

Expand Down
9 changes: 6 additions & 3 deletions asf_search/CMR/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from shapely.geometry.base import BaseGeometry
from .field_map import field_map
from .datasets import collections_per_platform
import dateparser
import ciso8601
import logging


Expand Down Expand Up @@ -157,8 +157,11 @@ def try_parse_date(value: str) -> Optional[str]:
if value is None:
return None

date = dateparser.parse(value)

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

if date is None:
return value

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"importlib_metadata",
"numpy",
"dateparser",
"tenacity == 8.2.2"
"tenacity == 8.2.2",
"ciso8601"
]

test_requirements = [
Expand Down
1 change: 0 additions & 1 deletion tests/ASFSearchResults/test_ASFSearchResults.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Dict, List

import dateparser
import asf_search as asf
from asf_search import ASFSearchResults
import defusedxml.ElementTree as DefusedETree
Expand Down

0 comments on commit d8ac6ff

Please sign in to comment.