FOAM Diagnostic Plots How-To

These instructions cover how to use the FOAM version of the NCAR AMWG Diagnostic package  

This package can do model-obs comparsions for atmosphere data only and model-model comparisons for all FOAM components.

There are two parts to using this package. First is to post-process your data into the necessary files. The second is to edit the main script which produces all the plots.

Back to User Resources


Preparing Data for Model - Observation Comparisons (ATM ONLY)

These instructions assume you have already postprocessed the PCCM3 output into netcdf files each containing 12 months of data (Jan-Dec).

You need to prepare several files. The first is a monthly ensemble file. The file should have 12 times corresponding to Jan-Dec where each time is an ensemble mean.

If you have have 30 files each with 12 monhts of data, you can make a 30 year ensemble with the command:
ncea -n 30,5,1 case.00045.nc case.mone4575.nc

NOTE: The string "mone" followed by the beginning and ending years of the average "4575" must be in the output filename as shown.

The second file contains 5 time records: 4 seasonal averages and one annual in the same file. This can also be made with the NCO utilities.

We'll start with an example for making a winter season average.
1. First, make an ensemble for each month of Dec, Jan and Feb
  ncea -F -d time,12  -n 100,5,1  case.00045.nc  case_12_climo.nc
  ncea -F -d time,1  -n 100,5,1  case.00045.nc  case_01_climo.nc
  ncea -F -d time,2  -n 100,5,1  case.00045.nc  case_02_climo.nc

NOTE: these files must have the "_0x_climo" string.

NOTE: another way to make these is to use ncks to pull off each month from the case.mone4575.nc

2.  Create a DJF ensemble.
  ncea case_12_climo.nc case_01_climo.nc case_02_climo.nc  djfe.nc

3.  Do 1 and 2 for  MAM (march, april, may), JJA, and SON.
 

4.  The Annual average can be made many ways. One is to use the seasonal averages you just made:

ncra djfe.nc mame.nc jja.nc son.nc anna.nc

5.  Cat them all together:
   ncrcat  djfe.nc mame.nc jjae.nc sone.nc anne.nc  case.seae4575.nc

6.  Change the names of three files.
     mv djfe.nc case_DJF_climo.nc
     mv jjae.nc case_JJA_climo.nc
     mv anna.nc case_ANN_climo.nc

Summary: You will need the following files in one directory:
case.mone4575.nc - 12 monthly ensemble averages of atmosphere data
case.seae4575.nc - 4 seasonal and 1 annual average
case_01_climo.nc - atmosphere January average
case_02_climo.nc - atmosphere February average
case_03_climo.nc - atmosphere March average
case_04_climo.nc - atmosphere April average
case_05_climo.nc - atmosphere May average
case_06_climo.nc - atmosphere June average
case_07_climo.nc - atmosphere July average
case_08_climo.nc - atmosphere August average
case_09_climo.nc - atmosphere September average
case_10_climo.nc - atmosphere October average
case_11_climo.nc - atmosphere November average
case_12_climo.nc - atmosphere December average
case_DJF_climo.nc - atmosphere DJF average
case_JJA_climo.nc - atmosphere JJA average
case_ANN_climo.nc - atmosphere ANN average


"case" can be any string
"4575" represents the first (45) and last (75) years of output used to make the ensembles. Use whatever numbers are appropriate for your case
The rest of the file naming convention indicated above must be followed.

 


Preparing the Data for Model - Model Comparisons

These instructions assume you have already postprocessed the FOAM output (atmosphere coupler and ocean) into netcdf files each containing 12 months of data (Jan-Dec)

For each model (atm, ocn, cpl) you wish to make figures for, you need to prepare two files. The first is a monthly ensemble file. The file should have 12 times corresponding to Jan-Dec where each time is an ensemble mean.

If you have have 30 files each with 12 monhts of data, you can make a 30 year ensemble with the command:
ncea -n 30,5,1 ha.case.00045.nc ha.case.mone4575.nc

NOTE: The string "mone" followed by the beginning and ending years of the average "4575" must be in the output filename as shown.

The second file contains 5 time records: 4 seasonal averages and one annual in the same file. This can also be made with the NCO utilities.

1.  We'll start with an example for making a winter season average.
First, make an ensemble for each month of Dec, Jan and Feb
  ncea -F -d time,12  -n 100,5,1  ha.case.00045.nc  ha.dece.nc
  ncea -F -d time,1  -n 100,5,1  ha.case.00045.nc  ha.jane.nc
  ncea -F -d time,2  -n 100,5,1  ha.case.00045.nc  ha.febe.nc
 

2.  Now create a DJF ensemble.

  ncea ha.dece.nc ha.jane.nc ha.febe.nc  ha.djfe.nc

 

3.  Do 1 and 2 for  MAM (march, april, may), JJA, and SON.
 

4.  The Annual average can be made many ways. One is to use the seasonal averages you just made:

ncra ha.djfe.nc ha.mame.nc ha.jja.nc ha.son.nc ha.anna.nc

5.  Now cat them all together with.
   ncrcat  ha.djfe.nc ha.mame.nc ha.jjae.nc ha.sone.nc ha.anne.nc  ha.case.seae4575.nc

For the atmosphere model, you'll need 4 additional files. Each file is an average of one month. You will need Jan, Apr, Jul and October averages. These are for SET 12, the vertical profile plots. Take the individual monthly ensembles you made above and rename them:
mv ha.jane.nc case_01_climo.nc
mv ha.apre.nc case_04_climo.nc
mv ha.jule.nc case_07_climo.nc
mv ha.octe.nc case_10_climo.nc
NOTE: these files do not start with "ha." and must have the "_0x_climo" string.

Summary: if you want to run all diagnostics (atm, cpl and ocn) you will need the following files in one directory (assuming 30 years starting at year 45):
ha.case.mone4575.nc - 12 monthly ensemble averages of atmosphere data
ho.case.mone4575.nc - the same for the ocean model
hc.case.mone4575.nc - the same for the coupler
ha.case.seae4575.nc - 4 seasonal and 1 annual average
ho.case.seae4575.nc - the same for the ocean model
hc.case.seae4575.nc - the same for the coupler
case_01_climo.nc - atmosphere January average
case_04_climo.nc - atmosphere April average
case_07_climo.nc - atmosphere July average
case_10_climo.nc - atmosphere October average

"case" can be any string
"4575" represents the first (45) and last (75) years of output used to make the ensembles. Use whatever numbers are appropriate for your case
The rest of the file naming convention indicated above must be followed.
You can run model-model for just one or two of the components in which case you don't need to make the data for the components not used.

 


Editing and Running the main script

The USER option in the script is for comparing FOAM output.  It allows you to compare the atmosphere, coupler, and ocean data to that of another FOAM run.  The OBS option will only compare atmosphere data to observational data.  In order to do this comparison, you will need to download the observational data found at the NCAR AMWG Diagnostic package homepage.  

1.  Open for editing the file diag_code/code/diag030429.csh.

2.  Edit the below items to match whatever type of comparison you would like to do:

 

Search for What you will find What it is for
WKDIR setenv WKDIR /a/directory/path/ location where the output plots will be written.
MSS_test MSS_test = 1 indicates if you want to get the test case files from mass storage. Only usefull when running at NCAR.
test_path test_path = /a/directory/path Path to input data for the test case.
test_prefix set test_prefix = F1_5.pictl the case name used in the filenames
test_suffix1 set test_suffix1 = 45 first year used in filename string mone4575
test_suffix2 set test_suffix1 = 75 last year used in the filename string mone4575
CNTL #set CNTL = xxxxxx  Indicates what the control type is.  Uncomment the correct line.
Currently the two types that work are OBS (model - obs) and USER(FOAM - FOAM)
cntl_path
cntl_prefix, etc.
set cntl_prefix = cas.name Same as above but for the Control case that will be differenced against the test case: test - control.  You do not need this if you are doing an observational comparison.
input_ha
input_ho
input_hc
set input_ha = 0
.................
Pick which model's output to process - ha, hc, and/or ho
Make sure they are all off if you are doing a observational comparison.
set_1 set set_1 = 1 Pick which set of plots you would like to create.  Note, sets 13+ are only available to use if you are doing a FOAM to FOAM comparison.
OBS_DATA setenv OBS_DATA If you are doing an observational comparison, set this to the location of the data.
DIAG_HOME setenv DIAG_HOME /location/of/the/package/ the path to diag_code
NCL set NCL = /where/ncl/is/located/ sets the location of ncl
NCARG_ROOT setenv NCARG_ROOT /where/ncl/is/located/ sets the environment variable NCARG_ROOT

3.  Run the shell script.  Ignore the warning messages that scroll by, but fatal errors are another story.  It may take about a half hour to run on a fast machine.

4.  When the script stops, go into the WKDIR to collect the results. You will see a bunch of postscript files and a tar file which contains a ready-to-go website with html and jpgs (or gifs) converted from the postscript files. To view the results, untar the file and point your browswer to the main *.htm file called "sets.htm".

Some things to note ....

-SET_12 allows you to select station locations.  If any of these are changed, the base html file 'diag_code/html/model1-model2_a/set12/ha_set12_2.htm' will also need to be modified.  Currently, the web pages used to view the plots are not created "on the fly" to reflect user choices.  These pages are hard coded.  Therefore, in order to view additional stations, they will be needed to be added to the web page template.

-Even if you only select one set of data (atm ocn or cpl) the main web page has links for all plots. There just won't be any figures for the ones you did not processes. The web pages are hardcoded, only the figures they point to change.

-There are many other options the user can change within the program.  The table above just shows you the options to get it running.  For example, the user can change if they'd like the *.ps files to be converted to *.jpg or *.gif.

-Not every option has been tried with this FOAM version of the script.


Corrections/Suggestions: mickelso@mcs.anl.gov