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:
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.
- Set Input Directory to $ARCHIVEDIR/itkaa/03236
- Leave Input File(s) blank
- Leave Output Directory blank
- Leave Output File blank
- Set the number of grid points to remove: Remove West:
8 South: 8 East: 8 North:
8 Grid Points
- Click Run pprr
- Check the new files:
% cd $ARCHIVEDIR/itkaa/03236
% ls -l
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.
- Set the Input Directory to $ARCHIVEDIR/itkaa
- Leave Input File(s) blank
- Leave Output Directory blank
- Leave Output File blank
- Set the number of grid points to remove: Remove West:
8 South: 8 East: 8 North:
8 Grid Points
- Check the box Delete input files (8 point rims only)
- Click Run pprr
- Check the new files:
% cd $ARCHIVEDIR/itkaa
% ls */*
- Set the Input Directory to $ARCHIVEDIR/itlaa
- Leave Input File(s) blank
- Leave Output Directory blank
- Leave Output File blank
- Set the number of grid points to remove: Remove West:
8 South: 8 East: 8 North:
8 Grid Points
- Check the box Delete input files (8 point rims only)
- Click Run pprr
- Check the new files:
% cd $ARCHIVEDIR/itlaa
% ls */*
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?
- Set Input Directory to $ARCHIVEDIR/itkaa/03236
- Set Input File(s) to itkaaa.pmg2aug.03236.rr8.pp
- Leave Output File blank
- Check the box File Description
- Click Run ppfile
- Check the box Basic Statistics
- Click Run ppfile
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
- Set Input Directory to $ARCHIVEDIR/itkaa/16203
- Set Input File(s) to itkaaa.psh9son.16203.rr8.pp
- Leave Output File blank
- Check the box File Description
- Click Run ppfile
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.
- Set the Input Directory to $ARCHIVEDIR/itkaa/03236
- Set the Input File(s) to itkaaa.pa??jul.03236.rr8.pp
- Leave the Output directory blank
- Set the Output File to $ARCHIVEDIR/max.pp
- Set the Statistic to max
- Click Run ppstats
- Check the new file:
% xconv -i $ARCHIVEDIR/max.pp
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)
- Set the Input directory to $ARCHIVEDIR/itkaa/16222
- Set the Input file(s) to itkaaa.ps??djf.16222.rr8.pp
- Set the Output directory to $ARCHIVEDIR
- Set the Output file to pmsl_djf_baseline.pp
- Set the Statistic to mean
- Click Run ppstats
- Check the new file:
% xconv -i $ARCHIVEDIR/baseline_pmsl_djf.pp
- Set the Input directory to $ARCHIVEDIR/itlaa/16222
- Set the Input file(s) to itlaaa.ps??djf.16222.rr8.pp
- Set the Output directory to $ARCHIVEDIR
- Set the Output file to pmsl_djf_future.pp
- Set the Statistic to mean
- Click Run ppstats
- Check the new file:
% xconv -i $ARCHIVEDIR/future_pmsl_djf.pp
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.
- Leave the Input directory blank
- Set the Input file(s) to $ARCHIVEDIR/itkaa/08223/itkaaa.psj0mam.08223.rr8.pp
- Set the Output file to $ARCHIVEDIR/sum.pp
- Set the Statistic to sum
- Click Run ppstats
- Check the new file:
% xconv -i $ARCHIVEDIR/sum.pp
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.
- Set Input File(s) 1 or Input Directory to
$ARCHIVEDIR/itkaa/03236/itkaaa.pmh2aug.03236.rr8.pp
- Leave Input File 2 blank
- Leave Output Directory blank
- Set Output File to $ARCHIVEDIR/celcius.pp
- Set Constant for use in operation to 273.15
- Set Mathematical operator to subtract: -
- Click Run ppexpr
- Compare the input and output files:
% xconv -i $ARCHIVEDIR/itkaa/03236/itkaaa.pmh2aug.03236.rr8.pp &
% xconv -i $ARCHIVEDIR/celcius.pp
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.
- Set Input file(s) 1 or Input Directory to
$ARCHIVEDIR/itkaa/05216/*a.ps*
- Leave Input File 2 blank
- Set Output Directory to $ARCHIVEDIR/mm_per_day
- Leave Output File blank
- Set Constant for use in operation to 86400.0
- Set Mathematical operator to multiply: *
- Click Run ppexpr
- Compare an input and output file:
% cd $ARCHIVEDIR/mm_per_day
% ls
% xconv -i $ARCHIVEDIR/itkaa/05216/itkaaa.psi9jja.05216.rr8.pp &
% xconv -i itkaaa.psi9jja.05216.rr8.expr.pp
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.
- Set Input File(s) 1 or Input Directory to $ARCHIVEDIR/pmsl_djf_baseline.pp
- Set Input File 2 to $ARCHIVEDIR/pmsl_djf_future.pp
- Leave Output Directory blank
- Set Output File to $ARCHIVEDIR/pmsl_djf_difference.pp
- Set Mathematical operator to subtract: -
- Click Run ppexpr
- Check the new file:
% xconv -i $ARCHIVEDIR/pmsl_djf_difference.pp
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.
- Set the Input directory to $ARCHIVEDIR/itkaa/03236
- Set the Input file to itkaaa.psj0mam.03236.rr8.pp
- Set the Output directory to $ARCHIVEDIR
- Set the Output file to regridded.pp
- Set the output resolution: Regrid to: dx 0.5
dy: 0.5 degrees
- Click Run ppregrid
- Compare the old and new files:
% cd $ARCHIVEDIR
% xconv -i itkaa/03236/itkaaa.psj0mam.03236.rr8.pp &
% xconv -i regridded.pp
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)
- Leave the Input directory blank
- Set the Input file(s) to $ARCHIVEDIR/itkaa/03236/itkaaa.ps*
- Set the Output directory to $ARCHIVEDIR/aggregated
- Leave the Output file blank
- Set the output resolution: Aggregate to: dx 1.875
dy: 1.25 degrees
- Click Run ppaggregate
- Compare old and new files:
% cd $ARCHIVEDIR
% xconv -i itkaa/03236/itkaaa.psi9djf.03236.rr8.pp &
% xconv -i aggregated/itkaaa.psi9djf.03236.rr8.agg.pp
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.
- Leave the Input directory $ARCHIVEDIR/itkaa/03236
- Set the Input file(s) to itkaaa.pmg9feb.03236.rr8.pp
- Leave the Output directory blank
- Set the Output file to $ARCHIVEDIR/itkaaa.pmg9feb.03236.txt
- Set the output format: Set output format: LL
- Click Run pp2ascii
- Check the output file:
% ooffice -calc $ARCHIVEDIR/itkaaa.pmg9feb.03236.txt
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