Def2QDF

This tool is used to create grids (optionally including Geography, Climate, Vegetation) from a textual description (def file)

Code: Def2QDF.cpp, GridFactory.cpp

Usage

Def2QDF <grid-def-file> [<specifiers>] <output-QDF-name>

where

grid-def-file
Name of the grid definition file (one command per line)
format: see below
output-QDF-name

Name for output QDF file

specifiers
codes for groups to add:
  • S : grid data

  • G : geography data

  • C : climate data

  • V : vegetation data

  • N : empty navigation data

If no specifiers are set, all groups are added.

Grid File Format

grid_def_file ::= <grid_cmd>[<NL> <def_cmd>]*
grid_cmd      ::= <ico_cmd> | <flat_cmd>
ico_cmd       ::= "GRID_TYPE ICO" <type>:<subdivs> [<radius>]
  subdivs     :   number of subdivisions
  type        ::= "eq" | "std"
  radius      :   radius of icosahedron, default:6371.3
flat_cmd      ::= "GRID_TYPE" <conn> <width>"x"<height> ["PERIODIC"]
  conn        ::= "HEX" | "RECT"
  width       :   width of grid
  height      :   height of grid
  PERIODIC    :   use periodic boundary conditions

def_cmd  ::= <ddir_cmd> | <env_cmd>
ddir_cmd ::= "DATA_DIR" <path>[:<path>]*
env_cmd  ::= <env_type> "FLAT" <value> | <env_type> "NETCDF"  (<nc_file> | "DEFAULT") <time>  | <env_type> "QMAP"  <valqmap>
env_type ::= "ALT"  | "ICE" | "NPP" | "TEMP" | "RAIN"

Examples

DEF file for a rectangular grid with constant altitude and NPP

GRID_TYPE RECT 30x30 PERIODIC
ALT FLAT 100
NPP FLAT 1.2

The grid produced with this def file is a rectangular grid with width 30 and height 30. Every cell has an altitude value of 100, and an NPP value of 1.2 The ‘PERIODIC’ key word causes the topology of the grid to be a torus (i.e. identifying the left with the right edge, and the top edge with the bottom edge, respectively).

DEF file for an icosahedral grid with “real” topography and constant NPP

GRID_TYPE ICO eq:64
ALT NETCDF ETOPO1_Bed_g_gmt4.grd 0
NPP FLAT 1.2

This creates an equal area icosahedron with 64 subdivisions. Each cell has an altitude value corresponding to the earth’s altitude at that coordinate. The values are taken from the NETCDF file ETOPO1_Bed_g_gmt4.grd. The “0” means we want altitudes above sea level for the present day.

DEF file for an icosahedral grid with “real” topography and NPP

DATA_DIR /home/jody/qdf_data
GRID_TYPE ICO eq:256
ALT NETCDF ETOPO1_Bed_g_gmt4.grd -20
NPP NETCDF npp_timmermann.nc -20

Creates an equal area icosahedron with 256 subdivisions. Each cell has an altitude and npp values corresponding to the earth’s altitude and NPP at that coordinate. If the data file can’t be found in the current directory, the directories listed under DATA_DIR are searched. The -20 in the ‘’ALT’’ and ‘’NPP’’ lines means we are interested in the data for the world 20’000 years ago.