5151is downloaded (COD0MGXFIN). The CODE final SP3 solutions became
5252available starting GPS week 1962 or Aug 13, 2017. The CODE final
5353solution includes: GPS+GLO+GAL+BDS+QZS. More about the CODE solution can
54- be found in their papers [6]_[7]_.
54+ be found in their papers [6]_ [7]_.
5555
5656If the SP3 date requested is between GPS week 1690 and 1961 or between
5757May 25, 2012 and Aug 12, 2017, then the CODE 'com' short name solution
5858is downloaded. More about the CODE 'com' solution can be found in their
59- papers [9]_[10]_.
59+ papers [9]_ [10]_.
6060
6161CLK Older than Two Weeks
6262------------------------
6565is downloaded (COD0MGXFIN). The CODE final CLK solutions became
6666available starting GPS week 2113 or July 5th, 2020. The CODE final
6767solution includes: GPS+GLO+GAL+BDS+QZS. More about the CODE solution can
68- be found in their papers [6]_[7]_.
68+ be found in their papers [6]_ [7]_.
6969
7070If the CLK date requested is between GPS week 2034 and 2112 or between
7171Jan 1, 2019 and July 4th, 2020, then the Wuhan University final
7575If the CLK date requested is week GPS week 2034 and between Dec 30, 2018
7676and Dec 31, 2018, then the GFZ short name solution is downloaded (gbm).
7777More about the GFZ 'gbm' solution can be found in their
78- documentation [13]_[14]_.
78+ documentation [13]_ [14]_.
7979
8080If the CLK date requested is between GPS week 1962 and 2033 or between
8181Aug 13, 2017 and Dec 29th, 2018 then the Wuhan University short name
8585If the CLK date requested is between GPS week 1710 and 1961 or between
8686Oct 14, 2012 and Aug 12, 2017, then the CODE 'com' short name solution
8787is downloaded. More about the CODE 'com' solution can be found in their
88- papers [9]_[10]_.
88+ papers [9]_ [10]_.
8989
9090IGS Resources
9191-------------
@@ -172,8 +172,29 @@ def load_ephemeris(file_type, gps_millis,
172172 file_paths ,
173173 verbose )
174174
175- downloaded_paths = _download_ephemeris (file_type , needed_files ,
176- download_directory , verbose )
175+ try :
176+ downloaded_paths = _download_ephemeris (file_type ,
177+ needed_files ,
178+ download_directory , verbose )
179+ except ftplib .error_perm as err :
180+ # try second options for some files
181+ print (err )
182+ print ("Retrying download..." )
183+ if "Connection timed out" in str (err ): #pragma: no cover
184+ pass
185+ elif "WUM0MGXFIN" in str (err ):
186+ needed_files = [(x [0 ],x [1 ].replace ("WUM0MGXFIN" ,"GFZ0MGXRAP" ))
187+ for x in needed_files ]
188+ elif "wum" in str (err ):
189+ needed_files = [(x [0 ],x [1 ].replace ("wum" ,"gbm" ))
190+ for x in needed_files ]
191+ elif "BRDM00DLR_R" in str (err ):
192+ needed_files = [(x [0 ],x [1 ].replace ("BRDM00DLR_R" ,"BRDC00IGS_R" ))
193+ for x in needed_files ]
194+
195+ downloaded_paths = _download_ephemeris (file_type ,
196+ needed_files ,
197+ download_directory , verbose )
177198
178199 if verbose :
179200 if len (existing_paths ) > 0 :
@@ -626,11 +647,16 @@ def _valid_ephemeris_in_paths(date, possible_types, file_paths=None):
626647 if file_paths is None :
627648 return False , recommended_file
628649 # check compatible file types
629- for path in file_paths :
650+ for path in file_paths : # exact match
630651 if os .path .split (path )[1 ] + ".Z" == os .path .split (recommended_file [1 ])[1 ]:
631652 return True , path
632- for path in file_paths :
633- if os .path .split (path )[1 ][3 :] + ".Z" == os .path .split (recommended_file [1 ])[1 ]:
653+ for path in file_paths : # other short form files
654+ if os .path .split (path )[1 ][3 :] + ".Z" == os .path .split (recommended_file [1 ])[1 ][3 :]:
655+ return True , path
656+ for path in file_paths : # other long form files
657+ if os .path .split (path )[1 ][11 :] == str (timetuple .tm_year ) \
658+ + str (timetuple .tm_yday ).zfill (3 ) \
659+ + "0000_01D_05M_ORB.SP3" :
634660 return True , path
635661
636662 # clk from last three days
@@ -743,11 +769,18 @@ def _valid_ephemeris_in_paths(date, possible_types, file_paths=None):
743769 if file_paths is None :
744770 return False , recommended_file
745771 # check compatible file types
746- for path in file_paths :
772+ for path in file_paths : # exact file match
747773 if os .path .split (path )[1 ] + ".Z" == os .path .split (recommended_file [1 ])[1 ]:
748774 return True , path
749- for path in file_paths :
750- if os .path .split (path )[1 ][3 :] + ".Z" == os .path .split (recommended_file [1 ])[1 ]:
775+ print ("2. looking for:" ,os .path .split (recommended_file [1 ])[1 ][3 :])
776+ for path in file_paths : # other short form files
777+ print ("2. found path:" ,os .path .split (path )[1 ][3 :] + ".Z" )
778+ if os .path .split (path )[1 ][3 :] + ".Z" == os .path .split (recommended_file [1 ])[1 ][3 :]:
779+ return True , path
780+ for path in file_paths : # other long form files
781+ if os .path .split (path )[1 ][11 :] == str (timetuple .tm_year ) \
782+ + str (timetuple .tm_yday ).zfill (3 ) \
783+ + "0000_01D_30S_CLK.CLK" :
751784 return True , path
752785
753786 # clk for Aug 13, 2017 to Dec 29, 2018
@@ -768,7 +801,12 @@ def _valid_ephemeris_in_paths(date, possible_types, file_paths=None):
768801 if os .path .split (path )[1 ] + ".Z" == os .path .split (recommended_file [1 ])[1 ]:
769802 return True , path
770803 for path in file_paths :
771- if os .path .split (path )[1 ][3 :] + ".Z" == os .path .split (recommended_file [1 ])[1 ]:
804+ if os .path .split (path )[1 ][3 :] + ".Z" == os .path .split (recommended_file [1 ])[1 ][3 :]:
805+ return True , path
806+ for path in file_paths : # other long form files
807+ if os .path .split (path )[1 ][11 :] == str (timetuple .tm_year ) \
808+ + str (timetuple .tm_yday ).zfill (3 ) \
809+ + "0000_01D_30S_CLK.CLK" :
772810 return True , path
773811
774812 # clk for Oct 14, 2012 to Aug 12, 2017
@@ -789,9 +827,13 @@ def _valid_ephemeris_in_paths(date, possible_types, file_paths=None):
789827 if os .path .split (path )[1 ] + ".Z" == os .path .split (recommended_file [1 ])[1 ]:
790828 return True , path
791829 for path in file_paths :
792- if os .path .split (path )[1 ][3 :] + ".Z" == os .path .split (recommended_file [1 ])[1 ]:
830+ if os .path .split (path )[1 ][3 :] + ".Z" == os .path .split (recommended_file [1 ])[1 ][3 :]:
831+ return True , path
832+ for path in file_paths : # other long form files
833+ if os .path .split (path )[1 ][11 :] == str (timetuple .tm_year ) \
834+ + str (timetuple .tm_yday ).zfill (3 ) \
835+ + "0000_01D_30S_CLK.CLK" :
793836 return True , path
794-
795837 else :
796838 raise RuntimeError (possible_type ,"invalid possible_type " \
797839 + "for valid ephemeris" )
@@ -930,7 +972,7 @@ def _get_rinex_extension(timestamp):
930972 """Get file extension of rinex file based on timestamp.
931973
932974 GPS and Glonass Rinex files switched from .Z to .gz on
933- December 1, 2020 [5 ]_.
975+ December 1, 2020 [15 ]_.
934976
935977 Parameters
936978 ----------
@@ -944,7 +986,7 @@ def _get_rinex_extension(timestamp):
944986
945987 References
946988 ----------
947- .. [5 ] https://cddis.nasa.gov/Data_and_Derived_Products/GNSS/daily_30second_data.html
989+ .. [15 ] https://cddis.nasa.gov/Data_and_Derived_Products/GNSS/daily_30second_data.html
948990
949991 """
950992 # switched from .Z to .gz compression format on December 1st, 2020
0 commit comments