[Difx-users] Downloading the .erp files from cddis
Leonid Petrov
Leonid.Petrov at lpetrov.net
Thu Nov 5 08:18:25 EST 2020
Chris,
> Are there any https options?
You bet!
1)
a) Register account at https://urs.earthdata.nasa.gov/
b) wget --auth-no-challenge --user=UUUUUUU --password=PPPPPP -N --cut-dirs=12 https://cddis.nasa.gov/archive/vlbi/gsfc/ancillary/solve_apriori/usno500_finals.erp
where UUUUUU and PPPPPPP are username and password
2) Use NERS. See python code attached.
3) Upgrade DiFX to use VTD that is a replacement of Calc. VTD is supported,
Calc is beyond EOL. VTD can be configured to use NERS and other services.
You will not need worry about downloading EOP, TEC maps, slant path
delay files, loadings, etc: it will be done automatically.
Leonid
2020.11.05_08:14:09
=================================== Attachment 1 =================
#!/usr/bin/env python3
import pwd, sys, os, shutil, time, subprocess, datetime, signal
"""
Program ners_to_eop inquires the Network Earth Rotation Server,
retrieves the EOP series and converts them into erp format
used by Calc and Solve.
"""
prog_name = "ners_to_erp v 1.0 2019.01.09"
ners_host_name = "earthrotation.net"
eop_start_date = "1980.01.01"
if ( sys.version[:3] < "3.0" ): print ( "This script cannot run under Python-2" ); exit ( 1 )
if ( sys.version[:3] < "3.2" ): print ( "This script cannot run under Python older than 3.2. Please upgrade" ); exit ( 1 )
#
# ------------------------------------------------------------------------
#
def ners_exe ( command, verb=0 ):
global ners_child_pid
"""
Auxilliary routine ners_exe spawns a subprocess, executes command in
the context of the subprocess, waits for its completion and return
the completion code and the results as ( returncode, out ).
out is a list of strings without trailing "\n". If verb >= 2,
the command to be executed is also printed in stdout.
Requires sys, os, subprocess, signal, datetime
"""
if ( verb >= 2 ):
date_str = datetime.now().strftime("%Y.%m.%d_%H:%M:%S.%f")[0:23]
print ( date_str, "execute:", command )
sys.stdout.flush()
#
# --- Launch the subprocess
#
proc = subprocess.Popen ( command, \
stdout=subprocess.PIPE, \
stderr=subprocess.STDOUT, \
shell=True )
#
# --- Catch the output in list out
#
out = []
for line in proc.stdout:
out.append ( str(line, encoding="utf-8").split("\n")[0] )
#
# --- wait for completion of the child process
#
proc.wait()
#
# --- Return the runcode and the output that was caught
#
return ( proc.returncode, out )
#
# ------------------------------------------------------------------------
#
ners_file = "/tmp/eop_ners.txt"
#
# --- Command line for getting the EOP series from the NERS server
#
com_line = "wget -q -O - 'http://" + ners_host_name + "/cgi-bin/eop_series.py?start_date=" + \
eop_start_date + "&stop_date=now&time_step=86400.0&eop_group=polu&service=series&submit=Submit'"
#
# --- Get the EOP
#
(ret, ners_buf) = ners_exe ( com_line )
if ( ret != 0 ):
for line in ners_buf:
print ( line.strip("\n") )
print ( "Failure to get EOP from NERS server" )
exit ( 1 )
#
# --- The first pass: learn the number of EOP entries,
# --- dates of the first and the last entires
#
num_rec = 0
for line in ners_buf:
if ( line[0:1] == '#' or \
line[0:1] == '<' or \
len(line.split()) < 6 ):
continue
if ( num_rec == 0 ):
tim_sec_first = float(line.replace("D","E").split()[1])
first_date = line.split()[2]
num_rec = num_rec + 1
last_date = line.split()[2]
#
# --- Print the header
#
jd_first = 2451544.50 + tim_sec_first/86400.0
print ( "EOP-MOD Ver 2.0 %9.1f 1.0 %5d UT1-TAI UNDEF " % \
( jd_first, num_rec ) )
print ( "%-72s" % "# " )
print ( "%-72s" % ( "# Generated by " + prog_name ) )
print ( "%-72s" % "# EOP are generated by the Nethwork Earth Rotation Service" )
print ( "%-72s" % "# " )
print ( "%-72s" % ( "# First date: " + first_date ) )
print ( "%-72s" % ( "# Last date: " + last_date ) )
print ( "%-72s" % "# " )
#
# --- Parse the EOP file
#
for line in ners_buf:
if ( line[0:1] == '#' or \
line[0:1] == '<' or \
len(line.split()) < 6 ):
continue
#
tim_sec = float(line.replace("D","E").split()[1])
xpol = float(line.replace("D","E").split()[4])
ypol = float(line.replace("D","E").split()[5])
ut1 = float(line.replace("D","E").split()[6])
jd = 2451544.50 + tim_sec/86400.0
#
# --- Print re-formatted line
#
print ( "%9.1f %7.4f %7.4f %9d 0.0 0.0 0. 0.000 0.000 0.000" % \
( jd, 10.*xpol, 10.*ypol, int(ut1*1.e6) ) )
More information about the Difx-users
mailing list