CHIMPLOT

Documentation Notes


The Graphical User Interface (GUI) makes CHIMPLOT usage quite intuitive. Some features, however, need to be described explicitly.

Basic Operations
  • To open a NetCDF file, either use the Open button, or provide the file name as a command-line argument to chimplot.py
  • To see parameters of a variable in a NetCDF file, click on its name in the Variables List.
  • To select a variable in a NetCDF file, double-click on its name in the Variables List. This adds the variable's name to the list of selected variables (just above the Variables List).
  • To clear the selected variables list, double-click on it.
  • When two variables are selected, they are considered as components of a vector (e.g., 10m wind) to produce vector plots. 
  • After selecting a variable you might need to adjust its dimensions. A NetCDF file variable can have four dimensions, while CHIMPLOT can plot either 1D or 2D plots. So you need to fix some dimensions, by taking a slice or by averaging.
  • Index check boxes next to each dimension allow you to switch between coordinates (like longitude/latitude) and indices in the array.
  • To change Plot Properties (like contour plot type or line color), use the Plot Appearance Dialog.
Interactive vs Standard Mode

Interactive mode allows you to set the coordinates of a slice to plot by clicking somewhere at the current Figure, instead of typing them manually. Only clicking within the Active Figure works. Active Figure is the one which was last selected when pressing the Interactive button to switch to the Interactive mode. If you want to change the active figure you need to switch back to Standard mode, select a new Figure, and then press Interactive button again.


Overlapping several plots (Slices)

To overlap multiple plots (e.g., different fields within the same file or data coming from various files):
  1. Plot the fields (Slices) you want to overlap one-by-one, in any order
  2. Select them in the order you want them to be plotted by double-clicking on them in the Slices List
  3. Press the "Plot Slice(s)" button
  • Tip: You can change the Plot Properties of a selected Slice by calling the Plot Appearance Dialog right after selecting the Slice.

Note1: To select a Slice, double-click on its name on the Slices List. To clear selected Slices, double-click on the list of selected Slices (to the right of the Slices List).

Note2: to produce animations with multiple fields overlapped you need to use Templates (see below).


1D Plots


You can plot multiple 1D curves in any desired dimensions (e.g., time series or vertical profiles). If you check the two corresponding dimension check boxes (e.g., longitude + latitude), the coordinates or indices in the corresponding dimension Line Edits will be considered as the point's coordinate/index pairs instead of ranges. The remaining dimensions (one of them must be fixed, i.e., a fixed point or average) will define the 1D plots. E.g., when 'level' is fixed we get time series, and when 'time' is fixed we get vertical profiles. Other dimension combinations are also possible.
Animating through a dimension
  • To animate through a dimension:
    1. Select a variable to plot by double-clicking on its name in the Variables List
    2. Configure your slice using Dimension Line Edits and Check Boxes
    3. Select a dimension to animate using the Animate Combo Box: Time, Level, Y or X (its default value is "No Animation")
    4. Press the Plot button => you should get a new plot
    5. Start animating frame-by-frame using "<" and ">" buttons
    6. You can run the whole animation sequence within the range of values specified in the dimension Line Edit that corresponds to the selected animation dimension (Step 3). This is done by pressing the "<>" button after Step 4 or 5. This will also produce *.png images corresponding to each frame. You can later make an animated .gif image or a movie, e.g., using the ImageMagic software.
  • When using automatic contour/color levels in the Animation mode, their limits will be set to the min/max over the whole animation sequence. Those min/max values will be displayed in the window where you run CHIMPLOT, when you enter the Animation mode. You can then adjust the contour levels in the Plot Appearance dialog.
  • Animation speed depends on the plot type. Animating geographical maps (lon/lat slices) is fast only for non-interpolated 2D color plots. A good way to explore lon/lat animation sequences is to start with "Non-interpolated Cont." 2D Plot Type in the Plot Appearance dialog. Then you can choose another "2D Plot Type" for presentation purposes.
  • To improve this we'd need some Python/Matplotlib method for fast updating a plot created with 'contour'/'contourf', as currently done for 'pcolormesh' plots using the set_array method. If you have some ideas they would be very welcome!

The power of a mouse double-click:
  • On the list of available NetCDF variables: selects the variable. The variable short name appears in the selected variables Text Edit. One or two variables can be selected. Two variables are used for vector plotting and calculations
  • On the selected variables Text Edit: clears the selected variables
  • On the dimension range Text Edit (very useful!): sets the range to the maximum range in the dataset
  • On the produced slices list: adds a slice to the selected slices list for an operation to be done on one or more selected slices
  • On the selected slices Text Edit: clears the selected slices
Operations on plotted slices (Max, Sum, Variance, etc.)

Once a slice is plotted you can perform calculations on it. Operations currently supported are: Maximum/Minimum, Average, Sum, Difference, Variance, Standard Deviation, Vector Magnitude. So how do you perform those operations?
  1. Choose a variable to plot by double-clicking on it (e.g. O3). The variable appears in the Selected Variables List just above the Variables List. If two variables are selected they are considered as x-, y-components of a vector. So make sure to clear the Selected Variables List (by double-clicking on it) if necessary.
  2. Configure the Slice to plot. Suppose we need a horizontal map of the surface O3 maximum over the whole time period in the file. So we choose Level 0 (the 1st level), and the whole range of Times.
  3. Choose a dimension over which the operation is to apply. This is done using the animation dimension. By default its value is "No Animation". In our example we set it to "Time", to compute the maximum over time.
  4. Press "Plot" to start the animation mode. You'll see the figure for the 1st animation slide. What's more important you'll see a new slice in the Slices List at the bottom-left of the Main Window. 
  5. Select the current Slice by double-clicking on it. 
  1. Choose the operation to apply on the selected Slice. (It is Maximum in our example.) The Slice number will appear in the list of selected Slices at the bottom-right. If you chose a wrong Slice, double-click on the list to clear it and select the right Slice again.
  2. Press the "Calculate" button. A new Slice appears in the Slices List. In our example it is called "Maximum of [0]" where 0 refers to the first Slice we plotted (surface O3 map animated over time).
  3. Plot the resulting Slice: select it in the Slices List and press Plot Slice(s) button. If everything went OK you'll see the horizontal map of surface O3 maximum in our example.
  4. You can change the plot style (range of values, colormap, geographic projection, etc.) by selecting the Slice and then calling the Plot Appearance Dialog. Press the Plot Slice(s) button to plot the Slice with its new style.

Templates


Templates give the possibility to save parameters of a current plot for further automatic figure generation from a new data: e.g., for automatic daily forecasts.

Use Menu->File->Save Slice's Parameter File to generate a template file (ASCII) that corresponds to your last generated Slice in CHIMPLOT. Its name is template_slc-NN.par where NN is the last Slice number. Then you can use the Command-line Utility ./chimplotcm.py with this Template to create new figures.

Note1:
chimplotcm.py can also save Slice files readable from ipython -pylab (just like chimplot.py when run with the second command-line argument)

Note2:
To overlay multiple figures (e.g., temperature colormap + pressure contours + wind vectors) with chimplotcm.py, use several template files in quotes:

$ chimplotcm.py -fig PM10.png out.20090312_20090319_test.nc "w10.par PM10_test.par"


Using CHIMPLOT results in Interactive Python


After you create figures with Chimplot you can further process the corresponding data with the interactive Python ipython. You can do further processing using the Chimplot Class Library chimplotclass.py and/or the whole wealth of Scientific Python. This is done by saving Chimplot's Slice objects and reading them in a 'ipython -pylab' session. To do so just give the 2nd command-line argument to chimplot.py, which is the prefix of the slice files saved during CHIMPLOT session, e.g.:

$ ./chimplot.py out.20111203.nc CTL

This will cause chimplot to save all slices created during the session to files named 'CTL<slice parameters>'.

See the file loadSlice.py as an example of using Chimplot slices in interactive python sessions
CHIMPLOT is provided under the GNU General Public License
Copyright (C) Dmitry Khvorostyanov, 2013, Laboratoire de Météorologie Dynamique, Institut Pierre Simon Laplace