Scripts¶
Temporary scripts by L. Viallon
2020-08 : This script is no longer maintained as GUI_Proreader also allow to generate and save plots with command line. It have been removed from snowtools.
usage: $SNOWTOOLS_CEN/plots/proReader.py [-h] [--point POINT] [-b BEGIN] [-e END] [-p [PLOT [PLOT ...]]] [--plot1D [PLOT1D [PLOT1D ...]]] [-d DATE] [--dateplot DATEPLOT [DATEPLOT ...]] [--title TITLE] [--datetitle DATETITLE] [--numeric] ncfile [ncfile ...]
Program to read one or several PRO.nc files and plot the temporal evolution of the vertical profile of a snowpack state variable (--plot)
or the temporal evolution of a scalar variable such as snowdepth (--plot1D)
or the snowpack profile at a given date (--dateplot)
Positional arguments: ncfile : PRO.nc path file or list of path files Optional arguments: -h, --help show this help message and exit --point POINT Number of the point to read in the case of a file with several simulation points. Default: 0 (first point) -b BEGIN, --begin BEGIN Specify the first date for a temporal plot if later than the first available date in the file. Accepted formats: YYYYMMDD YYYYMMDDHH -e END, --end END Specify the last date for a temporal plot if earlier than the last available date in the file.. Accepted formats: YYYYMMDD YYYYMMDDHH -d DATE Date to plot for an instantaneous plot. Default: last available date in the PRO.nc file -p [PLOT [PLOT ...]], --plot [PLOT [PLOT ...]] List of variables to plot in a temporal plot(maximum 6 variables). Possible values: [’pheat’, ’tel’, ’g2’,’g1’, ’age’, ’ram’, ’swe’, ’hist’, ’spher’, ’grain’,’temp’, ’rho’, ’gs’, ’ssa’, ’ep’, ’shear’, ’dend’] --dateplot DATEPLOT [DATEPLOT ...] List of variables to plot in an instantaneous plot. Same possible values. --title TITLE Title of a temporal plot --datetitle DATETITLE Title of an instantaneous plots --numeric Vertical dimension is numerical layer instead of real height. Default: false
Example of use to plot grain property over one file PRO.nc :
$SNOWTOOLS_CEN/plots/proReader.py PRO.nc -p grain
Development in progress:
It is also possible to use the GUI interface as a script (so without GUI !). Reminder for installing the software: (https://redmine.umr-cnrm.fr/projects/snowtools_git/wiki/Install). It will save the graph out.png. You're using the command:
proreader.py PRO_filename -n True [-t type of graph] [-a altitude] [-as aspect] [-s slope] [-m massif] [-d date] [-v variable]
Arguments:
PRO_filename is the path of PRO.nc file
-n True means that you don't want to use the GUI
-t is the type of graph ('standard', 'massif', 'membre')
As in the GUI, you're choosing a point with his caracteristics: altitude, aspect, slope (needed for all graphs) and massif if you're not choosing a massif graph. If there are several points selected, the first one is plotted.
-d date is YYYYMMDDHH
-v variable is in WSN_VEG, SNOWRO, SNOWTEMP, SNOWLIQ, SNOWDZ, SNOWDEND, SNOWSPHER, SNOWSIZE, SNOWSSA, SNOWSHEAR, RSN_VEG, ASN_VEG, ACC_RAT, NAT_RAT, SNOWIMP1, SNOWIMP2
NB: the 'membre' option is implemented for Meteo France 's files structure. All the member are separated in mb000, mb001, ... folder and the PRO-file has the same name inside each folder.
YOU MUST HAVE 'mb0' in your directory only once.
Typically, it should look like '/home/name/folder1/folder2/mb000/pro/PRO_file.nc' or '/home/name/folder1/folder2/mb000/PRO_file.nc' without 'mb0' in the name, folder1, folder2.
END: Development in progress