Skip to content

Commit

Permalink
fixed bug in rinex2snr for rinex3 samplerate parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
kristinemlarson committed Nov 1, 2024
1 parent b2a7822 commit 0ed6f9d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## 3.11.0
I somehow managed to delete the samplerate input to rinex2snr. My Apologies.
It is back in now.

## 3.10.3
The parallel processing code (management of the spawned processes) was
causing the code to crash when calling
Expand Down
22 changes: 19 additions & 3 deletions gnssrefl/gnssir_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ def gnssir_guts_v2(station,year,doy, snr_type, extension,lsp, debug):
# make sure REFL_CODE/Files/station directory exists ...
g.checkFiles(station, '')

if 'azlist' in lsp.keys():
azlist = lsp['azlist']
if len(azlist) > 0:
print('Using an augmented azimuth angle list', azlist)
else:
azlist = [];
#print('no augmented elevation angle list')

if 'ellist' in lsp.keys():
ellist = lsp['ellist']
if len(ellist) > 0:
Expand All @@ -100,6 +108,15 @@ def gnssir_guts_v2(station,year,doy, snr_type, extension,lsp, debug):
ellist = [];
#print('no augmented elevation angle list')

variable_azel = False
if (len(ellist) >0) & (len(azlist) & 0) :
if len(ellist) == len(azlist) :
print('You are using a beta version of the code that sets')
print('variable elevation angle limits for different azimuth regions.')
print('Be careful! Especially for tall sites.')
variable_azel = True


# this is also checked in the command line - but for people calling the code ...
if ((lsp['maxH'] - lsp['minH']) < 5):
print('Requested reflector heights (', lsp['minH'], ',', lsp['maxH'], ') are too close together. Exiting.')
Expand Down Expand Up @@ -315,9 +332,9 @@ def gnssir_guts_v2(station,year,doy, snr_type, extension,lsp, debug):

# open output file
fout,frej = g.open_outputfile(station,year,doy,extension)
# main loop a given list of frequencies
total_arcs = 0
ct = 0
# the main loop a given list of frequencies
for f in freqs:
found_results = False
if plot_screen:
Expand All @@ -330,6 +347,7 @@ def gnssir_guts_v2(station,year,doy, snr_type, extension,lsp, debug):
logid.write('Looking at {0:4s} {1:4.0f} {2:3.0f} frequency {3:3.0f} ReqAmp {4:7.2f} \n'.format(station, year, doy,f,reqAmp[ct]))
logid.write('=================================================================================\n')
#print('**** looking at frequency ', f, ' ReqAmp', reqAmp[ct], ' doy ', doy, 'ymd', year, month, day )

# get the list of satellites for this frequency
if onesat == None:
satlist = find_mgnss_satlist(f,year,doy)
Expand Down Expand Up @@ -462,8 +480,6 @@ def gnssir_guts_v2(station,year,doy, snr_type, extension,lsp, debug):
write_out_arcs(newffile,x,y,secxonds,file_info,savearcs_format)
rj +=1
if screenstats:
#print(delT, tooclose,Noise,PkNoise)
#35.0 False 3.682862189099345 2.8

logid.write('FAILED QC for Azimuth {0:.1f} Satellite {1:2.0f} UTC {2:5.2f} RH {3:5.2f} \n'.format( iAzim,satNu,UTCtime,maxF))
#print('FAILED QC for Azimuth {0:.1f} Satellite {1:2.0f} UTC {2:5.2f} RH {3:5.2f}'.format( iAzim,satNu,UTCtime,maxF))
Expand Down
6 changes: 6 additions & 0 deletions gnssrefl/gps.py
Original file line number Diff line number Diff line change
Expand Up @@ -7401,10 +7401,16 @@ def greenland_rinex3(station,year,doy,**kwargs):
fdir = os.environ['REFL_CODE']
samplerate = kwargs.get('samplerate',1)
# this is dumb! should use the actual sample rate
# csrate = '{:02d}'.format(srate)
# am keeping it since sample rate it is not a required parameter.
if (samplerate == 1):
ch = '0000_01D_01S_MO'
elif (samplerate == 5):
ch = '0000_01D_05S_MO'
elif (samplerate == 2):
ch = '0000_01D_02S_MO'
elif (samplerate == 15):
ch = '0000_01D_15S_MO'
else:
ch = '0000_01D_30S_MO'

Expand Down
1 change: 1 addition & 0 deletions gnssrefl/rinex2snr.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def run_rinex2snr(station, year, doy, isnr, orbtype, rate,dec_rate,archive, nol
csrate = '01' # high rate assumes 1-sec
else:
csrate = '{:02d}'.format(srate)
print(csrate)
streamid = '_' + stream + '_'
# this can be done in a function now ...
r3cmpgz = station9ch + streamid + str(year) + cdoy + '0000_01D_' + csrate + 'S_MO.crx.gz'
Expand Down
13 changes: 10 additions & 3 deletions gnssrefl/rinex2snr_cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def parse_arguments():
parser.add_argument("-overwrite", default=None, help="boolean", type=str)
parser.add_argument("-translator", default=None, help="translator(fortran,hybrid,python)", type=str)
parser.add_argument("-stream", default=None, help="Set to R or S (RINEX 3 only)", type=str)
parser.add_argument("-samplerate", default=None, help="Sample rate (RINEX 3 only)", type=int)
parser.add_argument("-mk", default=None, help="use T for uppercase station names and non-standaard archives", type=str)
parser.add_argument("-weekly", default=None, help="use T for weekly data translation", type=str)
parser.add_argument("-monthly", default=None, help="use T for monthly data translation", type=str)
Expand Down Expand Up @@ -570,8 +571,11 @@ def rinex2snr(station: str, year: int, doy: int, snr: int = 66, orb: str = None,
# rinex3
# change default archive from all to cddis, cause we do not allow all as a valid archive for rinex3 files
if (archive == 'all'):
archive = 'cddis'
print('Because you did not choose one, using cddis as the archive to look at.')
if not nolook:
archive = 'cddis'
print('Because you did not choose one, using cddis as the archive to look at.')
else:
print('You have chosen the nolook option, so archive is irrelevant.')

if rate == 'high':
if (archive not in highrate_list) and (nolook == False):
Expand Down Expand Up @@ -622,7 +626,10 @@ def rinex2snr(station: str, year: int, doy: int, snr: int = 66, orb: str = None,
print('You have invoked the Makan option')

if stream not in ['R', 'S']:
stream = 'R'
# only check this for rinex 3
if ns == 9:
print('Your stream parameter is illegal, so setting it to R')
stream = 'R'

args = {'station': station, 'year':year, 'doy':doy, 'isnr': snr, 'orbtype': orb, 'rate': rate,
'dec_rate': dec, 'archive': archive, 'nol': nolook, 'overwrite': overwrite,
Expand Down

0 comments on commit 0ed6f9d

Please sign in to comment.