GDMP: Programs for GRID Data Manipulation

Contents
sel govlay plmap plmapl Standard GridData Format
seldb     gojoin plmapc plmapcl How to use "xplmap/xplmapc"
altx gmerge     plmapg xplmap   Parameters
adjlv txproj plmaps xplmapc       OverlayObject Descriptor
gadd gtrf plmapcs       Caption Specifier
gsub gtrim shade gtopo   Samples
 
Program Name Function
sel Generate new GRID data from an existing GRID data, with re-gridding.
          Parameters: log filename
input GRID data filename (*1)
(new) areaname label
location parameters (*2)
output filename
seldb Generate new GRID data from AMDB GRID data, with re-gridding.
          Parameters: log filename
input data class (SurveyDB / Composite)
codename of source data
(new) areaname label
location parameters (*2)
output filename
altx Extract altitude GRID data from a Standard Format magnetic anomaly GRID data (i.e., from 2nd set data or from header information).
          Parameters: log filename
input data filename (*1)
(new) areaname label
output data filename
adjlv Add a constant value to GRID data to adjust DC level.
          Parameters: log filename
input data filename
constant value to be added
(new) areaname label
output data filename
gadd Add 2 GRID data, generating a new GRID data. Altitude values are copied from the 1st data.
          Parameters: log filename
input data1 filename
input data2 filename
(new) areaname label
output data filename
gsub Subtract 2nd GRID data from the 1st one, generating a new GRID data. Altitude values are copied from the 1st data.
          Parameters: log filename
input data 1 filename
input data 2 filename
(new) areaname label
output data filename
gtrim Trim-off data of undefined range same as in the reference data. Data of trimmed-off parts are filled with the value for undefined (vnul).
          Parameters: log filename
input source data filename
reference data filename
(new) areaname label
output data filename
govlay Overlay multiple GRID data sequentially with placing slit zone, and create new GRID data.
          Parameters: log filename
(new) areaname label
coordinate number (*3)
location parameters (*2)
output data filename
[repeated until blank line] input data filename (*1)
gojoin Join multiple GRID data sequentially with placing transient zone surrounding the overlaid data, and create new GRID data.
          Parameters: log filename
(new) areaname label
coordinate number (*3)
location parameters (*2)
transient zone width (km)
output data filename
[repeated until blank line] input data filename (*1)
gmerge Merge multiple GRID data sequentially with placing transient zone along overlapping zone, and create new GRID data.
          Parameters: log filename
(new) areaname label
coordinate number (*3)
location parameters (*2)
transient zone width (km)
output data filename
[repeated until blank line] input data filename (*1)
txproj Translate GRID data into another map projection, with re-gridding.
          Parameters: log filename
input data filename (*1)
(new) coordinate number (*3)
output data filename
gtopo Generate topography GRID data from DEM.
          Parameters: log filename
name label
coordinate number (*3)
location parameters (*2)
output data filename
DEM data are assumed to be stored in a prescribed directory with a specified format.
gtrf Translate IGRF residual GRID data into another reference model.
          Parameters: log filename
input data filename
survey year
old reference model identifier (spec. and year / generation)
new reference model identifier (spec. and year / generation)
(new) areaname label
output data filename
plmap Draw contour map of GRID data on an A4 sheet.
          Parameters: log filename
input GRID data filename
output PS filename
paper orientation
  [may be repeated below]
contour interval
  (if 0, omit drawing, then parameters below must be omitted.)
size of drawing
supplementary items (*4)
[if next set data exist] continue or quit
plmapc Draw color-graded contour map of GRID data on an A4 sheet.
          Parameters: log filename
input GRID data filename
output PS filename
paper orientation
  [may be repeated below]
contour interval
  (if 0, omit drawing, then parameters below must be omitted.)
median value of color-grading
size of drawing
supplementary items (*4)
[if next set data exist] continue or quit
plmapg Draw gray-scale grading map of GRID data on an A4 sheet.
          Parameters: log filename
input GRID data filename
output PS filename
paper orientation
  [may be repeated below]
interval of grading
  (if 0, omit drawing, then parameters below must be omitted.)
median value of grading
size of drawing
supplementary items (*4)
[if next set data exist] continue or quit
plmaps Draw shaded-relief contour map of GRID data on an A4 sheet.
          Parameters: log filename
input GRID data filename
output PS filename
paper orientation
  [may be repeated below]
contour interval
  (if 0, omit drawing, then parameters below must be omitted.)
azimuth and elevation angle of illuminant
scaling for vertical
size of drawing
supplementary items (*4)
[if next set data exist] continue or quit
plmapcs Draw shaded-relief color-grading map of GRID data on an A4 sheet.
          Parameters: log filename
input GRID data filename
output PS filename
paper orientation
  [may be repeated below]
interval of color-grading
  (if 0, omit drawing, then parameters below must be omitted.)
median value of color-grading
azimuth and elevation angle of illuminant
scaling for vertical
size of drawing
supplementary items (*4)
[if next set data exist] continue or quit
shade Draw shaded-relief map of GRID data on an A4 sheet.
          Parameters: log filename
input GRID data filename
output PS filename
paper orientation
  [may be repeated below]
process or skip this set data
  (if skip, parameters below must be omitted.)
azimuth and elevation angle of illuminant
scaling for vertical
size of drawing
supplementary items (*4)
[if next set data exist] continue or quit
plmapl Draw contour map of GRID data with Trackline paths on an A4 sheet.
          Parameters: log filename
input GRID data filename
StdLIN line data filename
output PS filename
paper orientation
  [may be repeated below]
contour interval
  (if 0, omit drawing, then parameters below must be omitted.)
size of drawing
supplementary items (*4)
[if next set data exist] continue or quit
plmapcl Draw color-graded contour map of GRID data with Trackline paths on an A4 sheet.
          Parameters: log filename
input GRID data filename
StdLIN line data filename
output PS filename
paper orientation
  [may be repeated below]
contour interval
  (if 0, omit drawing, then parameters below must be omitted.)
median value of color-grading
size of drawing
supplementary items (*4)
[if next set data exist] continue or quit
xplmap Draw contour map of GRID data with various supplementary items. Sheet size is selectable among A4 through B0. See another section for detail information how to use.
          Parameters: log filename
input GRID data filename
data set number in the input file
OverlayObject descriptor filename
Caption specifier filename
output PS filename
paper size and orientation
left and bottom margin
contour interval and character size of contour-value
scale (in reciprocal)
supplementary items (*4)
confirm parameters setting (process or abort)
control on adding ID-label
xplmapc Draw color-graded contour map of GRID data with various supplementary items. Sheet size is selectable among A4 through B0. See another section for detail information how to use.
          Parameters: log filename
input GRID data filename
data set number in the input file
OverlayObject descriptor filename
Caption specifier filename
output PS filename
paper size and orientation
left and bottom margin
contour interval and median value of color-grading
scale (in reciprocal)
supplementary items (*4)
confirm parameters setting (process or abort)
control on adding ID-label
(*1) If observation altitude of input GRID data is undefined, additional altitude data input will be required.
(*2) "location parameters" include Northing and Easting of Southwest corner, mesh interval and number of mesh to the North, and to the East.
(*3) If the map projection is not UTM, information of the origin will be required.
(*4) "supplementary items" include the selection whether and where to write scale bar or not, whether to write meridians and parallels, and whether to write coastlines, rivers and prefecture boundary.


Standard Format of GRID data file v2005

 1.   One file consists of 1 set of GRID data, or multiple sets of GRID data.
    The 2nd set or further behind of multiple sets of GRID data is restricted
    in usage, and is valid only for cases below.
      (1) 1st set GRID data indicates a distribution of any physical quantity
        on a curved surface, and the altitude distribution of the surface is
        given by 2nd set GRID data.
      (2) The file consists of a series of independent GRID data, and they are
        not used for other than illustrating each distribution.
 2.   The unit for the physical quantity (grid data) is, in principle,
    nT for magnetic field, m for altitude, 0.01 A/m for magnetization, mGal
    for gravity, or others as derived from them.  And it is recommended to use
    the value of positive 99999 in effective digits for representing null
    value (the lack of valid data).
 3.   Every data line in GRID data file may not exceed 80 bytes excluding LF
    code.  And it is recommended to be 79 bytes or less excluding LF.
 4.   Data in GRID data file may not include multi-byte characters, and
    control codes other than LF shall not be used.

Each set of GRID data is constructed as follows.
a) Comment: Before 1st Header, arbitrary lines of comment can be placed.
        Comment line has "#" on the 1st column and is 80 byte long at most.
b) 1st Header (Areaname and information of map projection)  [fixed format]
      FORMAT(a8, i4,4x, 2i8, 2i8)
  area: 8 byte string representing Areaname or else, not starting with "#".
  nc:   coordinate number of map projection (usually UTM zone number)
            0 : Japanese transverse Mercator coordinates
         1-60 : UTM coordinates zone number
           61 : North pole UPS coordinates
           62 : South pole UPS coordinates
           65 : UTM coordinates with non-standard central meridian
           70 : Mercator projection
           71 : Lambert conformal conic projection (1 standard parallel)
           72 : Lambert conformal conic projection (2 standard parallels)
          100 : Lambert Azimuthal Equal-Area Projection
                (from the sphere with surface area equal to the earth)
          109 : Lambert Azimuthal Equal-Area Projection
                (from the sphere with equatorial radius equal to the earth)
          199 : Latitude/Longitude in minutes are regarded as distance in km
        These numbers above are for the Bessel ellipsoid (Tokyo datum).
        For GRS ellipsoid (WGS-ITRF), add 200 to the corresponding projection.
  ig, kg : Latitude and Longitude (in minutes) of origin
            [neglected for nc = 1 to 62]
  i1, i2 : Latitudes (in minutes) of standard parallels
            [valid only when nc = 72]
    In general, coordinate values are X (Northing) = Y (Easting) = 0 at the
    origin.  However, in UTM (nc = 1 to 60, or 65) X = 0, Y = 500,000 (m), and
    in UPS (nc = 61 or 62) X = Y = 2,000,000 (m), at the origin.
c) 2nd Header (Grid information, null value and altitude)  [free format]
      FORMAT(2i12, 2i6, 2i6, 1x,f7.1, 1x,f7.0)   (as standard)
  ixs, iys : Northing and Easting (in m) of Southwest corner of GRID  [integer]
  mszx,mszy: mesh size (in m) towards North and East                  [integer]
  mxn, myn : mesh count (including both ends) towards North and East  [integer]
  vnul :     special value representing the lack of valid data        [real]
  alt :      observation altitude (in m)                              [real]
              (If the value = 0., the distribution of observation surface is
               given as 2nd set GRID data, and if negative (-1.), the altitude
               of observation is undefined.  For the 2nd set GRID data (i.e.,
               altitude data) this is filled with -1., though meaningless.)
d) GRID data body  [free format]
      FORMAT((f7.1, 9(1xd,f7.1)))   (as standard)
  All grid data are listed out in the order that starts from Southwest corner
  toward North, and on arriving North end proceeds to next East row.
  Next expression is the equivalent FORTRAN statement reading this data.
        read(10,*) ((f(i,k),i=1,mxn),k=1,myn)
  However, for the output programming, line break operation between rows
        do 1 k=1,myn
          write(10,'((f7.1,9(1x,f7.1)))') (f(i,k),i=1,mxn)
      1 continue
  is recommended.

How to use "xplmap/xplmapc"

Parameters for "xplmap/xplmapc"

[Assigning I/O files]
  (1) working directory name :
        filenames assigned hereafter are assumed to exist under this directory.
  (2) filename of input GRID data :  starting from 1st column
  (3) data set sequence number :  usually 1
        If the input data file includes multiple sets of GRID data, and if 2nd
        set or behind is to be processed, specify value of 2 or greater.
  (4) OverlayObject descriptor filename :  starting from 1st column
        If 1st column is space, no OverlayObject is assumed.
  (5) Caption specifier filename :  starting from 1st column
        If 1st column is space, no Caption is assumed.
  (6) output PS filename :  starting from 1st column

[Parameters on Drawing]
  (7) paper size/orientation (AiP, AiL, BiP or BiL, where i is 4,3,2,1 or 0)
  (8) left margin (cm)
  (9) bottom margin (cm)
 (10) contour interval [integer] (1/2 of color-grading)
 (11) [XPLMAP]  character size of contour-value (cm) [if 0., no entry.] 
 (11) [XPLMAPC] median value of color-grading [integer]
 (12) scale (in reciprocal)  (e.g., specify 50000. for the scale of 1/50,000.)

 (13) write color-grading legend ?  (y / n) [XPLMAPC]
  (13a) [if (13)==y ] size ratio  (relative to standard size)
  (13b) [if (13)==y ] position
  (13c) [if (13)==y ] unit notation
 (14) write scale-bar ?  (y / n)
  (14a) [if (14)==y ] position
 (15) write meridians/parallels ?  (y / n)
 (16) write coastlines ?  (y / n)
  (16a) [if (16)==y ] write rivers/lakes ?  (y / n)
  (16b) [if (16)==y ] write pref. boundaries ?  (y / n)

[Confirmation of parameters]
 (17) (confirm parameter setting) OK ?  (y / n)
 (18) write additional ID-label ?  (y / n)
  (18a) [if (18)==y ] ID-label string

OverlayObject Descriptor

(a) Sorts of Object :
     1) point, 2) circle, 3) horizontal line, 4) inclined line, 5) horizontal
   rectangle, 6) rectangular block, 7) mark, 8) string-style, 9) string, 10)
   polygon within horizontal plane, 11) undulating polygon, 12) rectangle along
   meridians/parallels  can be specified.
     Each Object generally has its own physical geometry, having attributes of
   not only horizontal position but also vertical depth.  So, data describing
   the objects include depth information, but such vertical information is
   neglected in "xplmap/xplmapc" process.

(b) General rule of Object description :
 - If 1st column is "#", the line is neglected as a comment.
 - Excluding polygon object, one object is described by 1 line.  Polygon object
   is defined with multiple lines, and the coordinates of apexes are given from
   the 2nd line.
 - Description of Object starts with Object keyword, and is followed by
   a coordinate specifier and a list of various numerical data, all in free
   format.  (Description of string-style object is a little different.)
 - Object keywords are as listed below, not necessarily in capitals.  
 - Coordinate specifier is either coordinate number of map projection or "*".
   "*" indicates that the horizontal position is defined by latitudes and
   longitudes, while coordinate number implies that the position is defined by
   the distances in km in the respective projection coordinates.
   The coordinate number specified must coincide with the GRID data.
 - Some of numerical data list can be omitted on its rear part, which is shown
   as enclosed by [ ] in the list below.

(c) List of descriptors :
  0) #   (If 1st column is "#", the line is neglected as a comment.)
  1) POINT   nc   xp      yp    deep  size  [ icol ]
     POINT   *  id:fim  kd:fkm  deep  size  [ icol ]
  2) CIRCLE  nc   xc      yc    deep  radius  [ thick  icol  ityp ]
     CIRCLE  *  id:fim  kd:fkm  deep  radius  [ thick  icol  ityp ]
  3) HLINE   nc   xs      ys      xt      yt    deep  [ thick  icol  ityp ]
     HLINE   *  id:fim  kd:fkm  id:fim  kd:fkm  deep  [ thick  icol  ityp ]
  4) SLINE   nc   xs      ys    dps    xt      yt    dpt  [ thick  icol  ityp ]
     SLINE   *  id:fim  kd:fkm  dps  id:fim  kd:fkm  dpt  [ thick  icol  ityp ]
  5) HRECT   nc   xs      ys      xt      yt    deep  [ thick  icol  ityp ]
     HRECT   *  id:fim  kd:fkm  id:fim  kd:fkm  deep  [ thick  icol  ityp ]
  6) BLOCK   nc   xs      ys      xt      yt    dp1  dp2  [ thick  icol  ityp ]
     BLOCK   *  id:fim  kd:fkm  id:fim  kd:fkm  dp1  dp2  [ thick  icol  ityp ]
  7) MARK    nc   xp      yp    mark  size  [ thick  icol ]
     MARK    *  id:fim  kd:fkm  mark  size  [ thick  icol ]
  8) LSTYLE  font  size  [ angle  itcol  ibcol ]
  9) TEXT    nc   xp      yp    [ kp  text ]
     TEXT    *  id:fim  kd:fkm  [ kp  text ]
 10) HPOLYG  nc  npt  deep  [ thick  icol  ityp ]  / (  xp  ,   yp  , i=1,npt)
     HPOLYG  *   npt  deep  [ thick  icol  ityp ]  / (id:fim, kd:fkm, i=1,npt)
 11) SPOLYG  nc  npt  [ thick  icol  ityp ]  / (  xp  ,   yp  , deep, i=1,npt)
     SPOLYG  *   npt  [ thick  icol  ityp ]  / (id:fim, kd:fkm, deep, i=1,npt)
 12) LRECT   nc   xs      ys      xt      yt    deep  [ thick  icol  ityp ]
     LRECT   *  id:fim  kd:fkm  id:fim  kd:fkm  deep  [ thick  icol  ityp ]

  [common] nc / * :  coordinate specifier. "*" indicates that the horizontal
                     position is defined by latitudes and longitudes.  The
                     value of "nc" must coincide with the GRID data.
           xp,xc,xs,xt / yp,yc,ys,yt :
                     Northing and Easting (in km) in the specified projection
                     coordinates ("nc").
           id:fim / kd:fkm :
                     Latitude and Longitude in the form of "Degree:Minute".
                     There may be space only between ":" and "Minute".
                     (Even if "Degree" is 0, "0:" cannot be omitted.
                      The program only calculates [Degree*60. + Minute].
                      If South latitude or West longitude is intended,
                      both "Degree" and "Minute" must have minus sign.)
           npt :     number of apexes (3 to 150)
           deep,dps,dpt,dp1,dp2 :
                     depths in m
           size / radius / thick :
                     size / radius / thickness in cm on the illustration
           icol / ityp :
                     color (-255 to 16777215)
                     / line type (0: solid, 1: broken, 2: dotted, 3: chained)
           itcol / ibcol :
                     foreground color / background color (-255 to 16777215)
             Values for "icol" / "itcol" / "ibcol" :
               monochromatic if (-255) to 0, and RGB color if 0 to 16777215.
               0 value corresponds to black, while -255 and 16777215 to white.
               If given the out-of-range value, default black foreground color
                or colorless transparent background will become effective.
  [MARK]   mark :    0: circle  1: double circle  2: square  3: rhomb
                      4: triangle  5: down triangle  6: star  7: KOME mark
                       8: plus sign  9: cross
                        others: regarded as mark=0, thick=0., icol=0
                     If thick=0. and mark<=6, inside the mark is painted with
                     specified color, and for mark=1 inside of inner circle is
                     further painted with white.
  [LSTYLE] font, size, angle :
                     Font specifying string of 3 characters or less (as used in
                     lstyle subroutine) / character height (in cm) / 
                     string direction (in degrees)
  [TEXT]   kp   :  defines how to locate string referred to specified point
                       0: lower left, 1: lower right, 2: center  of string
                     is adjusted to specified point.
           text :  The string after removing the leading and trailing spaces
                     is written in.  If the first and the last characters of
                     the string are both '"' or both "'", corresponding
                     characters '"' or "'" are removed before writing.

Caption Specifier

  If 1st column is "#", the line is neglected as a comment.
  1st column is neither " ", "=" nor "#" :
      Font specifier, character height ('size'), string direction ('angle'),
    foreground color ('itcol'), and background color ('ibcol') are specified
    from the 1st column, with separated by one or more spaces.  Font specifier
    is a string of 3 characters or less, as used in lstyle subroutine.
    'size' is in cm, and 'angle' is in degrees.  'itcol' and 'ibcol' values
    (-255 to 16777215) are forwarded to lstyle subroutine.  If given the
    out-of-range value, default black foreground color or colorless transparent
    background will become effective.  Parameters 'angle' and the behind can be
    omitted on its rear part, then angle = 0., itcol = 0, and/or ibcol = 9999
    (colorless transparent) becomes effective.
  1st column is "=" :
      Position (in cm) of starting Caption string is specified with free format
    in columns 2 and after.  The position is given by rightward (Eastward) and
    upward (Northward) coordinates relative to the bottom-left corner of the
    contour map.
  1st column is " " :
      The string after removing the leading and trailing spaces is written in
    the map, with the parameter as defined above.  If the first and the last
    characters of the string are both '"' or both "'", corresponding characters
    '"' or "'" are removed before writing.
      If string definitions are repeated without re-positioning by "=" line,
    the string will be written on the following line, with line spacing of
    120% character height ('size').

Sample data

[keyboard input (stdin) data]
  (1)   ~/kobe          ; working directory name
  (2)   amkobe.grd      ; input GRID data filename
  (3)   1               ; data set sequence number
  (4)   kobe.obj        ; OverlayObject descriptor filename
  (5)   kobe.cap        ; Caption specifier filename
  (6)   amkobe.ps       ; output PS filename
  (7)   a2l             ; paper size and orientation
  (8)   5               ; left margin (cm)
  (9)   3               ; bottom margin (cm)
 (10)   5               ; contour interval [integer] (1/2 of color-grading)
 (11)   -30             ; median value of color-grading [integer] [XPLMAPC]
 (11)   0.2             ; character size of contour-value (cm) [XPLMAP]
 (12)   200000          ; scale (in reciprocal)
 (13)   y               ; write color-grading legend ?  [XPLMAPC]
 (13a)  1               ;   size ratio     [if (13)==y ]
 (13b)  40 3            ;   position       [if (13)==y ]
 (13c)  (nT)            ;   unit notation  [if (13)==y ]
 (14)   y               ; write scale-bar ?
 (14a)  12 3            ;   position       [if (14)==y ]
 (15)   y               ; write meridians/parallels ?
 (16)   y               ; write coastlines ?
 (16a)  n               ;   write rivers/lakes ?      [if (16)==y ]
 (16b)  n               ;   write pref. boundaries ?  [if (16)==y ]
 (17)   y               ; (confirm parameter setting)
 (18)   y               ; write additional ID-label ?
 (18a)  KobeAM.map      ;   ID-label string   [if (19)==y ]

[OverlayObject Descriptor data (example)]
  #
  lstyle HB  0.7  0.  0  -999
  mark  *  34:41.2  135:12.0  0  0.3  0.  0
  text  *  34:41.2  135:12.0  1  "KOBE "
  mark  *  34: 41.5  135: 30.5  0  0.3  0.  0
  text  *  34: 41.5  135: 30.5  1  "OSAKA "
  mark  *  34: 60.6  135: 46.2  0  0.3  0.  0
  text  *  34: 60.6  135: 46.2  1  " KYOTO"
  # Hankyu Kobe-Imadzu-Takarazuka line loop loc.
  spolyg   53   33   0.06  0  0
     3842.573  544.585   -5   3841.362  544.429   -1   3841.899  544.165   -1
     3843.005  543.339   -5   3844.091  542.359   -5   3845.088  540.945  -10
     3844.877  536.423   -5   3844.191  532.931   -5   3846.739  533.221  -20
     3847.844  532.711  -30   3849.007  532.481  -40   3849.796  532.384  -50
     3850.595  531.862  -45   3851.009  532.019  -45   3851.263  531.630  -50
     3851.426  531.977  -50   3851.451  532.763  -60   3851.671  533.131  -60
     3852.036  533.387  -55   3852.434  534.172  -65   3852.474  535.436  -55
     3852.859  536.510  -40   3853.337  537.301  -40   3853.154  538.457  -30
     3851.808  540.110  -30   3851.219  540.978  -30   3849.944  541.197  -30
     3849.311  541.494  -30   3848.832  542.535  -30   3846.771  543.124  -15
     3846.378  543.719  -10   3844.427  543.758   -5   3843.406  544.499   -5

[Caption specifier data (example)]
  #
  TBO  2.  0.  0  2047
  =  3.  23.
   IGRF Residuals
  #
  TB   1.  0.  0  -255
  =  26.  8.5
   Flown  in December, 1995
   Average Line Spacing: 300m
  #
  HO   0.75  0.  0  -255
  =  26.  5.
   Flying Altitude:
   "  300m above Ground Envelope"
   Reduction Surface of this Map:
   "  200m upward Smoothed surface"
   "  above the actual flight level"