| Back to HOW_TO  |  Back to General Information  | Display procedureszd |
 

GMT-coastline options

This is an example for drawing coastlines inside zd.

Coastlines are drawn in a few graphic routines within the OTEQ family. One of them is the zd program for viewing harmonic solutions.
We utilize the GMT program pscoast (earlier known as shoredump) for retrieving the shoreline polygones. More information about GMT is here.

The GMT-coastline option can be specified in an *.ins-file (e.g. zd_sol.ins) or after the L command in the graphic window.

How it's done:
Subroutine zdispl (zds.f) contains the following code segment:
      if (qgmt) then
         call prompt_text_s18 ('GMT coastline options :',gmtopt
     &,       0,470)
         if (gmtopt(1:1).ne.' ') call global_coasts_gmt (gmtopt) ! Oload/afor/p/glcorfgs.f
      endif

      print '(2a)',' Drawing coastlines on array type ',typ
      call sterp_viewport (m,n,typ,1,1,klo,jlo,khi,jhi,npx,npy)  ! Oload/afor/p/gra/glcovps.f
      ier=restore_window (0,470,639,479,wb)
      call read_global_coasts (17,' ',x,y,6000)                  ! Oload/afor/p/glcorfgs.f
401   call more_global_coasts (x,y,npt)                          ! Oload/afor/p/glcorfgs.f
      if (npt.lt.0) goto 411
      do 403 i=1,npt
      xx=x(i)
      yy=y(i)
      call isotra (xx,yy,x(i),y(i))
403   continue
      if (nop.le.1) then
         call draw_2_curves (x,y,npt,nclc,0,nnop)
      else
         call draw_curve (x,y,npt,nclc)                          ! Oload/afor/p/gra/oteiaux.f
      endif

In  glcorfgs.f  is a system call

      call system ('/home/hgs/bin/shoredump '//regstr(:lrs)

The user-defined options and output file name are contained in the charater string  regstr.
/home/hgs/bin/shoredump is a wrapping script that injects a few standard options to GMT's  pscoast

#!/bin/sh
/usr/local/GMT/bin/pscoast -m -W -Jx1d $* | grep -v '^#'
exit

The main purpose is to select a reasonable resolution, and the features included like suppressing rivers, too small lakes, islands in lakes on islands, etc.
These are associated with options -A -D and  -I
The region option (after -R ) is generated internally.

Example for high resolution: -Df -I1 -A10/0/4 

Example good for world:     -A1000/0/3 -Dl -I1

You'll need to code a trailing right bracket if you enter the option in the ins-file
   GMT=-A1000/0/3 -Dl -I1]
since the string contains blanks.

For this feature to work properly the name of a scratch directory must be given in the unix shell environment from which the job is launched:
   setenv GMTCOAST_DIR /data1/hgs/scratch/glcoast-dump/
or your own favorite tmp directory. You need file creation rights. The files can be big. Later jobs can retrieve the data. They find the files by means of the file name which encorporates the region and options string. Example:

ll  /data1/hgs/scratch/glcoast-dump/
-rw-rw-r-- 1 hgs users   72887 Jan 25 20:34 tmp-R-1.4536%-90.0000%0.0000%90.0000r-A1000%1%4-Dl-I1-I2-I3
-rw-rw-r-- 1 hgs users 4001815 Jan 25 22:26 tmp-R-6.8649%-90.0000%0.0000%90.0000r-A1000%0%4-Df-I1-I2-I3
-rw-rw-r-- 1 hgs users 3852022 Jan 25 22:14 tmp-R-78.4192%55.4505%-57.5808%64.2800r-A1000%0%4-Df-I1-I2-I3
-rw-rw-r-- 1 hgs users 3852022 Jan 25 20:36 tmp-R-78.4192%55.4505%-57.5808%64.2800r-A1000%1%4-Df-I1-I2-I3
-rw-rw-r-- 1 hgs users 1302401 Jan 26 11:18 tmp-R8.0183%55.0499%13.6817%60.3267r-A10%0%4-Df-I1-I2-I3
-rw-rw-r-- 1 hgs users 1024846 Jan 25 22:26 tmp-R8.0183%55.0499%13.6817%60.3267r-A1000%0%4-Df-I1-I2-I3
-rw-rw-r-- 1 hgs users  128206 Feb  4 15:22 tmp-R8.1747%55.1777%13.5253%60.1997r


Manual pages

 (1) issue pcoast with no argument, note dump feature (-m)

 (2) GMT manual page pscoast 

.bye