gnssrefl.gnssir_v2 module
- gnssrefl.gnssir_v2.check_azim_compliance(az_min_ele, azlist)
Check to see if your arc is in one of the requested regions
- Parameters:
az_min_ele (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.convert_Hdates_mjd(Hdates, remove_hhmm)
takes a list of dates in format yyyy-mm-dd hh:mm and turns them into a list of mjd
- Parameters:
Hdates (list of str) – date strings in the format yyyy-mm-dd hh:mm
remove_hhmm (bool) – whether you want to ignore hh:mm
- Returns:
mjd_Hortho – modified julian dates of character string dates
- Return type:
list of floats
- 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, station_config, 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
station_config (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
- midnitebool
whether midnite arcs are alloweed
- dbhzbool
whether db-hz (True) or volts/volts (False) are used for SNR data
debug (bool) – debugging value to help track down bugs
- gnssrefl.gnssir_v2.gzip_migration(station_config, station, extension='')
Temporary migration (remove after 2027-01-01): old JSON configs had gzip defaulting to False due to a bug in gnssir_input. This function overrides gzip to True, updates the JSON on disk, and warns the user.
Call this after read_json_file() and before using station_config[‘gzip’]. Pass -gzip F on the command line to opt out.
- 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.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.
Uses new directory structure: - No extension: input/{station}/{station}.json with fallback to input/{station}.json - With extension: input/{station}/{extension}/{station}.json with fallback to input/{station}.{extension}.json
- Parameters:
station (str) – 4 character station name
extension (str) – subdirectory - default is ‘’
- Returns:
station_config
- Return type:
dictionary
- gnssrefl.gnssir_v2.retrieve_Hdates(a)
Retrieves character strings of dates and attempts to QC them.
- Parameters:
a (list of str) – online input to gnssir_input for Hdates
- Returns:
Hdate – full dates (2024-10-11 15:12) of Hortho values
- Return type:
list of str
- 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.window_new(snrD, f, satNu, ncols, pfitV, e1, e2, azlist, screenstats, fileid, dbhz, **kwargs)
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
dbhz (bool) – whether you want dbhz or linear SNR units
- 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