Skip to content

Commit

Permalink
version 3.10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kristinemlarson committed Oct 22, 2024
1 parent 34afcf8 commit a4a3032
Show file tree
Hide file tree
Showing 14 changed files with 273 additions and 161 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ Default for rinex3 files is now explicitly set to cddis. This is different than
the default is all, which now cycles thru unavco and sopac. It used to use sonel, but I don't think
many people use sonel. And if they want to use sonel, of course they can do so by specifying sonel.

Trying to make a log file for rinex2snr so that you are not overwhelmed with messages
to the screen. rinex3_rinex2 had to be changed to allow log input. and file needed to be
created in run_rinex2snr.

I added a debug option to rinex2snr so you could see what is going wrong without using
the task queues.



## 3.10.0

Making new pypi version with python 3.9 just to be sure we are all on the same page.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# gnssrefl v3.10.1

gnssrefl is an open source software package for GNSS Interferometric Reflectometry (GNSS-IR).
When citing results using gnssrefl, please use:
When showing results created using gnssrefl, please use:

Larson, K.M., gnssrefl: an open source python software package for environmental
GNSS interferometric reflectometry applications, *GPS Solutions*, Vol. 28(165), 10.1007/s10291-024-01694-8, 2024.
Expand Down
9 changes: 7 additions & 2 deletions gnssrefl/daily_avg_cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def daily_avg(station: str , medfilter: float, ReqTracks: int, txtfile: str = No
daily_avg_reqtracks and daily_avg_medfilter. For those making a new json,
the parameters will be set to None if you don't choose a value on the command line.
You can also hand edit or add it. This would be helpful in not having to rerun gnssir_input and
risk losing some of your other specialized selections.
risk losing some of your other specialized selections. Because median filter and required tracks are
REQUIRED inputs, you still have to tell the code something, even if you overwrite it in the json.
Set to 0 and 0 to trigger the json inputs. I will work on getting a better way to do this.
If you are unfamiliar with what a median filter does in this code, please see
https://gnssrefl.readthedocs.io/en/latest/pages/README_dailyavg.html
Expand Down Expand Up @@ -88,6 +90,9 @@ def daily_avg(station: str , medfilter: float, ReqTracks: int, txtfile: str = No
and restricts it to years between 2015 and 2020 and azimuths between 0 and 180 degrees
daily_avg p041 0.25 10 -extension NV
consolidates results which were created using the extension NV when you ran gnssir.
daily_avg p041 0 0
this will use median filter and required tracks values from within the json. The parameter
names are slightly different, daily_avg_medianfilter and dailyavg_reqtracks.
Parameters
Expand Down Expand Up @@ -165,7 +170,7 @@ def daily_avg(station: str , medfilter: float, ReqTracks: int, txtfile: str = No
maximum azimuth, degrees
test : bool, optional
not sure what this does
not sure what this does anymore.
subdir: str, optional
non-default subdirectory for Files output
Expand Down
3 changes: 2 additions & 1 deletion gnssrefl/download_rinex.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ def download_rinex(station: str, year: int, month: int, day: int, rate: str = 'l
if NS != 9:
print('exiting: RINEX 3+ station names must have 9 characters')
sys.exit()
if archive is None:
if archive is None or archive == 'all':
archive = 'cddis'
print('Using cddis as default archive for RINEX 3 files - since you do not provide one')

if stream not in ['R', 'S']:
stream = 'R'
Expand Down
26 changes: 15 additions & 11 deletions gnssrefl/gnssir_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def parse_arguments():
parser.add_argument("-subdaily_subdir", default=None, type=str, help="subdaily, output directory")
parser.add_argument("-subdaily_spline_outlier1", default=None, type=float, help="subdaily, outlier value (m), part1")
parser.add_argument("-subdaily_spline_outlier2", default=None, type=float, help="subdaily, outlier value (m), part2")
parser.add_argument("-snr", default=None, type=int, help="SNR file type (66,10, 88 etc)")
parser.add_argument("-stream", default=None, type=str, help="RINEX3 stream parameter")
parser.add_argument("-samplerate", default=None, type=int, help="RINEX3 samplerate parameter")
parser.add_argument("-snr", default=None, type=int, help="file type (66,10, 88 etc) when creating SNR files")
parser.add_argument("-stream", default=None, type=str, help="RINEX3 stream parameter when creating SNR files")
parser.add_argument("-samplerate", default=None, type=int, help="RINEX3 samplerate parameter when creating SNR files")
parser.add_argument("-dec", default=None, type=int, help="optional decimation value when creating SNR files ")
parser.add_argument("-orb", default=None, type=str, help="optional orbit value used when creating SNR files")
parser.add_argument("-archive", default=None, type=str, help="optional archive value used when creating SNR files")
Expand Down Expand Up @@ -290,20 +290,24 @@ def make_gnssir_input(station: str, lat: float=0, lon: float=0, height: float=0,
alternate setting for outlier detection in part2
snr : int
kind of SNR file. If using the default (66), there is no reason to set this.
if you are going to use non-defaults (i.e. 88) throughout, it would be helpful
to set this here and then the value will be used when using gnssir. If you set it,
This denotes the kind of SNR file when either creating or using SNR files.
If using the default (66), there is no reason to set this.
If you are going to use non-defaults (i.e. 88) throughout, it would be helpful
to set this here and then the value will be used when using gnssir. If you do set it,
it will also be used by rinex2snr, which again can be useful.
stream : str, optional
for RINEX3 translation, R or S naming parameter
for RINEX3 translation only, R or S naming parameter
set to R
samplerate : int , optional
for RINEX3 translation, file sample rate to be used
for RINEX3 translation only, file sample rate to be used
set to None for now
orb : str, optional
for SNR file creation. If nothing is provided, nothing is written to the json
for SNR file creation. If nothing is provided, nothing is written to the json.
Can be useful if you want to use a specific orbit source (that the code recognizes)
archive : str, optional
for SNR file creation. If nothing is provided, nothing is written to the json
for SNR file creation. If nothing is provided, nothing is written to the json.
Can be useful if you forget which archive has which station files.
"""

# make sure environment variables exist
Expand Down Expand Up @@ -332,7 +336,7 @@ def make_gnssir_input(station: str, lat: float=0, lon: float=0, height: float=0,
# try to find the coordinates at UNR
lat, lon, height = g.queryUNR_modern(station)
if lat == 0:
print('Tried to find coordinates in station database. None found so exiting')
print('Tried to find coordinates in coordinate databases. None found so exiting')
sys.exit()

# calculate Hortho using EGM96 if none provided
Expand Down
39 changes: 20 additions & 19 deletions gnssrefl/gps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2631,7 +2631,6 @@ def rinex_unavco_highrate(station, year, month, day):

rinexfile,rinexfiled = rinex_name(station, year, month, day)

#print('Using new unavco protocols')
#unavco = 'https://data-idm.unavco.org/archive/gnss/highrate/1-Hz/rinex/'
unavco = 'https://data.unavco.org/archive/gnss/highrate/1-Hz/rinex/'

Expand Down Expand Up @@ -3279,7 +3278,7 @@ def make_nav_dirs(yyyy):
def check_inputs(station,year,doy,snr_type):
"""
inputs to Lomb Scargle and Rinex translation codes
are checked for sensibility. Returns true or false to
are checked for sensibility. Returns true or false so
code can exit.
Parameters
Expand Down Expand Up @@ -3702,13 +3701,12 @@ def warn_and_exit(snrexe,fortran):
print('Install it or use -fortran False. Exiting')
sys.exit()

def new_rinex3_rinex2(r3_filename,r2_filename,dec=1,gpsonly=False):
def new_rinex3_rinex2(r3_filename,r2_filename,dec,gpsonly,log):
"""
This code translates a RINEX 3 file into a RINEX 2.11 file.
It is assumed that the gfzrnx exists and that the RINEX 3 file is
Hatanaka uncompressed or compressed. (ending in rnx or crx)
if fileid is sent as an (optional) input parameter, log statements are printed to it
Parameters
----------
Expand All @@ -3722,6 +3720,8 @@ def new_rinex3_rinex2(r3_filename,r2_filename,dec=1,gpsonly=False):
decimation factor. If 0 or 1, no decimation is done.
gpsonly : bool
whether you want only GPS signals. Default is false
log : fileiD
this must have been defined before you call this code
Returns
-------
Expand All @@ -3737,20 +3737,21 @@ def new_rinex3_rinex2(r3_filename,r2_filename,dec=1,gpsonly=False):
gobblygook_gps = myfavoritegpsobs()

if not os.path.exists(gexe):
print('gfzrnx executable does not exist and this file cannot be translated. Exiting')
log.write('gfzrnx executable does not exist and this file cannot be translated. Exiting \n')
sys.exit()
if not os.path.exists(r3_filename):
print('RINEX 3 inputfile does not exist', r3_filename, ' Exiting')
log.write('RINEX 3 inputfile does not exist: {0:s} Exiting.\n'.format(r3_filename))
return fexists

if (lastbit == 'rnx'):
print('found Hatanaka decompressed version', r3_filename)
log.write('found Hatanaka decompressed version {0:s} \n'.format(r3_filename))
r3_filename_new = r3_filename
elif (lastbit == 'crx'):
print('found Hatanaka compressed version', r3_filename)
log.write('found Hatanaka compressed version {0:s} \n'.format(r3_filename))
#print('found Hatanaka compressed version', r3_filename)
r3_filename_new = r3_filename[0:-3] + 'rnx'
if not os.path.exists(crnxpath):
print('You need to install Hatanaka translator. Exiting.')
log.write('You need to install Hatanaka translator. Exiting.\n')
return fexists
s1=time.time()
subprocess.call([crnxpath, r3_filename])
Expand All @@ -3759,17 +3760,17 @@ def new_rinex3_rinex2(r3_filename,r2_filename,dec=1,gpsonly=False):
# removing the compressed version - will keep new version
subprocess.call(['rm', '-f', r3_filename ])
if os.path.exists(r3_filename_new):
print('Hatanaka Conversion successful ', r3_filename_new)
log.write('Hatanaka Conversion successful {0:s} \n'.format(r3_filename_new))
else:
print('file does not exist')
log.write('RINEX 3 file does not exist \n')
else:
print('I found neither a rnx or crx RINEX 3 file and those are the only ones allowed. Exiting')
log.write('I found neither a rnx or crx RINEX 3 file and those are the only ones allowed. Exiting \n')
return fexists

#print('decimate value: ', dec)
s1=time.time()
if os.path.exists(r3_filename_new):
print('Now Convert from RINEX 3 to RINEX 2.11')
log.write('Now Convert from RINEX 3 to RINEX 2.11\n')
if True:
if (dec == 1) or (dec == 0):
if (gpsonly):
Expand All @@ -3787,15 +3788,15 @@ def new_rinex3_rinex2(r3_filename,r2_filename,dec=1,gpsonly=False):
#except:
# print('Some kind of problem in translation from RINEX 3 to RINEX 2.11')
else:
print('RINEX 3 file I need does not exist, so no translation.', r3_filename_new)
log.write('RINEX 3 file I need does not exist, so no translation {0:s} \n'.format( r3_filename_new))

s2=time.time()

if os.path.exists(r2_filename):
print('RINEX 2.11 file now exists: ', r2_filename)
log.write('The RINEX 2.11 file now exists: {0:s} \n'.format(r2_filename))
fexists = True
else:
print('RINEX 2.11 file does not exist: ', r2_filename)
log.write('The RINEX 2.11 file does not exist: {0:s} \n'.format(r2_filename))


#print('remove RINEX3 rnx version of the file ',r3_filename_new)
Expand Down Expand Up @@ -5178,7 +5179,7 @@ def rapid_gfz_orbits(year,month,day):
return '', '', foundit

if (year + doy/365.25) > dday2:
print('Use the second way to download: ', url2)
#print('Use the second way to download: ', url2)
fullname = fdir + '/' + longname
if os.path.isfile(fullname):
foundit = True
Expand All @@ -5198,7 +5199,7 @@ def rapid_gfz_orbits(year,month,day):
return longname, fdir, foundit

else:
print('Try First way to download : ',url)
#print('Try First way to download : ',url)
fullname = fdir + '/' + littlename
if os.path.isfile(fullname):
foundit = True
Expand Down Expand Up @@ -5643,7 +5644,7 @@ def queryUNR_modern(station):
print('No station database was found.')
return 0, 0, 0
else:
print('Using database ', usedatabase)
#print('Using database ', usedatabase)
conn = sqlite3.connect(usedatabase)

c=conn.cursor()
Expand Down
12 changes: 6 additions & 6 deletions gnssrefl/karnak_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,19 +488,19 @@ def universal_rinex2(station, year, doy, archive,screenstats):
elif (archive == 'unavco'):
#url1 = 'https://data-idm.unavco.org/archive/gnss/rinex/obs/' + cydoy + dname + '.Z'
url1 = 'https://data.unavco.org/archive/gnss/rinex/obs/' + cydoy + dname + '.Z'
if screenstats:
print(url1)
#if screenstats:
# print(url1)
foundit,file_name = kelly.the_kelly_simple_way(url1, dname + '.Z')
if not foundit:
url2 = 'https://data.unavco.org/archive/gnss/rinex/obs/' + cydoy + oname + '.Z'
if screenstats:
print(url2)
#if screenstats:
# print(url2)
foundit,file_name = kelly.the_kelly_simple_way(url2, oname + '.Z')
elif (archive == 'special'):
#print('testing out new protocol at unavco')
url1 = 'https://data.unavco.org/archive/gnss/products/reflectometry/' + cydoy + oname + '.gz'
if screenstats:
print(url1)
#if screenstats:
# print(url1)
foundit,file_name = kelly.the_kelly_simple_way(url1, oname + '.gz')
# old way
#foundit, file_name = gogetit(dir1, oname, '.gz');
Expand Down
12 changes: 9 additions & 3 deletions gnssrefl/quickLook_cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def parse_arguments():
def quicklook(station: str, year: int, doy: int,
snr: int = 66, fr: int = 1, ampl: float = 7., e1: float = 5, e2: float = 25, h1: float = 0.5,
h2: float = 8., sat: int = None, peak2noise: float = 3., screenstats: bool = False, fortran: bool = None,
plt: bool = True, azim1: float = 0., azim2: float = 360., ediff: float = 2.0, delTmax : float=75.0, hires_figs : bool=False ):
plt: bool = True, azim1: float = 0., azim2: float = 360., ediff: float = 2.0,
delTmax : float=75.0, hires_figs : bool=False ):
"""
quickLook assessment of GNSS-IR results using SNR data. It creates two plots: one with periodograms for
Expand All @@ -69,7 +70,14 @@ def quicklook(station: str, year: int, doy: int,
analyzes station p041 on day of year 1 in the year 2023.
The periodogram would be restricted to RH of 1-10 meters.
quickLook p041 2023 1 -fr 20
Uses L2C frequency instead of GPS L1.
quickLook p041 2023 1 -azim1 10 -azim2 180
Only shows azimuths between 10 and 180
If your site name is in the GNSS-IR database (which is generated from the Nevada Reno geodesy group),
or in the local coordinates database,d
a standard refraction correction is applied. If not, it does not. This is most relevant for very very
tall sites, i.e. > 200 meters. Refraction models are always applied in the gnssir module.
Expand Down Expand Up @@ -159,7 +167,6 @@ def quicklook(station: str, year: int, doy: int,
"""

vers = 'gnssrefl version ' + str(g.version('gnssrefl'))
#print('You are running ', vers)


# make sure environment variables exist. set to current directory if not
Expand All @@ -170,7 +177,6 @@ def quicklook(station: str, year: int, doy: int,

exitS = g.check_inputs(station, year, doy, snr)


if exitS:
sys.exit()

Expand Down
2 changes: 1 addition & 1 deletion gnssrefl/quickLook_function2.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def quickLook_function(station, year, doy, snr_type,f,e1,e2,minH,maxH,reqAmp,pel

# apply elevation angle correction for simple refraction here
if irefr == 1:
print('found simple refraction parameters')
#print('found simple refraction parameters')
lsp={}; lsp['refraction'] = True
snrD[:,1] = gnssir_v2.apply_refraction_corr(lsp,snrD[:,1],quick_p,quick_T)
# restrict to DC limits
Expand Down
Loading

0 comments on commit a4a3032

Please sign in to comment.