gnssrefl.phase_functions module
- gnssrefl.phase_functions.apriori_file_exist(station, fr)
reads in the a priori RH results
- Parameters:
station (string) – station name
fr (integer) – frequency
- Return type:
boolean as to whether the apriori file exists
- gnssrefl.phase_functions.convert_phase(station, year, year_end=None, plt2screen=True, fr=20, tmin=0.05, tmax=0.5, polyorder=-99, circles=False, subdir='', hires_figs=False)
Convert GPS phase to VWC. Using Clara Chew’s algorithm from Matlab write_vegcorrect_smc.m
https://scipy-cookbook.readthedocs.io/items/SignalSmooth.html
- Parameters:
station (str) – 4 char station name
year (int) – beginning year
year_end (int) – last year
plt2screen (boolean) – plots come to the screen
fr (integer) – frequency default is L2C (20)
tmin (float) – soil texture minimum
tmax (float) – soil texture maximum
polyorder (integer) – override on the polynomial order used in leveling
circles (boolean) – final plot using circles (instead of line)
subdir (str) – subdirectory for $REFL_CODE/Files
hires_figs (bool) – whether you want eps instead of png files created
- gnssrefl.phase_functions.daily_phase_plot(station, fr, datetime_dates, tv, xdir, subdir, hires_figs)
makes a plot of daily averaged phase
- Parameters:
station (str) – 4 char station name
fr (int) – frequency of signal
datetime_dates – datetime values for phase points
tv (list of results) – cannot remember the format
xdir (str) – location of the results (environment variable REFL_CODE)
subdir (str) – subdirectory in Files
hires_figs (bool) – whether you want eps instead of png files
- gnssrefl.phase_functions.filter_out_snow(station, year1, year2, fr, snowmask)
attempt to remove outliers from snow. only called if the snow filter file exists
- Parameters:
station (str) – four character station name
year1 (integer) – starting year
year2 (integer) – ending year
fr (integer) – frequency, i.e. 1 or 20
snowmask (str) – name/location of the snow mask file
- gnssrefl.phase_functions.load_avg_phase(station, fr)
loads a previously computed daily average phase solution. this is NOT the same as the multi-track phase results. This file is now stored in station subdirectory in $REFL_CODE/Files/
- Parameters:
station (str) – 4 character station ID, lowercase
- Returns:
avg_exist (boolean)
avg_date (??)
avg_phase (??)
- gnssrefl.phase_functions.load_sat_phase(station, year, year_end, freq)
Picks up the phase data from local results section return to main code whether dataexist, and np arrays of year, doy, hr, phase, azdata, ssat
- Parameters:
station (str) – four character station name
year (integer) – beginning year
year_end (integer) – ending year
freq (integer) – GPS frequency (1,20 allowed)
- Returns:
dataexist (bool) – whether data found?
year (numpy array of int) – full years
doy (numpy array of int) – days of year
hr (float) – fractional day (UTC)
ph (float) – phases (deg)
azdata (float) – azimuths (deg)
ssat (int) – satellites (deg)
rh (float) – reflector height (m)
amp (float) – amplitudes of peak LSP
results (??)
- gnssrefl.phase_functions.low_pct(amp, basepercent)
emulated amp_normK code from PBO H2O inputs are the amplitudes and a percentage used to define the bottom level. returns normalized amplitudes
this is meant to be used by individual tracks (I think) in this case they are the top values, not the bottom … ugh
- gnssrefl.phase_functions.make_snow_filter(station, medfilter, ReqTracks, year1, year2)
runs daily_avg code so you have some idea of when the soil moisture products are contaminated by snow. make a file with these years and doys saved
- Parameters:
station (str) – 4 ch station name
medfilter (float) – how much you allow the individual tracks to deviate from the daily median (meters)
ReqTracks (integer) – number of tracks to compute trustworthy daily average
year1 (integer) – starting year
year2 (integer) – ending year
- Returns:
snowmask_exists (boolean)
creates output file into a file $REFL_CODE/Files/snowmask_{ssss}.txt
- gnssrefl.phase_functions.normAmp(amp, basepercent)
emulated amp_normK code from PBO H2O inputs are the amplitudes and a percentage used to define the bottom level. returns normalized amplitudes this is meant to be used by individual tracks (I think) in this case they are the top values, not the bottom … ugh
- gnssrefl.phase_functions.phase_tracks(station, year, doy, snr_type, fr_list, e1, e2, pele, plot, screenstats, compute_lsp, gzip)
This does the main work of estimating phase and other parameters from the SNR files it uses tracks that were predefined by the apriori.py code
- Parameters:
name (station) – 4 char id, lowercase
year (integer) –
doy (integer) – day of year
snr_type (integer) – is the file extension (i.e. 99, 66 etc)
fr_list (list of integers) – frequency, [1], [20] or [1,20]
e1 (float) – min elevation angle (degrees)
e2 (float) – max elevation angle (degrees)
pele (list of floats) – elevation angle limits for the polynomial removal. units: degrees
screenstats (boolean) – whether statistics are printed to the screen
compute_lsp (boolean) – this is always true
gzip (boolean) – whether you want SNR files gzipped after running the code
track. (Only GPS frequencies are allowed because this relies on the repeating ground) –
- gnssrefl.phase_functions.read_apriori_rh(station, fr)
read the track dependent a priori reflector heights needed for phase & thus soil moisture.
- Parameters:
station (str) – four character ID, lowercase
fr (int) – frequency (e.g. 1,20)
- Returns:
results – column 1 is just a number (1,2,3,4, etc)
column 2 is RH in meters
column 3 is satellite number
column 4 is azimuth of the track (degrees)
column 5 is number of values used in average
column 6 is minimum azimuth degrees for the quadrant
column 7 is maximum azimuth degrees for the quadrant
- Return type:
numpy array
- gnssrefl.phase_functions.test_func(x, a, b, rh_apriori)
This is least squares for estimating a sine wave given a fixed frequency, freqLS
- gnssrefl.phase_functions.test_func_new(x, a, b, rh_apriori, freq)
This is least squares for estimating a sine wave given a fixed frequency, freqLS now freq is input so it is not hardwired for L2
- Parameters:
x (numpy array of floats) – sine(elevation angle) I think
a (float) – amplitude - estimated
b (float) – phase - estimated
rh_apriori (float) – reflector height (m)
freq (int) – frequency
- gnssrefl.phase_functions.vwc_plot(station, t_datetime, vwcdata, plot_path, circles)
makes a plot of volumetric water content
- Parameters:
station (string) – 4 ch station name
t_datetime (datetime) – observation times for measurements
vwcdata (numpy array of floats (I think)) – volumetric water content
plot_path (Saves a plot to) – full name of the plot file
circles (boolean) – circles in the plot. default is a line (really .-)
plot_path –
- gnssrefl.phase_functions.write_avg_phase(station, phase, fr, year, year_end, minvalperday, vxyz, subdir)
creates output file for average phase results
- Parameters:
station (string) –
phase (numpy list (float)) – phase values
fr (int) – frequency
year (int) – first year evaluated
year_end (int) – last year evaluated
minvalperday (int) – required number of satellite tracks to trust the daily average
compilation (vxyz is from some other) –
subdir (str) – subdirectory for results
- Returns:
tv – year doy - day of year meanph - mean phase value in degrees nvals - number of values that went into the average
- Return type:
numpy array with elements