wiki:ToolsAndUtilities/PpFileTools

PP File Manipulation Tools

PP format is a Met Office proprietary format and is mainly associated with Met Office products. It uses Fortran sequential unformatted records. PP format is "big endian".

The utilities xconv and jplot allow users to view the contents of PP-format files.

pp_unpack

BADC files are stored in WGDOS packed format (run ppinfo on them to see this). This tool unpacks them for use with other tools such as pp_merge and NDdiag.

Usage:

pp_unpack {list of PP files}

Each input file is unpacked and stored in a file with .unpacked appended to the filename. For example, to process a collection of PP files for use with NDdiag:

pp_unpack *.pp

pp_merge out.pp *.unpacked

will create the file out.pp ready for NDdiag.

Download pp_unpack source code

The source code for the following tools pp_merge, pp_rdiff, pp_qdiff and pp_getfields can be downloaded here: PP Tools Source Unpack the tar file and type make for instructions.

pp_merge

Merges (interleaves) PP files to produce a PP file in time order. This is suitable for use with NDdiag, which requires its input to be in time order.

Usage:

pp_merge {PP output file} { List of PP input files }

pp_rdiff

This compares two PP files of the same size. It computes the relative difference between corresponding field points according to the formula

Relative difference formula

Usage:

pp_rdiff {Input PP file 1} {Input PP file 2} [{Threshold}]

where Threshold is a positive number. If no threshold is supplied, a value of 10-7 is used. The tool reports whether the files are different to within threshold and the maximum absolute relative difference found.

pp_qdiff

PP quick difference. This simply subtracts the field points of the two input files, which must be the same size, and puts them in the output.

Usage:

pp_qdiff {PP file 1} {PP file 2} {Output PP file}

The output file can then be examined by a graphical program like xconv.

pp_getfields

This program extracts a list of fields specified by the user.

Usage:

pp_getfield {Input PP} {Output PP} {STASH list}

where the STASH items are separated by spaces.

Other PP tools

  • Extract PP fields from a large file: extract_timesteps.f90.gz
    This code can be used to extract some data from a larger pp data file. It is designed for interactive use, inputs to the code being taken from the screen. The required stash codes are specified, and data for these codes is extracted for a range of times.
  • Determine time and spatial averages of UM diagnostics: diag_avg.tar.gz
    This code can be used to take averages of UM diagnostics. The data is input as a pp file, such as might be produced from the output of MDIAG. Average values of a diagnostic can be calculated as a time mean, a running mean and as a spatial average (which may be averaged over a limited domain)
  • Determine the max/min of UM diagnostics: diag_maxmin.tar.gz
    This code can be used to find maxima and minima of UM diagnostics. The data is input as a pp file, such as might be produced from the output of MDIAG. Extreme values of a diagnostic are produced for a specified vertical level. The horizontal domain may be restricted if desired.
  • Interpolate from model to pressure levels: pvtrace.tgz
    The MDIAG code is very useful for calculating pressure-level diagnostics from a set of UM output fields on model levels. However, suppose that you already have your diagnostic of interest but just want to interpolate it from model to pressure levels. This code will do just that. It can also be used to construct linear combinations of existing fields, and to output them on either model levels or pressure levels.

For advanced users, further details of the PP format can be found in UM Documentation Paper F3. (see Docs/MetOfficeDocs)

Last modified 4 years ago Last modified on 21/06/13 08:36:42

Attachments (7)

Download all attachments as: .zip