gnssrefl.quickplt module
- gnssrefl.quickplt.main()
- gnssrefl.quickplt.parse_arguments()
- gnssrefl.quickplt.run_quickplt(filename: str, xcol: str, ycol: str, errorcol: int = None, mjd: bool = False, xlabel: str = None, ylabel: str = None, symbol: str = None, reverse: bool = False, title: str = None, outfile: str = None, xlimits: str = None, ylimits: float = [], ydoy: bool = False, ymd: bool = False, ymdhm: bool = False, filename2: str = None, freq: int = None, utc_offset: int = None, yoffset: float = None, keepzeros: bool = False, sat: str = None, yoffset2: float = None, scale: float = 1.0, scale2: float = 1.0, elimits: float = [0], azlimits: float = [0], plt: bool = True)
quick file plotting using matplotlib
A png file is saved as temp.png or to your preferred filename if outfile is given. In either case, it goes to REFL_CODE/Files
Allows you to set x and y-axis limits with a title and various axes labels, symbols etc.
Someone could easily update this to include different filetypes (e.g. jpeg)
I rewrote this recently to take advantage of our boolean argument translator. Let me know if things have broken or submit a PR.
To make simple plots of observables in SNR files, the x-axis can be either time or elevation. The latter is short for elevation angle. To pick this option set -sat to a specific satellite nubmer or a constellation (gps, glonass, etc). You can also set elimits and azlimits for simple elevation angle and azimuth angle limits. Only for SNR files, you can send the name of the SNR file without the directory, i.e. sc021500.22.snr66 instead of /Users/Files/2022/snr/sc02/sc021500.22.snr66
You may submit a filename that has been gzipped. The code will checked to see if the gzip version is there and gunzip it for you.
Examples
- quickplt txtfile 1 16
would plot column 1 on the x-axis and column 16 on the y-axis
- quickplt sc021500.22.snr66 time L1 -sat gps
would plot all the GPS L1 SNR data for the given SNR file, with time on the x-axis column 1 on the x-axis and SNR data on the y-axis You have to set -sat or it will not work. For a specific satellite number, provide that instead of gps. The other allowed x-axis option is elevation which is short for elevation angle.
- quickplt txtfile 1 16 -xlabel Time
would plot column 1 on the x-axis and column 16 on the y-axis and add Time on the x-axis label
- quickplt txtfile 1 16 -xlabel “Time (sec)”
would plot column 1 on the x-axis and column 16 on the y-axis and add Time (sec) on the x-axis label, but need quote marks since you have spaces in the x-axis labe.
- quickplt txtfile 1 16 -reverse T
would plot column 1 on the x-axis and column 16 on the y-axis it would reverse the y-axis parameter as you might want if you are ploting RH but want it to have the same sense as a tide gauge.
- quickplt txtfile 1 3 -errorcol 4
would plot error bars from column 4
- quickplt txtfile 1 3 -errorcol 4 -ydoy T
would plot error bars from column 4 and assume columns 1 and 2 are year and day of year
- quickplt txtfile 1 4 -mjd T
assume column 1 is modified julian day
- quickplt txtfile 1 16 -ylimits 0 2
would restrict y-axis to be between 0 and 2
- quickplt txtfile 1 16 -outfile myfile.png
would save png file to $REFL_CODE/Files/myfile.png
- quickplt snrfile 4 7
Assuming you submitted a standard SNR file, it would plot the L1 data (column 7) vs time (seconds of the day in column 4). Zeroes would be removed, but you can toggle that to keep it.
- quickplt snrfile 2 7
Assuming you submitted a standard SNR file, it would plot the L1 data (column 7) vs elevation angle (degrees in column 2).
- quickplt snrfile 4 8 -sat 25
Assuming you submitted a standard SNR file, it would plot the data for satellite 25 for L2 data (column 8) vs time (seconds of the day in column 4).
- quickplt snrfile 4 8 -sat 22
Assuming you submitted a standard SNR file, it would plot the data for Glonass satellite 22 for L2 data (column 8) vs time (seconds of the day in column 4).
- Parameters:
filename (str) – name of file to be plotted
xcol (str) – column number in the file for the x-axis parameter for snrfiles, you can say time or elevation
ycol (str) – column number in the file for the y-axis parameter for snrfiles, you can say L1, L2, or L5
errorcol (int, optional) – column number for the error bars
mjd (bool, optional) – code will convert MJD to datetime (for xcol)
xlabel (str, optional) – label for x-axis
ylabel (str) – label for y-axis
symbol (str, optional) – prescribe the marker used in the plot . It can include the color, i.e. ‘b.’ or ‘b^’
reverse (bool, optional) – to reverse y-axis limits
title (str, optional) – title for plot
outfile (str, optional) – name of png file to store plot
xlimits (list of str,) – xaxis limits if you selected any time options (ymd, mjd, ydoy,mjd), the code assumes a format of yyyyMMdd (year,month,day)
ylimits (list of floats, optional) – yaxis limits
ydoy (bool, optional) – if columns 1 and 2 are year and doy, the x-axis will be plotted in obstimes you should select column 1 to plot
ymd (bool, optional) – if columns 1,2,3 are year, month, date. So meant for plots with daily measurements - not subdaily.
ymdhm (bool, optional) – if columns 1-5 are Y,M,D,H,M then x-axis will be plotted in obstimes
filename2 (str) – in principle this allows you to make plots from two files with identical formatting but I am not sure that it one hundred percent always works
freq (int, optional) – use column 11 to find (and extract) a single frequency
utc_offset (int, optional) – offset time axis by this number of hours (for local time) this only is used when the mjd option is used
yoffset (float) – add or subtract to the y-axis values
keepzeros (bool, optional) – keep/remove zeros, default is to remove
sat (str) – satellite number for SNR file plotting for all gps satellites, say gps instead of a number similar for glonass, galileo, and beidou
yoffset2 (float) – add or subtract to the y-axis values in filename2
scale (float) – multiply all y-axis values in file 1 by this value
scale2 (float) – multiply all y-axis values in file 2 by this value
elimits (list of floats) – if SNR file is plotted, elevation angle limits are applied
azlimits (list of floats) – if SNR file is plotted, azimuth angle limits are applied
plt (bool) – whether you want the plot to be displayed on the screen. png file is always created.