Skip to content

Commit 357767f

Browse files
committed
more deprecated
1 parent eb189df commit 357767f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

laika/downloader.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import time
88
import logging
99

10-
from datetime import datetime, timedelta
10+
from datetime import datetime, timedelta, timezone
1111
from urllib.parse import urlparse
1212
from io import BytesIO
1313
from ftplib import FTP_TLS, FTP
@@ -296,7 +296,7 @@ def download_nav(time: GPSTime, cache_dir, constellation: ConstellationId):
296296
if constellation not in CONSTELLATION_NASA_CHAR:
297297
return None
298298
c = CONSTELLATION_NASA_CHAR[constellation]
299-
if GPSTime.from_datetime(datetime.utcnow()) - time > SECS_IN_DAY:
299+
if GPSTime.from_datetime(datetime.now(timezone.utc)) - time > SECS_IN_DAY:
300300
url_bases = (
301301
mirror_url(CDDIS_BASE_URL, '/gnss/data/daily/'),
302302
)
@@ -339,9 +339,9 @@ def download_orbits_gps(time, cache_dir, ephem_types):
339339
}
340340

341341
# Download filenames in order of quality. Final -> Rapid -> Ultra-Rapid(newest first)
342-
if EphemerisType.FINAL_ORBIT in ephem_types and GPSTime.from_datetime(datetime.utcnow()) - time > 3 * SECS_IN_WEEK:
342+
if EphemerisType.FINAL_ORBIT in ephem_types and GPSTime.from_datetime(datetime.now(timezone.utc)) - time > 3 * SECS_IN_WEEK:
343343
filenames.extend(ephem_strs[EphemerisType.FINAL_ORBIT])
344-
if EphemerisType.RAPID_ORBIT in ephem_types and GPSTime.from_datetime(datetime.utcnow()) - time > 3 * SECS_IN_DAY:
344+
if EphemerisType.RAPID_ORBIT in ephem_types and GPSTime.from_datetime(datetime.now(timezone.utc)) - time > 3 * SECS_IN_DAY:
345345
filenames.extend(ephem_strs[EphemerisType.RAPID_ORBIT])
346346
if EphemerisType.ULTRA_RAPID_ORBIT in ephem_types:
347347
filenames.extend(ephem_strs[EphemerisType.ULTRA_RAPID_ORBIT])

tests/test_ephemerides.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
import unittest
33

4-
#from datetime import datetime
4+
#from datetime import datetime, timezone
55
from laika.ephemeris import EphemerisType, read_prn_data
66
from laika.gps_time import GPSTime
77
#from laika.constants import SECS_IN_DAY
@@ -20,7 +20,7 @@ class TestAstroDog(unittest.TestCase):
2020
def test_nav_vs_orbit_now(self):
2121
dog_orbit = AstroDog(valid_ephem_types=EphemerisType.all_orbits())
2222
dog_nav = AstroDog(valid_ephem_types=EphemerisType.NAV)
23-
gps_time = GPSTime.from_datetime(datetime.utcnow()) - SECS_IN_DAY*3
23+
gps_time = GPSTime.from_datetime(datetime.now(timezone.utc)) - SECS_IN_DAY*3
2424
for svId in svIds:
2525
sat_info_nav = dog_nav.get_sat_info(svId, gps_time)
2626
assert sat_info_nav is not None, f"Failed to get sat info for {svId} at {gps_time}"

0 commit comments

Comments
 (0)