From 69f8753cf3d5fa1988470c84b77ca377c22987c4 Mon Sep 17 00:00:00 2001 From: kristinemlarson Date: Fri, 1 Nov 2024 18:24:42 -0700 Subject: [PATCH] fixed bug for samplerate input to rinex2snr --- CHANGELOG.md | 2 +- README.md | 2 +- gnssrefl/download_rinex.py | 2 +- gnssrefl/gps.py | 42 ++++++++++++++---------------------- gnssrefl/karnak_libraries.py | 2 +- gnssrefl/rinex2snr.py | 12 ++++++----- gnssrefl/rinex2snr_cl.py | 8 ++++--- pyproject.toml | 2 +- 8 files changed, 33 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f189ce468..08a00a4a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/README.md b/README.md index fbc804d19..5be7472e7 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/gnssrefl/download_rinex.py b/gnssrefl/download_rinex.py index 271a17d08..4880dcb6c 100644 --- a/gnssrefl/download_rinex.py +++ b/gnssrefl/download_rinex.py @@ -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: diff --git a/gnssrefl/gps.py b/gnssrefl/gps.py index 5245e1a49..753e92c06 100644 --- a/gnssrefl/gps.py +++ b/gnssrefl/gps.py @@ -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 @@ -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 @@ -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 ------- @@ -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): @@ -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 diff --git a/gnssrefl/karnak_libraries.py b/gnssrefl/karnak_libraries.py index 8b0352f67..12adb23f2 100644 --- a/gnssrefl/karnak_libraries.py +++ b/gnssrefl/karnak_libraries.py @@ -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: diff --git a/gnssrefl/rinex2snr.py b/gnssrefl/rinex2snr.py index e50e097f2..fd2c8b511 100644 --- a/gnssrefl/rinex2snr.py +++ b/gnssrefl/rinex2snr.py @@ -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) @@ -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 ... @@ -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)) diff --git a/gnssrefl/rinex2snr_cl.py b/gnssrefl/rinex2snr_cl.py index 52a5dd3a9..e4f09a80a 100644 --- a/gnssrefl/rinex2snr_cl.py +++ b/gnssrefl/rinex2snr_cl.py @@ -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'): @@ -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 @@ -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() diff --git a/pyproject.toml b/pyproject.toml index 947d5c8b8..f98f7847a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = [