|
27 | 27 | # mirror of sftp://gdc.cddis.eosdis.nasa.gov/gnss/data/hourly |
28 | 28 | CDDIS_HOURLY_BASE_URL = os.getenv("CDDIS_HOURLY_BASE_URL", "https://raw.githubusercontent.com/commaai/gnss-data-hourly/master") |
29 | 29 |
|
30 | | -# mirror of ftp://ftp.glonass-iac.ru |
31 | | -GLONAS_IAC_BASE_URL = os.getenv("GLONAS_IAC_BASE_URL", "https://raw.githubusercontent.com/commaai/gnss-data-alt/master") |
32 | | - |
33 | | -# no mirror |
34 | | -IGN_BASE_URL = os.getenv("IGN_BASE_URL", "ftp://igs.ign.fr/pub") |
35 | | - |
36 | 30 |
|
37 | 31 | class DownloadFailed(Exception): |
38 | 32 | pass |
@@ -325,36 +319,33 @@ def download_nav(time: GPSTime, cache_dir, constellation: ConstellationId): |
325 | 319 | def download_orbits_gps(time, cache_dir, ephem_types): |
326 | 320 | url_bases = ( |
327 | 321 | mirror_url(CDDIS_BASE_URL, '/gnss/products/'), |
328 | | - mirror_url(IGN_BASE_URL, '/igs/products/'), |
| 322 | + mirror_url(CDDIS_BASE_URL, '/glonass/products/'), |
329 | 323 | ) |
330 | 324 |
|
| 325 | + folder_path = "%i/" % time.week |
| 326 | + filenames = [] |
| 327 | + |
331 | 328 | if time.week < 2238: |
| 329 | + assert EphemerisType.FINAL_ORBIT in ephem_types, "Only final orbits are available before 2238" |
332 | 330 | compression = '.Z' |
333 | | - ephem_strs = { |
334 | | - EphemerisType.FINAL_ORBIT: ['igs{wwww}{dow}.sp3'.format(wwww=time.week, dow=time.dow)], |
335 | | - EphemerisType.RAPID_ORBIT: ['igr{wwww}{dow}.sp3'.format(wwww=time.week, dow=time.dow)], |
336 | | - EphemerisType.ULTRA_RAPID_ORBIT: ['igu{wwww}{dow}_{hh}.sp3'.format(wwww=time.week, dow=time.dow, hh=hour) for hour in ['18', '12', '06', '00']] |
337 | | - } |
| 331 | + filenames.extend(['igs{wwww}{dow}.sp3'.format(wwww=time.week, dow=time.dow)]) |
338 | 332 | else: |
339 | 333 | # TODO deal with version number |
340 | 334 | compression = '.gz' |
341 | 335 | ephem_strs = { |
342 | | - EphemerisType.FINAL_ORBIT: ['IGS0OPSFIN_{yyyy}{doy:03d}0000_01D_15M_ORB.SP3'.format(yyyy=time.year, doy=time.doy)], |
343 | | - EphemerisType.RAPID_ORBIT: ['IGS0OPSRAP_{yyyy}{doy:03d}0000_01D_15M_ORB.SP3'.format(yyyy=time.year, doy=time.doy)], |
344 | | - EphemerisType.ULTRA_RAPID_ORBIT: ['IGS0OPSULT_{yyyy}{doy:03d}{hh}00_02D_15M_ORB.SP3'.format(yyyy=time.year, doy=time.doy, hh=hour) \ |
| 336 | + EphemerisType.FINAL_ORBIT: ['COD0OPSFIN_{yyyy}{doy:03d}0000_01D_05M_ORB.SP3'.format(yyyy=time.year, doy=time.doy)], |
| 337 | + EphemerisType.RAPID_ORBIT: ['COD0OPSRAP_{yyyy}{doy:03d}0000_01D_05M_ORB.SP3'.format(yyyy=time.year, doy=time.doy)], |
| 338 | + EphemerisType.ULTRA_RAPID_ORBIT: ['COD0OPSULT_{yyyy}{doy:03d}{hh}00_02D_05M_ORB.SP3'.format(yyyy=time.year, doy=time.doy, hh=hour) \ |
345 | 339 | for hour in ['18', '12', '06', '00']], |
346 | 340 | } |
347 | 341 |
|
348 | | - folder_path = "%i/" % time.week |
349 | | - filenames = [] |
350 | | - |
351 | | - # Download filenames in order of quality. Final -> Rapid -> Ultra-Rapid(newest first) |
352 | | - if EphemerisType.FINAL_ORBIT in ephem_types and GPSTime.from_datetime(datetime.utcnow()) - time > 3 * SECS_IN_WEEK: |
353 | | - filenames.extend(ephem_strs[EphemerisType.FINAL_ORBIT]) |
354 | | - if EphemerisType.RAPID_ORBIT in ephem_types and GPSTime.from_datetime(datetime.utcnow()) - time > 3 * SECS_IN_DAY: |
355 | | - filenames.extend(ephem_strs[EphemerisType.RAPID_ORBIT]) |
356 | | - if EphemerisType.ULTRA_RAPID_ORBIT in ephem_types: |
357 | | - filenames.extend(ephem_strs[EphemerisType.ULTRA_RAPID_ORBIT]) |
| 342 | + # Download filenames in order of quality. Final -> Rapid -> Ultra-Rapid(newest first) |
| 343 | + if EphemerisType.FINAL_ORBIT in ephem_types and GPSTime.from_datetime(datetime.utcnow()) - time > 3 * SECS_IN_WEEK: |
| 344 | + filenames.extend(ephem_strs[EphemerisType.FINAL_ORBIT]) |
| 345 | + if EphemerisType.RAPID_ORBIT in ephem_types and GPSTime.from_datetime(datetime.utcnow()) - time > 3 * SECS_IN_DAY: |
| 346 | + filenames.extend(ephem_strs[EphemerisType.RAPID_ORBIT]) |
| 347 | + if EphemerisType.ULTRA_RAPID_ORBIT in ephem_types: |
| 348 | + filenames.extend(ephem_strs[EphemerisType.ULTRA_RAPID_ORBIT]) |
358 | 349 |
|
359 | 350 | folder_file_names = [(folder_path, filename) for filename in filenames] |
360 | 351 | ret = download_and_cache_file_return_first_success(url_bases, folder_file_names, cache_dir+'cddis_products/', compression=compression) |
@@ -388,7 +379,6 @@ def download_dcb(time, cache_dir): |
388 | 379 | folder_paths = [] |
389 | 380 | url_bases = ( |
390 | 381 | mirror_url(CDDIS_BASE_URL, '/gnss/products/bias/'), |
391 | | - mirror_url(IGN_BASE_URL, '/igs/products/mgex/dcb/'), |
392 | 382 | ) |
393 | 383 | # seem to be a lot of data missing, so try many days |
394 | 384 | for time_step in [time - i * SECS_IN_DAY for i in range(14)]: |
|
0 commit comments