Skip to content

Commit

Permalink
fixed bug for samplerate input to rinex2snr
Browse files Browse the repository at this point in the history
  • Loading branch information
kristinemlarson committed Nov 2, 2024
1 parent 0ed6f9d commit 69f8753
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 39 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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
## 3.10.4
I somehow managed to delete the samplerate input to rinex2snr. My Apologies.
It is back in now.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# gnssrefl v3.10.3
# gnssrefl v3.10.4

gnssrefl is an open source software package for GNSS Interferometric Reflectometry (GNSS-IR).
When showing results created using gnssrefl, please use:
Expand Down
2 changes: 1 addition & 1 deletion gnssrefl/download_rinex.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def download_rinex(station: str, year: int, month: int, day: int, rate: str = 'l
else:
rnx_filename,foundit = ch.bkg_highrate(station, year, d, 0,stream,dec,bkg)
if archive == 'gnet':
rnx_filename, foundit = g.greenland_rinex3(station,year,doy,stream=stream,samplerate=samplerate)
rnx_filename, foundit = g.greenland_rinex3(station,year,doy,stream,samplerate)

if archive == 'ga':
if debug:
Expand Down
42 changes: 16 additions & 26 deletions gnssrefl/gps.py
Original file line number Diff line number Diff line change
Expand Up @@ -7351,7 +7351,7 @@ def print_version_to_screen():
print('gnssrefl version:', str(version('gnssrefl')), '\n')
return

def greenland_rinex3(station,year,doy,**kwargs):
def greenland_rinex3(station,year,doy,stream,samplerate):
"""
downloads RINEX3 files from GNET. Returns hatanaka and gzipped file.
Could uncompress and convert, but downstream code expects *crx.gz
Expand All @@ -7362,6 +7362,10 @@ def greenland_rinex3(station,year,doy,**kwargs):
You must have installed lftp on your own. (gnssrefl will not do it for you).
stream and samplerate parameters REQUIRED
Only allows one day files
Parameters
----------
station : str
Expand All @@ -7370,12 +7374,10 @@ def greenland_rinex3(station,year,doy,**kwargs):
full year
doy : int
day of year
streamID : str
optional stream ID (R or S)
default is R
samplerate : optional, int
default is 1
only 30 or 1 is allowed
stream : str
stream ID
samplerate : int
seconds
Returns
-------
Expand All @@ -7388,6 +7390,9 @@ def greenland_rinex3(station,year,doy,**kwargs):
crnxpath = hatanaka_version()

found = False
cdoy = '{:03d}'.format(doy)
cyyyy = str(year)

filename = ''
checking = subprocess.call(['which','lftp'])
if (checking == 1):
Expand All @@ -7399,28 +7404,13 @@ def greenland_rinex3(station,year,doy,**kwargs):
# information for accessing GNET with appropriate filename
archive = 'gnet'
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'

userinfo_file = fdir + '/Files/passwords/' + archive + '.pickle'
streamID = kwargs.get('stream_ID','R')
streamID = '_' + streamID + '_'
csrate = '{:02d}'.format(samplerate)
ch = '0000_01D_' + csrate + 'S_MO'

userinfo_file = fdir + '/Files/passwords/' + archive + '.pickle'
streamID = '_' + stream + '_'

cdoy = '{:03d}'.format(doy)
cyyyy = str(year)
serve = '@ftp.dataforsyningen.dk; cd /GNSS/RINEX3/GRL/'

# define file names
Expand Down
2 changes: 1 addition & 1 deletion gnssrefl/karnak_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def universal(station9ch, year, doy, archive,srate,stream,debug=False):
print('Download took ',np.round(s2-s1,2), ' seconds')
return file_name,foundit
if archive == 'gnet':
foundit,file_name = g.greenland_rinex3(station9ch,year,doy,stream=stream,samplerate=srate)
foundit,file_name = g.greenland_rinex3(station9ch,year,doy,stream,srate)
return foundit, file_name

try:
Expand Down
12 changes: 7 additions & 5 deletions gnssrefl/rinex2snr.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def run_rinex2snr(station, year, doy, isnr, orbtype, rate,dec_rate,archive, nol
sample rate for RINEX 3 files
mk : bool
makan option
stream : str
naming parameter for RINEX 3 files (R or S)
strip : bool
reduces observables to only SNR (too many observables, particularly in RINEX 2 files
will break the RINEX translator)
Expand Down Expand Up @@ -220,10 +222,10 @@ def run_rinex2snr(station, year, doy, isnr, orbtype, rate,dec_rate,archive, nol
if version == 3:

log.write('RINEX Version 3 \n')
if rate == 'high':
csrate = '01' # high rate assumes 1-sec
else:
csrate = '{:02d}'.format(srate)
#if rate == 'high':
# csrate = '01' # high rate assumes 1-sec
#else:
csrate = '{:02d}'.format(srate)
print(csrate)
streamid = '_' + stream + '_'
# this can be done in a function now ...
Expand Down Expand Up @@ -289,7 +291,7 @@ def run_rinex2snr(station, year, doy, isnr, orbtype, rate,dec_rate,archive, nol
r2, fexists= g.ga_highrate(station9ch,year,doy,dec_rate,deleteOld)
log.write('RINEX 2 file derived from the GA archive should now exist: {0:s} \n'.format(r2))
if archive == 'gnet':
rnx_filename,foundit = g.greenland_rinex3(station9ch, year, doy,samplerate=srate,stream=stream )
rnx_filename,foundit = g.greenland_rinex3(station9ch, year, doy,stream,srate)
#print(rnx_filename,foundit)
if foundit:
log.write('The RINEX 3 file has been downloaded. Try to make {0:s} \n '.format(r2))
Expand Down
8 changes: 5 additions & 3 deletions gnssrefl/rinex2snr_cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ def rinex2snr(station: str, year: int, doy: int, snr: int = 66, orb: str = None,
# adding spanish archive
highrate_list = ['unavco', 'nrcan', 'ga','bkg','cddis','ignes','bkg-igs','bkg-euref','gnet']
if ns == 9:
print('Station ', station, ' >>> RINEX 3')
# rinex3
# change default archive from all to cddis, cause we do not allow all as a valid archive for rinex3 files
if (archive == 'all'):
Expand All @@ -589,12 +590,13 @@ def rinex2snr(station: str, year: int, doy: int, snr: int = 66, orb: str = None,
sys.exit()
else:
# rinex2
print('Station ', station, ' >>> RINEX 2.11')

if rate == 'high':
if archive == 'all':
if (archive == 'all') & (not nolook):
# not really allowed for highrate ...set to something reasonable like unavco
archive = 'unavco'
if archive not in highrate_list:
if (archive not in highrate_list) :
if nolook:
print('You have chosen nolook, so I will proceed assuming you have the RINEX file.')
# change to lowrate since the code only uses low vs high for retrieving files from
Expand All @@ -604,7 +606,7 @@ def rinex2snr(station: str, year: int, doy: int, snr: int = 66, orb: str = None,
print('You have chosen highrate option. But I do not support this archive: ',archive)
sys.exit()
else:
if archive not in archive_list:
if (archive not in archive_list) & (not nolook):
print('You picked an archive that is not allowed. Exiting')
print(archive_list)
sys.exit()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "mesonpy"

[project]
name = "gnssrefl"
version = "3.10.3"
version = "3.10.4"
description = "A GNSS reflectometry software package "
readme = "README.md"
maintainers = [
Expand Down

0 comments on commit 69f8753

Please sign in to comment.