Skip to content

Commit

Permalink
Windows is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart committed Sep 14, 2021
1 parent 44a56ee commit cfe9974
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/datasets/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def test_invalid_t(self) -> None:
@pytest.mark.parametrize(
"date_string,format,min_datetime,max_datetime",
[
("", "", datetime(1970, 1, 1).timestamp(), datetime.max.timestamp()),
("", "", 0, datetime.max.timestamp()),
(
"2021",
"%Y",
Expand Down
4 changes: 2 additions & 2 deletions torchgeo/datasets/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def __init__(
# Skip files that rasterio is unable to read
continue
else:
mint = datetime(1970, 1, 1).timestamp()
mint = 0.0
maxt = datetime.max.timestamp()
if "date" in match.groupdict():
date = match.group("date")
Expand Down Expand Up @@ -449,7 +449,7 @@ def __init__(
# Skip files that fiona is unable to read
continue
else:
mint = datetime(1970, 1, 1).timestamp()
mint = 0
maxt = datetime.max.timestamp()
coords = (minx, maxx, miny, maxy, mint, maxt)
self.index.insert(i, coords, filepath)
Expand Down
3 changes: 1 addition & 2 deletions torchgeo/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,7 @@ def disambiguate_timestamp(date_str: str, format: str) -> Tuple[float, float]:

if not any([f"%{c}" in format for c in "yYcxG"]):
# No temporal info
mint = datetime(1970, 1, 1)
maxt = datetime.max
return 0, datetime.max.timestamp()
elif not any([f"%{c}" in format for c in "bBmjUWcxV"]):
# Year resolution
maxt = datetime(mint.year, 12, 31, 23, 59, 59, 999999)
Expand Down

0 comments on commit cfe9974

Please sign in to comment.