gnssrefl.rinex2snr module

class gnssrefl.rinex2snr.constants

Bases: object

c = 299792458
mu = 398600500000000.0
omegaEarth = 7.2921151467e-05
gnssrefl.rinex2snr.conv2snr(year, doy, station, option, orbtype, receiverrate, dec_rate, archive, translator)

convert RINEX files to SNR files

2024 March 29: change location of logs directory to below REFL_CODE

Parameters:
  • year (int) – full year

  • doy (int) – day of year

  • option (int) – snr choice (66, 99 etc)

  • orbtype (str) – orbit source (nav, gps, gnss, etc)

  • receiverrate (int) – sampling interval of the GPS receiver, e.g. 1, 30, 15

  • dec_rate (int) – decimation value to reduce file size

  • archive (str) – external location (archive) of the rinex files

  • translator (str) – hybrid, python, or fortran

gnssrefl.rinex2snr.elev_limits(snroption)

For given SNR option, returns elevation angle limits

Parameters:

snroption (integer) – snr file delimeter

Returns:

  • emin (float) – minimum elevation angle (degrees)

  • emax (float) – maximum elevation angle (degrees)

gnssrefl.rinex2snr.extract_snr(prn, con, obslist, obsdata, prntoidx, not_ij, emp)
gnssrefl.rinex2snr.get_local_rinexfile(rfile, localpath2)

look for a plain or gzipped version of the RINEX 2.11 file in the year subdirectories copies it to the local directory. this method stops the code from deleting your rinex files. As of 2023 September 19, it should also look for Hatanaka files.

localpath2 = os.environ[‘REFL_CODE’] + ‘/’ + cyyyy + ‘/rinex/’ + station + ‘/’

This is unlikely to work for uppercase RINEX files. Try the mk option

Parameters:
  • rfile (str) – version2 rinexfile name

  • localpath2 (str) – another location of the file (meant to be as defined above)

Returns:

allgood – whether file found

Return type:

bool

gnssrefl.rinex2snr.go_from_crxgz_to_rnx(c3gz, deletecrx=True)

checks to see if rinex3 file exists, gunzip if necessary, run hatanaka, if necessary

Parameters:
  • c3gz (str) – filename for a gzipped RINEX 3 Hatanaka file

  • bool (deletecrx =) – whether to delete the crx file

Returns:

  • translated (bool) – if file successfully found and available

  • rnx (str) – name of gunzipped and decompressed RINEX 3

gnssrefl.rinex2snr.navorbits(navfile, obstimes, observationdata, obslist, prntoidx, gpssatlist, snrfile, s1exist, s2exist, s5exist, up, East, North, emin, emax, recv, dec_rate, log)

Strandberg nav reading file?

Parameters:
  • navfile (string) –

  • obstimes

  • observationdata

  • obslist

  • prn2oidx

  • gpssatlist

  • snrfile (str) – name of the output file

  • s1exist

  • s2exist

  • s5exist

  • ! (This is for GPS only files) –

  • format (navfile is nav broadcast ephemeris in RINEX) –

  • info (inputs are rinex) –

  • obstimes

  • observationdata

  • prntoidx

  • gpssatlist

  • existence (various bits about SNR) –

  • name (snrfile is output) –

  • file (log is for screen outputs - now going to a) –

gnssrefl.rinex2snr.print_archives()

feeble attempt to print list of archives to screen …

gnssrefl.rinex2snr.quickname(station, year, cyy, cdoy, csnr)

creates filename for a local SNR file

Parameters:
  • station (str) – station name, 4 character

  • year (int) – full year

  • cyy (str) – two character year

  • cdoy (str) – three character day of year

  • csnr (str) – snr ending, i.e. ‘66’ or ‘99’

Returns:

fname – full filename including the directory

Return type:

str

gnssrefl.rinex2snr.readSNRval(s1exist, s2exist, s5exist, observationdata, prntoidx, sat, i)

what it looks like only reads GPS data for now interface between Joakim’s code and mine …

Parameters:
  • s1exist (boolean) –

  • s2exist (boolean) –

  • s5exist (boolean) –

Returns:

  • s1

  • s2

  • s5

gnssrefl.rinex2snr.rnx2snr(obsfile, navfile, snrfile, snroption, year, month, day, dec_rate, log)

Converts a rinex v2.11 obs file using Joakim’s rinex reading code

Parameters:
  • obsfile (str) – RINEX 2.11 filename

  • navfile (str) – navigation file

  • snrfile (str) – SNR filename

  • snroption (integer) – kind of SNR file requested

  • year (int) – full year

  • month (int) – calendar month

  • day (int) – calendar day

  • dec_rate (int) – decimation rate in seconds

gnssrefl.rinex2snr.run_rinex2snr(station, year, doy, isnr, orbtype, rate, dec_rate, archive, nol, overwrite, translator, srate, mk, stream, strip, bkg, screenstats, gzip)

main code to convert RINEX files into SNR files now works on a single year and doy

Parameters:
  • station (str) – 4 or 9 character station name. 6 ch allowed for japanese archive 9 means it is a RINEX 3 file

  • year (int) – full year

  • doy (int) – day of year

  • isnr (int) – SNR file type choice

  • orbtype (str) – orbit type, e.g. nav, rapid, gnss

  • rate (str) – general sample rate. high: use 1-Hz area in the archive low: use default area in the archive

  • dec_rate (integer) – decimation value

  • archive (str) – choice of GNSS archive

  • nol (bool) – True: assumes RINEX files are in local directory False (default): will look at multiple - or specific archive

  • overwrite (bool) – False (default): if SNR file exists, SNR file not made True: make a new SNR file

  • translator (str) – hybrid (default), fortran, or python hybrid uses fortran within he python code

  • srate (int) – sample rate for RINEX 3 files

  • mk (boolean) – makan option

  • strip (bool) – reduces observables to only SNR (too many observables, particularly in RINEX 2 files will break the RINEX translator)

  • bkg (str) – location of bkg files, EUREF or IGS

  • screenstats (bool) – whether print statements come to screen

  • gzip (bool) – whether SNR files are gzipped after creation

gnssrefl.rinex2snr.satorb(week, sec_of_week, ephem)

Calculate GPS satellite orbits

Parameters:
  • week (integer) – GPS week

  • sec_of_week (float) – GPS seconds of the week

  • ephem (ephemeris block) –

Returns:

the x,y,z, coordinates of the satellite in meters and relativity correction (also in meters), so you add, not subtract

Return type:

numpy array

gnssrefl.rinex2snr.satorb_prop(week, secweek, prn, rrec0, closest_ephem)

Calculates and returns geometric range (in metres) given time (week and sec of week), prn, receiver coordinates (cartesian, meters) this assumes someone was nice enough to send you the closest ephemeris returns the satellite coordinates as well, so you can use htem in the A matrix

Parameters:
  • week (integer) – GPS week

  • secweek (integer) – GPS second of the week

  • prn (integer) – satellite number

  • rrec0 (3vector) – receiver coordinates, meters

Returns:

SatOrbn – floats, Cartesian location of satellite in meters [x,y,z]

Return type:

3vector

gnssrefl.rinex2snr.satorb_prop_sp3(iX, iY, iZ, recv, Tp, ij)

for satellite number prn and receiver coordinates rrec0 find the x,y,z coordinates at time secweek

Parameters:
  • iX (float) –

  • iY (float) –

  • iZ (float) –

  • recv (3 vector, float) –

  • Tp

  • ij

  • it (sp3 has the orbit information in) –

gnssrefl.rinex2snr.the_makan_option(station, cyyyy, cyy, cdoy)

this ugly looking code checks a bazillion versions of RINEX versions (Z, gz, regular, hatanaka) both in the working directory and in an external rinex area $REFL_CODE/rinex/station/year

turns whatever it finds into a regular RINEX file in the working directory that file WILL be deleted, but it will not delete those stored externally.

Parameters:
  • station (str) – station name (4 ch)

  • cyyyy (str) – 4 ch year

  • cyy (str) – two ch year

  • cdoy (str) – three ch day of year