gnssrefl.gnssir_v2 module
- gnssrefl.gnssir_v2.apply_refraction_corr(lsp, ele, p, T)
- Parameters:
lsp (dictionary) – info from make_json_input such as station lat and lon
ele (numpy array of floats) – elevation angles (deg)
p (float) – pressure
T (float) – temperature (C)
- Returns:
ele – elevation angle (deg)
- Return type:
numpy array of floats
- gnssrefl.gnssir_v2.arc_name(sdir, satNu, f, arcnum, avgAzim)
creates filename for SNR arc output
- Parameters:
sdir (str) – output directory
satNu (int) – satellite number
f (int) – frequency
arcnum (int) – arc number
avgAzim (float) – average azimuth, degrees
- Returns:
newffile – filename of outputs
- Return type:
str
- gnssrefl.gnssir_v2.check_azim_compliance(initA, azlist)
Check to see if your arc is in one of the requested regions
- Parameters:
initA (float) – azimuth of selected arc (deg)
azlist (list of floats) – list of acceptable azimuth regions
- Returns:
keeparc – whether the arc is in a selected azimuth range
- Return type:
bool
- gnssrefl.gnssir_v2.find_mgnss_satlist(f, year, doy)
find satellite list for a given frequency and date
- Parameters:
f (integer) – frequency
snrExist (numpy array, bool) – tells you if a signal is (potentially) legal
year (int) – full year
doy (int) – day of year
- Returns:
satlist – satellites to use
- Return type:
numpy list of integers
- gnssrefl.gnssir_v2.gnssir_guts_v2(station, year, doy, snr_type, extension, lsp, debug)
Computes lomb scargle periodograms for a given station, year, day of year etc.
Arcs are determined differently than in the first version of the code, which was quadrant based. This identifies arcs and applies azimuth constraints after the fact.
2023-aug-02 trying to fix the issue with azimuth print out being different than azimuth at lowest elevation angle
if screenstats is True, it prints to a log file now, directory $REFL_CODE/logs/ssss
- Parameters:
station (str) – 4 character station name
year (int) – full year
doy (int) – day of year
snr_type (int) – snr file type
extension (str) – optional subdirectory to save results
lsp (dictionary) –
- e1float
min elev angle, deg
- e2float
max elev angle, deg
- freqs: list of int
frequencies to use
- minHfloat
min reflector height, m
- maxHfloat
max reflector height, m
- NReglist of floats
noise region for RH peak2noise , meters
- azval2list of floats
new pairs of azimuth regions, i.e. [0 180 270 360]
- delTmaxfloat
max allowed arc length in minutes
- pele: list of floats
min and max elev angle in DC removal
- PkNoisefloat
peak to noise value for QC
- edifffloat
elev angle difference for arc length, QC
- reqAmplist of floats
list of required periodogram amplitude for QC for each frequency
- ellist: list of floats
added 23jun16, allow multiple elevation angle regions
- apriori_rhfloat
a priori reflector height, used in NITE, meters
- savearcsbool
if true, elevation angle and detrended SNR data are saved for each arc default is False
- savearcs_formatstr
if arcs are to be saved, will they be txt or pickle format
debug (bool) – debugging value to help track down bugs
- gnssrefl.gnssir_v2.local_update_plot(x, y, px, pz, ax1, ax2, failure)
updates optional result plot for SNR data and Lomb Scargle periodograms
- Parameters:
x (numpy array) – elevation angle (deg)
y (numpy array) – SNR (volt/volt)
px (numpy array) – reflector height (m)
pz (numpy array) – spectral amplitude (volt/volt)
ax1 (matplotlib figure control) – top plot
ax2 (matplotlib figure control) – bottom plot
failure (boolean) – whether periodogram fails QC
- gnssrefl.gnssir_v2.make_parallel_proc_lists(year, doy1, doy2, nproc)
make lists of dates for parallel processing to spawn multiple jobs
- Parameters:
year (int) – year of processing
doy1 (int) – start day of year
2 (doy) – end day of year
- Returns:
datelist (dict) – list of dates formatted as year doy1 doy2
numproc (int) – number of datelists, thus number of processes to be used
- gnssrefl.gnssir_v2.make_parallel_proc_lists_mjd(year, doy, year_end, doy_end, nproc)
make lists of dates for parallel processing to spawn multiple jobs
- Parameters:
year (int) – year processing begins
doy (int) – start day of year
year_end (int) – year end of processing
doy_end (int) – end day of year
nproc (int) – requested number of processes to spawn
- Returns:
datelist (dict) – list of MJD
numproc (int) – number of datelists, thus number of processes to be used
- gnssrefl.gnssir_v2.new_rise_set(elv, azm, dates, e1, e2, ediff, sat, screenstats)
This provides a list of rising and setting arcs for a given satellite in a SNR file based on using changes in elevation angle
- Parameters:
elv (numpy array of floats) – elevation angles from SNR file
azm (numpy array of floats) – azimuth angles from SNR file
dates (numpy array of floats) – seconds of the day from SNR file
e1 (float) – min elevation angle
e2 (float) – max elevation angle
ediff (float) – el angle difference Quality control parameter
sat (int) – satellite number
- Returns:
tv – beginning and ending indices of the arc satellite number, arc number
- Return type:
numpy array
- gnssrefl.gnssir_v2.new_rise_set_again(elv, azm, dates, e1, e2, ediff, sat, screenstats, logid)
This provides a list of rising and setting arcs for a given satellite in a SNR file based on using changes in elevation angle
- Parameters:
elv (numpy array of floats) – elevation angles from SNR file
azm (numpy array of floats) – azimuth angles from SNR file
dates (numpy array of floats) – seconds of the day from SNR file
e1 (float) – min elevation angle (deg)
e2 (float) – max elevation angle (deg)
ediff (float) – el angle difference required, deg, QC
sat (int) – satellite number
screenstats (bool) – whether you want info printed to the screen
logid (fileid) – where the screen stat info is stored as a file
- Returns:
tv – beginning and ending indices of the arc satellite number, arc number, elev min, elev max
- Return type:
numpy array
- gnssrefl.gnssir_v2.onesat_freq_check(satlist, f)
for a given satellite name - tries to determine if you have a compatible frequency
- Parameters:
satlist (list) – integer
f (integer) – frequency
- Returns:
satlist – integer
- Return type:
list
- gnssrefl.gnssir_v2.open_gnssir_logfile(station, year, doy, extension)
opens a logfile when asking for screen output
- Parameters:
station (str) – 4 ch station name
year (int) – full year
doy (int) – day of year
extension (str) – analysis extension name (for storage of results) if not set you should send empty string
- Returns:
fileid – I don’t know the proper name of this - but what comes out when you open a file so you can keep writing to it
- Return type:
?
- gnssrefl.gnssir_v2.plot2screen(station, f, ax1, ax2, pltname)
Add axis information and Send the plot to the screen. https://www.semicolonworld.com/question/57658/matplotlib-adding-an-axes-using-the-same-arguments-as-a-previous-axes
- Parameters:
station (string) – 4 character station ID
- gnssrefl.gnssir_v2.read_json_file(station, extension, **kwargs)
picks up json instructions for calculation of lomb scargle periodogram This was originally meant to be used by gnssir, but is now read by other functions.
- Parameters:
station (str) – 4 character station name
extension (str) – subdirectory - default is ‘’
- Returns:
lsp
- Return type:
dictionary
- gnssrefl.gnssir_v2.read_snr(obsfile)
Simple function to load the contents of a SNR file into a numpy array
- Parameters:
obsfile (str) – name of the snrfile
- Returns:
allGood (int) – 1, file was successfully loaded, 0 if not. apparently this variable was defined when I did not know about booleans….
f (numpy array) – contents of the SNR file
r (int) – number of rows in SNR file
c (int) – number of columns in SNR file
- gnssrefl.gnssir_v2.rewrite_azel(azval2)
Trying to allow regions that cross zero degrees azimuth
- Parameters:
azval2 (list of floats) – input azimuth regions
- Returns:
azelout – azimuth regions without negative numbers …
- Return type:
list of floats
- gnssrefl.gnssir_v2.set_refraction_params(station, dmjd, lsp)
set values used in refraction correction
2024-aug-20, fixed the case where refraction is set to zero
- Parameters:
station (str) – 4 character station name
dmjd (float) – modified julian date
lsp (dictionary with information about the station) –
- latfloat
latitude, deg
- lonfloat
longitude, deg
- htfloat
height, ellipsoidal
- Returns:
p (float) – pressure, hPa
T (float) – temperature, Celsius
irefr (int) – refraction model number I believe, which is also sent, so not needed
e (float) – water vapor pressure, hPa
Tm (float) – temperature in Kelvin
la (float) – lapse rate
- gnssrefl.gnssir_v2.window_new(snrD, f, satNu, ncols, pfitV, e1, e2, azlist, screenstats, fileid)
retrieves SNR arcs for a given satellite. returns elevation angle and detrended linear SNR
2023-aug02 updated to improve azimuth calculation reported
2024-aug-15 testing out imposing pele values for DC removal. 2024-sep04 removed pele as input
- Parameters:
snrD (numpy array (multiD)) – contents of the snr file, i.e. 0 column is satellite numbers, 1 column elevation angle …
f (int) – frequency you want
satNu (int) – requested satellite number
ncols (int) – how many columns does the SNR file have
pfitV (float) – polynomial order
e1 (float) – requested min elev angle (deg)
e2 (float) – requested max elev angle (deg)
azlist (list of floats (deg)) – non-continguous azimuth regions, corrected for negative regions
screenstats (bool) – whether you want debugging information printed to the screen
fileid – log location
- Returns:
x (numpy array of floats) – elevation angle, degrees
y (numpy array of floats) – linear SNR with DC removed
Nvv (int) – number of points in x/y array
cf (float) – scale factor for requested frequency (used in LSP)
meanTime (float) – UTC hour of the day (GPS time)
avgAzim (float) – average azimuth of the arc (deg) ### this will not be entirely consistent with other metric
outFact1 (float) – kept for backwards compatibility. set to zero
outFact2 (float) – edot factor used in RH dot correction
delT (float) – arc length in minutes
secxonds (numpy array of floats) – hopefully seconds of the day
- gnssrefl.gnssir_v2.write_out_arcs(newffile, eangles, dsnrData, sec, file_info, savearcs_format)
Writes out files of rising and setting arcs analyzed in gnssir. Saved data are elevation angles, and SNR data with direct signal remoevd. The file location is the first input.
- Parameters:
newffile (str) – name of the output file
eangles (numpy array of floats) – elevation angles in degrees
dsnrData (numpy array of floats) – SNR data, with DC removed
sec (numpy array of floats) – seconds of the day (UTC, though really GPS time)
file_info (list) – satNu, f, avgAzim, year,doy,meanTime, docstring
savearcs_format (str) – whether file is txt or pickle