GPhys : Tutorial for gp commands


gp commands can print, draw, and perform other operations NetCDF variables developped with GPhys. You can use them wihtout knowledge about ruby.

Main commands are,

  • gplist : Print information of a NetCDF file.
  • gpprint : Print values of a NetCDF variable.
  • gpview : Draw a NetCDF variable


NetCDF file using the samples below is here.

Obtain information of a NetCDF file.

% gplist
  lon   [lon=36]        'Longitude'     (degrees_east)
  lat   [lat=19]        'Latitude'      (degrees_north)
  level [level=9]       'Level' (millibar)
  T     [lon=36,lat=19,level=9] 'Temperature'   (degC)

You can find 3-dim data (lon, lat, level) temperature variable "T" in the NetCDf file

Draw a NetCDF variable

The variable can be specified with the format, "File name"+"@"+"variable name".

% gpview

Temperature at 1000mb is drawn, which is the first cross section of the third axis (level).

Draw a sliced NetCDF file

A slice section is indicated with comma "," and the following description.

% gpview,lon=0

Since slice with longitude and latitude section produces 1-dim data, a line is plotted. "--exch" option exchanges the horizontal and vertical axes.

% gpview,lon=0,lat=0 --exch


The option "--mean" perform averaging for the indcated axes.

% gpview --mean lon


The option "--anim" produces animation for the indicated axes.

% gpview --anim lon

"--Gaw" option means automatic page feed.

% gpview --anim lon --Gaw

Other commands

  • gpcut : slice a NetCDF variable.
  • gpcat : concatenate two NetCDF variables.
  • gpaop : Arithmetirc operation is performed for two NetCDF variables.

The "--help" option shows simple explanation for each command.