CESM exercise II: view and discuss model output

From Interactive System for Ice sheet Simulation
Jump to: navigation, search

Back to Thursday, March 24th

View the results

Now we will look at some output from your IG run. When a run completes successfully, output is written to several archive directories. Let's look at some archived files:

> cd ~/your_name/swgfs/archive/IGcase/
> ls

You will see directories corresponding to different model components. The "rest" directory contains restart files that are needed to continue an earlier run without starting over from the beginning. Restart files are useful for long simulations that can take several days, weeks, or even months to complete.

Let's look in the land directory:

> cd lnd
> ls

There are two subdirectories called hist and logs. First look at the log file:

> cd logs
> ls

You will likely have two compressed log files, one for your 5-day run and the other for your multiyear run. Unzip the second one (which will have a later time stamp):

> gunzip lnd.log.yymmdd-hhmmss.gz
> less lnd.log.yymmdd-hhmmss

You can go quickly to the end of the file by typing <Shift><g>. You will see something like this at the end:

> Successfully wrote local restart file ./IG_f19g16.clm2.r.0002-01-01-00000

This means that just before finishing, CLM wrote a restart file so that it can start later where it left off.

Now let's look at the CLM history files:

> cd ../hist
> ls

You should see one file for each month of the run. The .nc suffix means that these are netCDF files. The netCDF format is commonly used for climate model output. This format is 'self-describing', which means that the file contains not only lots of data, but also 'metadata' with useful information about the data.

Each of the monthly files contains a number of monthly average fields. This command will tell you about the contents of the first monthly file:

> ncdump -h IGcase.clm2.h0.0001-01.nc | less

(The symbol just before 'less' is the pipe symbol. On an American keyboard is is located on the right side of the keyboard above the forward slash.) Hit the space bar repeatedly to scroll through the output.

Note the following:

  • The grid has 96 cells in the latitude direction and 144 cells in the longitude direction.
  • There are some time-independent variables (e.g., area, topo) with lower-case names.
  • There are many time-dependent variables with names in all caps.

We can visualize the data using the program ncview. To look at the output from January of year 6, type this:

> ncview IGcase.clm2.h0.0006-01.nc

A blue window will appear on your screen. First, choose a field to view. Put your cursor over the box that says (176)2d vars and hold down the left mouse button. You will see a long list of fields. Keeping the button held down, position the cursor over the name of the field you want to look at and release the mouse button.

Let's look at the surface air temperature field. Move the cursor to the field labeled 'TSA' and release the left mouse button. You will see a map of global surface air temperature. Note the color bar on the control panel. To make the map larger, click on the box labeled 'MX3' using the left mouse button. To make the map smaller, click using the right mouse button.

Similarly, you can view output from July of year 6:

> ncview IGcase.clm2.h0.0006-07.nc

Notice the difference in the surface air temperature 'TSA'.

Next, we will view the field 'QICE'. This is the surface mass balance of glaciated grid cells in units of mm/s. (To convert to the more useful units of m/yr, you would multiply by 3.16e4.) Values are positive where the ice is growing and negative where ice is melting.

Look at the annual average file for year 6:

> ncview IGcase.h1.0006-01-01-00000.nc

There are fewer variables in this file, so you can simply click on the box labeled 'QICEYR'. You should see a global plot of QICE on the global land grid. You can see QICE for glaciated cells not only in Greenland and Antarctica, but also in the Alaskan coastal range, Patagonia, and (if you look carefully) the Himalayas and Canadian Archipelago. Note that the annual surface mass balance is positive for almost all of Antarctica. The mass balance is positive for most of Greenland, except for a patch in the southwest part of the ice sheet.

Recall that the surface mass balance is computed in CLM for multiple elevation classes and then downscaled to the ice sheet grid in CISM. Let's see what the mass balance looks like after downscaling. First go to the directory with GLC history files:

> cd ~/your_name/swgfs/archive/IGcase/glc/hist
> ls

View the first file:

> ncview IGcase.cism.h.0001-01-01-00000.nc

You will see several 2D fields. First, view the ice thickness, thk. The thickness of the ice sheet does not change much during this short run.

Next, look at the surface mass balance, which in CISM is called acab (for accumulation/ablation). The units are m/yr. At time zero, the mass balance is zero. Near the bottom of the panel, click on the current time box to advance by one year at a time. Watch how the surface mass balance changes.

Given constant atmospheric forcing from year to year, the model must run for several decades before the mass balance approaches a steady state. But the general pattern is apparent after a few simulation years. For unaltered NCEP forcing, the pattern is as follows:

  • In most of the ice sheet, the mass balance is small and positive (yellow shading).
  • In the southeast, the mass balance is large and positive (orange shading).
  • In the southwest and in some coastal regions, the mass balance is negative (red, green and blue shading).

These features are fairly realistic. The pattern would be improved if the surface mass balance were computed in CLM at higher (1 degree) resolution.

Remember that you were running a climate change experiment. Depending on the size of the temperature change, you may or may not see similar features in your CISM history file.

Next, put your CISM history file in a common directory where others can look at it. First, rename this file according to the temperature experiment you were running. If you increased the surface air temperature by 3 degrees, you would type this:

> cp IGcase.cism.h.0001-01-01-00000.nc cism.h.tp3.nc

where tp3 means that you added 3 degrees to the temperature.

Similarly, you would type this if you lowered the temperature by 3 degrees:

> cp IGcase.cism.h.0001-01-01-00000.nc cism.h.tm3.nc

where tm3 means that you subtracted 5 degrees from the temperature.

After renaming your file, please put it in a common directory, /mnt/swgfs/pub/CISM_history. If your file were called cism.h.tp3.nc, you would type

> cp cism.h.tp3.nc /mnt/swgfs/pub/CISM_history

Now change to that directory:

> cd /mnt/swgfs/pub/CISM_history
> ls

If time permits, you can compare your file to other files in this directory. The control file, with zero temperature change, is called cism.h.control.nc.

Optional exercise: Using NCO

Supppose we are interested in viewing fields from the last year of the run, averaged over 12 months.

We can post-process the data using NCO, a suite of programs for useful manipulation of netCDF files. For details, see http://nco.sourceforge.net/.

Go to the directory with CLM history files:

> cd ~/swgfs/archive/IGcase/lnd/hist

To average all the history variables over 12 months, use the ncra command:

> ncra -n 12,2,1 infile.nc outfile.nc

The -n command tells NCO to average over files that have the same name as infile.nc, apart from a numerical file identifier.

  • The '12' indicates that there are 12 files to average.
  • The '2' says that the identifier has 2 digits (01, 02, ..., 12)
  • The '1' says that the identifier changes with a stride of 1.

The outfile name is arbitrary. For our case we can type:

> ncra -n 12,2,1 IGcase.clm2.h0.0010-01.nc IGcase.clm2.h0.0010-avg.nc
> ls

To view the contents of the new file:

> ncdump -h IGcase.clm2.h0.0010-avg.nc | less

Suppose we are mainly interested in the surface mass balance, and not all the other files. By using the -v option, we can make an annual average file that contains only the variable QICE:

> ncra -v QICE -n 12,2,1 IGcase.clm2.h0.0010-01.nc IGcase.clm2.h0.0010-QICE.nc

The resulting file has just one time-dependent variable QICE, a function of lat, lon and time:

> ncdump -h IGcase.clm2.h0.0010-QICE.nc

Let's try ncview again:

> ncview IGcase.clm2.h0.0010-QICE.nc

You should see a global plot of QICE on the global land grid. We can see QICE for glaciated cells not only in Greenland and Antarctica, but also in the Himalayas, Canadian archipelago, Alaskan coastal range, and Patagonia.

The units of QICE are mm/s (or equivalently, kg/m2/s). If you prefer m/yr, you can change the units in the file using the ncflint command:

> ncflint -w 3.16e4,0 IGcase.clm2.h0.0010-QICE.nc IGcase.clm2.h0.0010-QICE.nc IGcase.clm2.h0.0010-QICEmyr.nc

where the factor 3.16e4 converts from mm/s to m/yr.

(This syntax can be interpreted as follows. The form of the command is

> ncflint -w weight1, weight2 infile1.nc infile2.nc outfile.nc

with the result that variables in the output file have values outfile_var = weight1*infile1_var + weight2*infile2_var. If weight2 = 0, then infile2 is irrelevant and the effect is simply to multiply variables in infile1 by a constant.)

Next, let's compute the surface mass balance integrated over the Greenland ice sheet. NCO has a command for this too:

> ncwa -N -v QICE -a lat,lon -B 'gris_mask > 0.5' -w area -N IGcase.clm2.h0.0010-avg.nc outfile.nc 

where

  • -N says to compute the integrated total as opposed to the average.
  • -v tells which variable(s) to sum and/or average over
  • -a tells which dimensions to sum over
  • -B says to sum only over cells that meet a masking condition (in our case, Greenland cells have gris_mask = 1.0, and all other cells have gris_mask = 0.0)
  • -w says to weight by the variable that follows (grid cell area in this case)

Let's look at the output:

> ncdump outfile.nc

We're interested in the area-integrated value of QICE. Note that area has units of km2, whereas QICE has units of mm/s. To convert to km3/yr, multiply the result by 3.16e7 (the number of seconds in a year) and divide by 1e6 (the number of mm in a km). Recall that 1 km3 (liquid water equivalent) of ice weighs 1 Gigaton.

For the present-day (or at least preindustrial) climate of Greenland, the net surface mass balance is ~300 to 400 km3/y. How do your results compare?