Contour Plots

From WikiROMS
Revision as of 23:22, 14 January 2008 by Robertson (talk | contribs) (New page: <div class="title">Contour Plots</div>__NOTOC__ The ROMS plotting package allows you to plot results for most variables at any depth. You can also overlay a reference field. {|class="toc...)
(change visibility) (diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
Contour Plots

The ROMS plotting package allows you to plot results for most variables at any depth. You can also overlay a reference field.


Table of Contents
1. Installation
2. Contour Plots
3. Cross-section Plots
4. Internal Plotting Parameters
5. Plotting Options
6. Plotting Fields
7. Raster Scripts


Configuration

There are two files that that control the output of the ROMS Plotting Package: default.cnt and the ccnt.in (or csec.in for Cross-section Plots) file. The default.cnt file controls the internal plotting parameters while the .in file determines what data to plot and how it will appear. At first you will not need to edit the default.cnt file so we will start with the .in file.

NOTE: default.cnt and the .in file can be named anything you want. This will become clear as we continue.

We suggest that you copy ccnt.in and default.cnt to the directory where you wish to create your plots.

  > cd ~/MyPlots
  > cp ~/MyDir/src/External/ccnt.in ccnt_temp.in
  > cp ~/MyDir/Data/default.cnt default.cnt

You may name the file whatever you like. I chose ccnt_temp.in because I will be plotting temperature. Open the .in file (ccnt_temp.in in this example) with your favorite editor. The first line of this file allows you to specify the year and starting year-day for your plots. If you do not want a time label make the year-day value less than 0:

  2007 -1      : year and starting year-day (use yearday<0, for no time label)

The next four lines are the plot title. Blank lines are fine but there must be four lines here. The text that you see on lines 2-5 are only a suggestion; you can put any text you like. I am plotting surface temperature from the ROMS 3.0 upwelling test case so my plot title looks like this:

  ROMS 3.0
  Upwelling Test Case
  Default Setup
  Temperature (Celsius)

The plotting options begin on line six and have short descriptions of what they do. For complete documentation on the plotting options read the Plotting Options page. I will annotate the options section to explain the choices I've made.

I only wish to plot one field and 23 is the field ID for potential temperature (FLDID).

  1     NFIELDS: number of fields to plot. Line below, field(s) types:
  23             field identification: FLDID(1:NFIELDS)

I only want to plot at the surface, which, in this case, is level 16.

  1     NLEVELS: number of depths/levels/isopycnals to plot (0 for all levels)
  16             depths (<0), levels (>0) or isopycnals (>1000) to plot

The next three options determine range and frequency of data that will be plotted from your input file(s). I have chosen "0" for all three which tells the plotting package to plot all records from my model output file.

  0     FRSTD  : first day (>0) or time record (<0) to plot
  0     LASTD  : last day (>0) or time record (<0) to plot
  0     DSKIP  : plot every other DSKIP day/record (see below)

FINDX can be ignored for this example but the line MUST remain in the file.

  1     FINDX  : forecast record to process, if any (atmospheric files only).

I am going to stick with linear interpolation so I leave this as "0"

  0     VINTRP : vertical interpolation scheme: 0=linear, 1:cubic splines

I have chosen to set the next two values because I know my temperature range already. If you do not know the range of your data you should enter 0.0 and the plotting package will calculate the minimum and maximum values. Using the defaults can lead to other problems because the minimum and maximum values are recalculated for each plot. This means you could end up with a different range and color bar for every frame, making visual analysis very difficult.

  17.0  PMIN   : field minimum value for color palette (0.0 for default)
  23.0  PMAX   : field maximum value for color palette (0.0 for default)

I do not want contour lines between the color bands so I will set the next option to 0.

  0     ICNT   : draw contours between color bands: 0=no, 1=yes

I am not plotting an iso-surface so I leave this at 0.0

  0.0   ISOVAL : iso-surface value to process (see below)

The next four options control how vectors are drawn. I am not drawing vectors in this plot so I can ignore these.

  1.2   VLWD   : vector line width (1.0 for default)
  4.0   VLSCL  : vector length scale (1.0 for default)
  2     IVINC  : vector grid sampling in the X-direction (1 for default)
  1     JVINC  : vector grid sampling in the Y-direction (1 for default)

The next five values control the overlay or reference field. Again we will ignore these in this example.

  0     IREF   : secondary or reference field option (see below)
  25    IDOVER : overlay field identification (for IREF=1,2 only)
  1     LEVOVER: level of the overlay field (set to 0 if same as current FLDLEV)
  0.0   RMIN   : overlay field minimum value to consider (0.0 for default)
  0.0   RMAX   : overlay field maximum value to consider (0.0 for default)

This determines the spacing between grid lines in the plot. 1.0 is good for this example.

  1.0   LGRID  : Desired longitude/latitude grid spacing (degrees)

The next four options control the map projection for the plots. I want a Mercator projection so I set IPROJ to 2.

  2     IPROJ  : map projection (see below).
  0.0   PLON   : projection Pole longitude (west values are negative).
  0.0   PLAT   : projection Pole latitude (south values are negative).
  0.0   ROTA   : projection rotation angle (clockwise; degrees).

I want color in the land. Level 2 is sufficient for this purpose. The levels are discussed later.

  2     LMSK   : flag to color mask land: [0] no, [>0] yes  (see below)

I don't want more than one plot per page so I can leave this alone.

  1    NPAGE  : number of plots per page (currently 1, 2, or 4)

There isn't a grid NetCDF file for the upwelling test problem so READGRD should be F.

  F     READGRD: logical switch to read in positions from grid NetCDF file.

I don't know what this does.

  F     PLTLOGO: logical switch draw Logo.

The next 5 options control plot titles captions and legends.

  T     WRTHDR : logical switch to write out the plot header titles.
  T     WRTBLAB: logical switch to write out the plot bottom title.
  T     WRTRANG: logical switch to write out data range values and CI.
  F     WRTFNAM: logical switch to write out input primary filename.
  F     WRTDATE: logical switch to write out current date.

They are no coastlines to plot for the upwelling test problem so this should be set to F.

  F     CST    : logical switch to read and plot coastlines and islands.

These values set to 0.0 for the upwelling test

   0.0   0.0   : bottom and top map latitudes (south values are negative).
   0.0   0.0   : left and right map longitudes (west values are negative).

The next seven lines specify the input files for the plots. The first line is the variables ID file. An example file exists in the Data directory of the plotting package source code and I will use it.

  ~/Mydir/Data/varid.dat

The second file sets the color palette file. Several palettes are included in the source code Palettes directory. I'm going to use the natlan1.pal file.

  ~/Mydir/Palettes/natlan1.pal

The third file sets the internal plotting parameters. We will discuss this file in detail later. An example file exists in the Data directory and I will use it.

  ~/Mydir/Data/default.cnt

The fourth file is your primary NetDCF file, usually model output. I will use my averages model output.

  ocean_avg.nc

The fifth file is you secondary NetCDF file, also usually model output. I am not using an overlay so this file doesn't matter and I'll set it to be the same as my primary NetCDF file.

  ocean_avg.nc

The sixth file is your grid NetCDF file. As mentioned above, the upwelling test case does not have a grid NetCDF file so I will again use my primary NetCDF file.

  ocean_avg.nc

The seventh file is you coastlines file. There are several coastline files in the Data directory. We set CST to F above so we need only a place holder here. I use /dev/null but you can put anything.

  /dev/null

Save the ccnt_temp.in file and you're ready to plot some results.

Plotting

Now that we have created an input file for ccnt we can start creating our plots. First, let's make sure ccnt and idt are in our path and the NCARG_ROOT environment variable is set.

  > which ccnt
  /home/robertson/bin/ccnt
  
  > which idt
  /home/robertson/ncl-5.0.0/bin/idt
  
  > printenv NCARG_ROOT
  /home/robertson/ncl-5.0.0

if your shell cannot find ccnt you need to add PLT_BINDIR to your path. the NCARG_ROOT environment variable should be set to the location of your NCL install. See the Installation page for more details. If you have an existing 'gmeta' file that you want to keep you should first rename it so ccnt does not replace it. To create the plots execute the following command.

  > ccnt < ccnt_temp.in

You will see some information about each frame scroll by. When the program finishes you will have a file named gmeta in the current directory. Now you can use idt to view your plots.

  > idt gmeta &

This will bring up the idt viewer with a blank plot. To see the first frame click the idt play.gif button. You should see a plot similar to the following.

File:upwelling temp ccnt.gif

Clicking the idt play.gif button repeatedly will advance to the frames of the gmeta file. I suggest you take some time to experiment with the controls in the idt window.


Prev: Installation