PP utilities: Examples


PRECIS vn1.8.2


The following examples demonstrate the basic functionality of the utilities for processing data in PP format which are available via the analysis tools graphical user interfaces. See section 6.4 of the PRECIS technical manual.

These utilities (and others), used for processing PP data, have extended functionality when used as command line scripts. See section 6.3.2 of the PRECIS technical manual.


Contents:

Description
Utility
Introduction
1.Data locations and filenames: cd, ls
2.Remove the rim from PP fields: pprr
3.Contents of PP files: ppfile
4.Create fields of statistics from PP fields: ppstats
5.Operate on and combine PP data: ppexpr
6.Regrid data: ppregrid
7.Aggregate data: ppaggregate
8.Convert PP data into ASCII format: pp2ascii
9.Remove the spin up period: ppmove
10.Produce timeseries text files: ppdata
11.Extract a subregion from PP files ppextract




Introduction


The most common processing tools and techniques for manipulating the PP data fields output by the regional climate model (RCM) are available through intuitive user interfaces. These interfaces require, for the most part, only a knowledge of where your data is on the computer and the type of processing that you wish to carry out. Two important tools which do not have user interfaces are ppmove and ppdata, which are dealt with in sections 9 and 10.

The analysis tools graphical user interfaces are accessed from the PRECIS user interface, from the Analysis Tools pull down menu.


Open the PRECIS user interface:

% precis &

Access the Analysis tools pull down menu:

$90.0^{\circ }$



1. Data locations and file names


Identify and list the names of PRECIS output data in PP format using standard Linux commands (cd and ls)


1. a) Move to the directory (i.e. folder) which contains the output data from the experiment with RUNID itkaa. This experiment is a baseline 1960 to 1990 simulation. (cd stands for 'change directory'.)

% cd $ARCHIVEDIR/itkaa


1. b) List the contents of this directory (ls stands for 'list' and the -l option gives a 'longer' listing with more information, such as file data and size).

% ls

% ls -l


2. a) List the files contained in directory 16222 (pressure at mean sea level).

Hint: * is a special character which translates as 'any character(s)'

% ls 16222

% ls 16222/*

% cd 16222

% ls

Move back to the previous directory ($ARCHIVEDIR/itkaa in this case)

% cd -


2. b) List all the files contained in directory 00001 (surface pressure) whose names start with 'itkaaa.ps' (i.e. all files containing seasonal mean data).

% ls 00001/itkaaa.ps*

% cd 00001

% ls itkaaa.ps*

% cd -


3. List the files which contain daily, monthly and seasonal mean data for 1.5m temperature (STASH code 03236).

% cd 03236

% # Anything after a hash (#) is just a comment

% ls itkaaa.pa* # Daily data

% ls itkaaa.pm* # Monthly mean data

% ls itkaaa.ps* # Seasonal mean data

Move up one directory in the tree

% cd ..


4. Display a description of STASH codes or find the STASH codes matching a particular description.

a. Find the full manual for the command.

% stash -h


b. Show descriptions of stash codes 3236, 16222 and 5216.

% stash 3236 16222 5216


c. Find all STASH codes of all with 'rain' or 'snow' in their description.

% stash rain

Note that not all of these quantities are available by default from the PRECIS model. See appendix C in the technical manual.


5. List the files which contain Geopotential Height (STASH code 16202).

% stash geopotential

% ls 16202/itkaaa.p*


6. List the file which contains the monthly mean total precipitation rate for April 1969 (STASH code 5216).

% ls 05216/itkaaa.pmg9apr.05216.pp


7. List the 12 files which contain monthly mean 1.5m temperature for the year 1986.

Hint: ? is a special character which translates as 'any single character'


The following commands all result in the same listing:

% ls 03236/itkaaa.pmi6*

% ls 03236/itkaaa.pmi6???.03236.pp

% ls 03236/itkaaa.pmi6???.*.pp

% ls 03236/*a.pmi6*



2. Remove the rim from PP fields: pprr


Purpose: Remove the rim from PP fields.


1. Remove the 8-point rim from all mean 1.5m temperature (STASH code 3236) files. Note the sizes of the original and new files.


2. Remove the 8-point rim from all data in the itkaa and itlaa archives which haven't already had their rim removed and automatically delete the original (full-sized) files.

Note: In all of the exercises from now on, it is assumed that the 8-point rim has been removed from the data being used.


3. Contents of PP files: ppfile


Purpose: Display a summary of a selected subset of the contents of PP files with the option of copying the selected PP fields to another file.


1.Show the contents of the file itkaaa.pmg2aug.03236.rr8.pp in directory $ARCHIVEDIR/itkaa/03236. How many PP fields are there in this file?


2. How many fields are there in the file itkaaa.psh9son.16203.rr8.pp? What do each of the fields represent?

Hint: Look at the LEVEL column of the output



4. Create fields of statistics from PP fields: ppstats


Purpose: Create PP fields of basic statistical quantities from fields of PP data. Can create minima, maxima, means, totals and standard deviations.

1. Create a PP field called max.pp which contains the maximum of daily mean 1.5m temperature during July over the period 1961 to 1990 and view it using the xconv utility.


2. Create two PP fields which contain the 1961 to 1990 mean and 2071 to 2100 means of December to February (DJF) pressure at mean sea level (STASH code 16222)


3. Create a PP field called total.pp which contains total soil moisture content for March April May 1990 seasonal mean.

Hint: Soil moisture content (STASH code 08223) is output from the model on each of the model's four soil levels and all four levels are grouped in the same file.



5. Operate on and combine PP fields: ppexpr


Purpose: Operate on and combine PP fields and/or numbers.

1. Convert the units of the data in the file itkaaa.pmh2aug.03236.rr8.pp from Kelvin (as ouput by the model) to Celsius by subtracting 273.15 from each point.


2. Convert all of the seasonal mean precipitation data from kg/m2/second (= mm/second) to mm/day, putting all of the output files in a new directory.


3. Find the difference between future and control period pressure at mean sea level for December to February.

Hint: Use the fields created previously with ppstats.



6. Regrid PP fields: ppregrid


Purpose: Regrid PP fields from one regular latitude-longitude grid to a different regular latitude-longitude grid.


1. Regrid RCM data to a 0.5 x 0.5 degree unrotated latitude-longitude grid.



7. Aggregate PP fields: ppaggregate


Purpose: Aggregate PP data from one regular latitude-longitude grid to a different regular latitude-longitude grid


1. Aggregate RCM data to a 1.875 (longitude) x 1.25 (latitude) grid degree unrotated latitude-longitude grid (which is the resolution of the driving GCM for this experiment)



8. Convert PP fields into ASCII format: pp2ascii


Purpose: Convert PP fields into ASCII plain text formats.

1. Convert mean 1.5m temperature for February 1969 into ASCII plain text format.



9. Remove the spin up period from the data: ppmove


Purpose: Move selected PP files to a new location.

There is no user interface for this utility. It is very simply used via the command line.

1. Move the spin up period from the baseline data set (itkaa). This data spans from 1st January 1960 to 1st December 1990 and the spin up period is all data valid before 1st December 1960.

% cd $ARCHIVEDIR
% ppmove -e itkaa/spinup -H 'vtime<1960,12,1' itkaa
% ls itkaa/spinup


2. Move the spin up period from the scenario data set (itlaa). This data spans from 1st January 2070 to 1st December 2100 and the spin up period is all data valid before 1st December 2070.

% cd $ARCHIVEDIR
% ppmove -e itlaa/spinup -H 'vtime<2070,12,1' itlaa
% ls $ARCHIVEDIR/itlaa/spinup



10. Produce timeseries text files from PP data: ppdata


Purpose: Create timeseries for selected locations or areas from PP files.

There is no user interface for this utility. It is very simply used via the command line.

1. Create a 30 year timeseries of monthly mean surface air temperature for whole regional model domain average.

% cd $ARCHIVEDIR/itkaa
% ppdata -x 03236/*a.pm*.rr8.pp

2. Create a 30 year timeseries of monthly mean surface air temperature in degrees Celcius (by subtracting 273.15 from the origin data in Kelvin) for whole regional model domain average.

% ppdata -f '-273.15' -x 03236/*a.pm*.rr8.pp

3. Create a 30 year timeseries of daily mean surface air temperature for whole regional model domain average.

% ppdata -f '-273.15' -x 03236/*a.pa*.rr8.pp

4. Create a 30 year timeseries of monthly mean precipition in mm/day (by multiplying the original mm/second data by 86400), for whole regional model domain average.

% cd $ARCHIVEDIR/itlaa
% ppdata -f '*86400' -x 05216/*a.pm*.rr8.pp

5. Create a 30 year timeseries of monthly mean precipition in mm/day (by multiplying the original data in mm/second data by 86400), for the grid cell containing Dhaka, Bangladesh (latitude 23.5N, longitude 90.1E).

% ppdata -f '*86400' -L '23.5,90.1,T' -x 05216/*a.pm*.rr8.pp

View the output data in a spreadsheet:

% ooffice -calc ppdata.txt



11. Extract a subregion from PP fields: ppextract


Purpose: Extract a rectangular subregion from PP fields.

0. Find the full manual for the command.

% ppextract -h


1. Create a new field of 1.5m temperature which contains just Bangladesh.

% cd $ARCHIVEDIR/itkaa

% xconv -i 03236/itkaaa.pmi9jun.03236.rr8.pp &

% ppextract -o new.pp -r "87,20,94,27" 03236/itkaaa.pmi9jun.03236.rr8.pp

% xconv -i new.pp &

% ppextract -f -o new2.pp -r "87,20,94,27" 03236/itkaaa.pmi9jun.03236.rr8.pp

% xconv -i new2.pp