зеркало из https://github.com/microsoft/torchgeo.git
RasterDataset: support date_str containing % character (#2233)
* temporary_percent_placeholder_utils * make ruff happy * Add tests and fix code --------- Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
Родитель
fa95b7acba
Коммит
27a981c8e9
|
@ -369,6 +369,18 @@ class TestBoundingBox:
|
|||
datetime(2021, 9, 13, 17, 21, 53, 123).timestamp(),
|
||||
datetime(2021, 9, 13, 17, 21, 53, 123).timestamp(),
|
||||
),
|
||||
(
|
||||
'2021-09-13%2017:21:53',
|
||||
'%Y-%m-%d%%20%H:%M:%S',
|
||||
datetime(2021, 9, 13, 17, 21, 53, 0).timestamp(),
|
||||
datetime(2021, 9, 13, 17, 21, 53, 999999).timestamp(),
|
||||
),
|
||||
(
|
||||
'2021%m',
|
||||
'%Y%%m',
|
||||
datetime(2021, 1, 1, 0, 0, 0, 0).timestamp(),
|
||||
datetime(2021, 12, 31, 23, 59, 59, 999999).timestamp(),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_disambiguate_timestamp(
|
||||
|
|
|
@ -308,8 +308,8 @@ def disambiguate_timestamp(date_str: str, format: str) -> tuple[float, float]:
|
|||
(mint, maxt) tuple for indexing
|
||||
"""
|
||||
mint = datetime.strptime(date_str, format)
|
||||
format = format.replace('%%', '')
|
||||
|
||||
# TODO: This doesn't correctly handle literal `%%` characters in format
|
||||
# TODO: May have issues with time zones, UTC vs. local time, and DST
|
||||
# TODO: This is really tedious, is there a better way to do this?
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче