gnssrefl.subdaily module

gnssrefl.subdaily.apply_new_constraints(tv, azim1, azim2, ampl, peak2noise, d1, d2, h1, h2)

cleaning up the main code. this sorts data and applies various “commandline” constraints tv is the full set of results from gnssrefl

Parameters:
  • tv (numpy array) – lsp results

  • azim1 (float) – min azimuth (deg)

  • azim2 (float) – max azimuth (deg)

  • ampl (float) – required amplitude for periodogram

  • peak2noise (float) – require peak2noise criterion

  • d1 (int) – min day of year

  • d2 (int) – max day of year

  • h1 (float) – min reflector height (m)

  • h2 (float) – max reflector height (m)

Returns:

  • tv (numpy array) – edited from input

  • t (numpy of floats) – crude time for obs, in fractional days

  • rh (numpy of floats) – reflector heights (m)

  • firstdoy (int) – first day of year

  • lastdoy (int) – last day of year

gnssrefl.subdaily.flipit(tvd, col)

take RH values from the first and last day and attaches them as fake data to make the spline fit stable. Also fill the temporal gaps with fake data

Parameters:
  • tvd (numpy array of floats) – output of LSP runs.

  • col (integer) – column number (in normal speak) of the RH results in python-speak, this has one subtracted

Returns:

  • tnew (numpy array of floats) – time in days of year

  • ynew (numpy array) – RH in meters

gnssrefl.subdaily.flipit2(tvd, col)

take RH values from the first and last day and attaches them as fake data to make the spline fit stable. Also fill the temporal gaps with fake data

This version uses MJD rather than day of year for x-axis

Parameters:
  • tvd (numpy array of floats) – output of LSP runs.

  • col (integer) – column number (in normal speak) of the RH results in python-speak, this has one subtracted

Returns:

  • tnew (numpy array of floats) – time in days of year

  • ynew (numpy array) – RH in meters

gnssrefl.subdaily.fract_to_obstimes(spl_x)

this does not seem to be used

Parameters:
  • spl_x (numpy array) – fractional time

  • obstimes (numpy array) – datetime format

gnssrefl.subdaily.my_percentile(rh, p1, p2)

numpy percentile was crashing docker build this is a quick work around

Parameters:
  • rh (numpy array) – reflector heights, but could be anything really

  • p1 (float) – low percentage (from 0-1)

  • p2 (float) – high percentage (from 0-1)

Returns:

  • low (float) – low value (using input percentile)

  • highv (float) – high value (using input percentile)

gnssrefl.subdaily.output_names(txtdir, txtfile, csvfile, jsonfile)

figures out what the names of the outputs are going to be

I have modified this so it always returns plain txt. csv will simply be written out in addition.

this function no longer has much point.

Parameters:
  • txtdir (str) – the directory where the results should be written out

  • txtfile (str) – name of the output file

  • csvfile (bool) – cl input whether the output file should be csv format

  • jsonfile (bool) – cl input for whether the output file should be in the json format

Returns:

  • writetxt (bool) – whether output should be plain txt

  • writecsv (bool) – whether output should be csv format

  • writejson (bool) – whether output should be json format

  • outfile (str) – output filename

gnssrefl.subdaily.readin_and_plot(station, year, d1, d2, plt2screen, extension, sigma, writecsv, azim1, azim2, ampl, peak2noise, txtfile, h1, h2, kplt, txtdir, default_usage, hires_figs, fs, **kwargs)

Reads in RH results and makes various plots to help users assess the quality of the solution

This is basically “section 1” of the code

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

  • year (int) – full year

  • d1 (int) – first day of year evaluated

  • d2 (int) – last day of year evaluated

  • plt2screen (bool) – if True plots are displayed to the screen

  • extension (str) – allow user to specify an extension for results (i.e. gnssir was run using extension string)

  • sigma (float) – how many standard deviations away from mean you allow for the crude outlier detector.

  • writecsv (bool) – whether output is written in csv format.

  • azim1 (float) – minimum azimuth value (degrees)

  • azim2 (float) – maximum azimuth value (degrees)

  • ampl (float) – minimum LSP amplitude allowed

  • peak2noise (float) – minim peak2noise value to set solution good

  • txtfile (str) – name of plain text output file

  • h1 (float) – minimum reflector height (m)

  • h2 (float) – maximum reflector height (m)

  • kplt (bool) – special plot made

  • txtdir (str) – directory where the results will be written

  • default_usage (bool) – flag as to whether you are using this code for subdaily or for rh_plot. this changes the plots a bit.

  • hires_figs (bool) – whether to switch from png to eps

  • fs (int) – fontsize for figure axes

Returns:

  • tv (numpy array) – LSP results (augmented)

  • otimes (datetime object) – times of observations

  • fname (str) – initial result file - colated

  • fname_new (str) – result file with outliers removed

gnssrefl.subdaily.rhdot_correction2(station, fname, fname_new, pltit, outlierV, outlierV2, **kwargs)

Part two of subdaily. It computes rhdot correction and interfrequency bias correction for RH time series. This code assumes you have at least removed crude outliers in the previous section of the subdaily code.

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

  • fname (list of str) – input filename(s)

  • fname_new (str) – output filename for results

  • pltit (bool) – whether you want plots to the screen

  • outlierV (float) – outlier criterion, in meters used in first go thru if None, then use 3 sigma (which is the default)

  • outlierV2 (float) – outlier criterion, in meters used in second go thru if None, then use 3 sigma (which is the default)

  • delta_out (float, optional) – seconds for smooth output

  • txtdir (str) – if wanting to set your own output directory

  • apply_if_corr (bool, optional) – whether you want to apply the IF correction default is true

  • apply_rhdot (bool, optional) – whether you want to apply the rhdot correction default is true

  • gap_min_val (float, optional) – gap allowed in last spline, in hours

  • knots2 (int, optional) – a secondary knot value if you want the final output to use a different one than the one used for outliers and RH dot

gnssrefl.subdaily.spline_in_out(x, y, knots_per_day)
Parameters:
  • x (numpy of floats) – time of observations in fractional days

  • y (numpy of floats) – reflector heights in meters

  • knots_per_day (int) – number of knots per day

Returns:

  • xx (numpy of floats) – regularly spaced observations

  • spline(xx) (numpy of floats) – spline value at those times

gnssrefl.subdaily.write_out_header(fout, station, extraline, **kwargs)

writes out header for results file …

Parameters:
  • fout (fileID) –

  • station (str) – 4 character station name

  • extraline (bool) – not sure why this is here

gnssrefl.subdaily.write_subdaily(outfile, station, ntv, csv, extraline, **kwargs)

writes out the subdaily results. currently only works for plain txt

>> this code should be moved to the library

Parameters:
  • input (str) – output filename

  • station (str) – 4 character station name, lowercase

  • nvt (numpy multi-dimensional) – the variable with the LSP results read via np.loadtxt

  • csv (bool) – whether both csv and txt file should be written

  • extraline (bool) – whether the header has an extra line