Wednesday, January 22, 2020

Viewing NetCDF Weather Files in Panoply

This is the text version. There is a video demo at the end of the note.

We get most of our digital weather data in GRIB format, but sometimes we need to look into special data or more often look into archived data that only exists in NetCDF (.nc) format. Here we outline the procedure for using the free program Panoply. We do so because there are nuances to its use, and the help files are limited. Both Mac and Windows versions are available. They are nearly identical.

We will use a HYCOM global ocean current file as an example. (Global HYCOM is archived, but global RTOFS is not.) When a file is opened in Panoply it looks like this:

The data on the right describes what is in the file, but only parts are in plain language.

(1) To plot the data, highlight dataset water_u, and then click Create Plot. Accept all defaults and click Create.  The plot shows up, but with little information showing, such as below.

(2) Now highlight dataset water_v and click Combine Plot.  The popup shows we will be combining it with dataset water_u. Click Combine.

(3) Now you will see essentially the same plot as before, but now there are two Array tabs. If you like, you can open the tabs to see the data.  Now we are ready to customize the plot.

(4) Create current vectors: Under Array(s) tab, in the top line, Plot [Map] of, change Array 1 - Array 2 to the bottom drop down called Vector Magnitude. You can also check the valid time and date of the data in this Array(s) tab.

(5) Set Scales: click Scales tab. Here is what the default looks like before we start:

5a) Under Units, change m.s-1 to knots, the last in the drop down. 
5b) Under Scale Range, set min = 0, and max = 2.5, and Enter or click somewhere else. Once you choose knots and min = 0, you can choose Fit to Data to see what the largest value is in view as a guide, but generally rely on your own knowledge of what the upper end is. There is also an interplay between this upper end and the tick spacing we address below.
5c) Under Scale Caption, select Custom, then type in "Current Speed (kts)."
5d)  For a cleaner display, in the Tick Format line, change major divisions to 5.

We end up with this panel:

This is now getting closer. Our top title is still wrong and the default vector is for 10.3 kts of current which is just a dot, so we have to fix that.  But first we use the Map tab to focus in on the region we want and more display options.

(6) Under the Map tab, we choose to center the display at Hawaii (20N, 156W) with a region of say, 600 miles in all directions, which we can approximate as 10º for width and height. 
6a) Note W Lon and S Lat are negative, so we enter Lon as -156E in this program. This can all be changed with keystrokes once we get set up.  
6b) Click Fix Proportions because our random choices will not match the projection in use. This correction will also have to be done frequently as we change the view with keystrokes. Once you Fix proportions, the original values we entered will be forced to consistent values. 
6c) This is also the place where you select the Lat-Lon grid and size of the labels. You can play with these to get what you want, including color and size of digits. Below is a sample we just set up where I changed default labels to red at 2º spacing... only to show the option, not that it looks better.

(7) Generally I do not change anything in the Overlays or Shading tabs. There are many graphic overlays to experiment with, and some may be better for near coastal displays, but this is just trial and error to check it out—just remember that the one that is likely best is called MWDB_Coasts_NA_1.cnob. There are also others at the Panoply site to be downloaded.

(8) The contours of fixed current speeds match the divisions shown on the colorbar for speeds, so if you want to change those, go back to the Scales tab to change them. To change thickness and color of the contours, use the Contours tab.

(9) In the Vectors tab, change the Reference Value from 10.3 to 1.0... And now it is looking like current data!

(10) To change the top label, go to the Labels tab, and you can change Title to "HYCOM Currents, 00z  July 15, 2018" for example. There are also several other labeling options.

(11) We look at more on-screen set up below, but there are various ways to output the data, as a saved image or KMZ file for Google Earth. You can also make the picture much bigger using options under Plot in the main menu bar. But it is only from within Panoply that we can digitally click and read actual values.


We are done it setting up the data presentation, now we go to looking at specific regions and reading the data using keyboard commands.

The keystroke commands are not well documented as far as I can tell. Here are the ones I have discerned, mostly by trial and error.  For Windows, change [Cmd] to [Windows key] and change [Opt] to to [Alt].

Remember there is no Cmd Z  or Ctrl Z undo command. Once it's done, you must repair things from the new view... that is why this list of commands is so valuable.

For zooming
Zoom out and center  = Cmd + Opt + Left click (cursor = circled -)
Zoom in and center  = Cmd + Left click  ... or right click   (cursor = circled +)
Regional Drag Zoom = right click and drag or Cmd + Left click and drag (cursor = L)
Panning done by recenter
Center display at cursor = Shift + left click  (cursor = crosshair)
Read data value at cursor
Opt + left click (cursor = ?)

If the picture gets hung up from too fast keystrokes, or you zoom into a few pixels, then try the Map tab and type in say 10º x 10º window size, and Fix Proportions.

Note that with most Blogspot images, you can click to see larger one, then on that one, right click and open in new tab, and then you can usually zoom in farther.

The above notes are in essence an outline for a video demo of this process, which I will link to here as soon as it is done.  Should add one for GRIB files as well.

Note that the format of the numbers on the color bar are determined by a set of programmer's codes in a drop down. Here is the summary of how a couple work.  This comes up in formating the ticks in the Scale tab.

Scale factors:   
the choice " %.xf " means show the value with x decimals, i.e., 
  • %.0f shows 1012
  • %.1f shows 1012.4
  • etc.

%.xG shows exponents with x digits, i.e., x=2, 1.0E+3 and x=3, 1.01E+3.

Once the settings are all as you want them for currents, or even more generally the vector combination of u and v components of any parameter, you can save these as default settings in the menu Plot, Save settings to Preferences.  Then next current file you open it will all be set up.

Another basic point not mentioned above is we have the Interpolate option turned on. This is set with a check box in the top right of the Array tab.  Generally we are safe running in interpolate mode which means the program creates data points in between the actual grid points of the data set. The HYCOM data is on a 1/12º grid,  meaning there is only forecasts every 1/12º of a degree (5 nmi). That is important for interpreting data near shore or around and between islands, but for open ocean this does not matter. The large eddies we see are often 100 to 300 nmi across.

Below is a view with interpolate shut off, which means there is only really 1 data point per square grid.

Notice from the Lat scale that these grids are just smaller than 0.10º square, which makes sense: 1/12 = 0.083º. Do not be misled by the number of arrows present; that is an artifact of the Spacing setting on the Vector tab.  If you did Option + left click you see the same value at each arrowhead with a grid.  Below is the same view with Interpolate turned on.

Now if you to Option + left click you get a different value at every arrowhead.

Video demo of the above exercise.


Solovieski said...

I just bough your Havaii by sextant book but it have a lot of type errors.
If you want I can send my comments to yours e mail. Thank you.

Solovieski said...

I just bought your book Havaii by sextant and it have a lot of type error.
If you want I can send my comments to yours e mail. Thank you.

David Burch said...

Yes, please do. We always appreciate that feedback. You can use Thanks again.

David Burch said...

We also have an errata online at

Mariana said...

Hello, I downloaded your emissions data - pm2.5 GFAS from CAMS, for the period from 2003 to 2018, however, when opening the file (NetCDF) in panoply, the variable appears as zero and without the possibility of viewing the data, only with "% 4G". I believe it is a simple tuning problem, but I have no one to turn to. Can you help me?

David Burch said...

Not sure I can help with that, but you might contact the author of the program, he is generally very helpful. There is an email at the Panoply page:

Unknown said...

Hi David. I downloaded Panoply to analyze some snow data, but when I want to make some changes in my plot, I can not see the Plot window (or preference window) in the bottom of my plot (Array, Scale, Grid,...etc). How can I do to integrate this window in the same page of my plot?

David Burch said...

I am sorry to say, but i believe a recent build has changed the user interface and i am not up to speed yet on the changes. It looks like the plot control panels are now accessed from links in the menu Window. Click the image then drop down menu Window to see the Arrays, Scale, etc. Each of these control windows will stay open at once, so with a large or second monitor you can push them there for fine tuning. They are no longer just tabs in the same window.

The developer's site linked above includes links to several discussion forums and FAQs that might help. There are experts there. I am a rank novice on this fine program.