USAGE:   
          solplot
[{-d dir [ basin ]] | -dd dir }] 
                  [-T tide ] [-RT symbol ] [-b basin ]

                  [-q ] [-r { AUTO | #from #to #step }] [-ra #annot [{ -u units | -ug }]
                  [-z { ootides | NONE }]
                  [-s sitefile [+pstext-opts ...] [-psxy-opts ...] ]

                  [-PI #incr ] [-PA #ann ] [-AT "add to title" ]
                  [-t target ] [-f flags ]
                  [-cpb
pbfile] [-upb pbfile] [-ppb]
                  [-A area [{-C [copt] | -S [ projection [ geometry ]]}]
                  [-SO sopt [-SO sopt...]]

                  [-o { outdir | - }] [-W paperwidth_inch] [-PNG [pnggeometry]]
                   file[.dat]  [{ #version | NONE }]
 
PURPOSE:
  Plots a harmonic tide solution.
  Axes in trivial projection run from 1 to M, 1 to N,
 
a Z-cell location (I,J) maps to I+0.5, J+0.5

  Page orientation will depend on the area's aspect ratio, landscape if M > N  

  Adds tide gauge positions if any of the following files exist in the
  plot subdirectory:
      tgg4solplot        n x y
      tgg.sol            x y n name
  The latter will produce a table of numbers (n) and names.
  (The position of the table needs generalisation)

  Adds passive boundaries (at the moment only in trivial projection).
  By default, the boundary data line.xy  is created only when it does
  not exist. See  prpbound -h

  The procedure should be run from a subdirectory w.r.t. the solution and
  flag files etc. See Examples. Symbolic links may be useful.  


OPTIONS:
 "file" specifies the part after the directory+"/"
 #version number is significant unless NONE is specified

 -SO "sopt"      (cumulative) sub-options sent to sol2xyz, e.g. -SO "-O+P -R -P1,1"

  -d dir          the directory where to find all data [../]
                 Should be given early, since e.g.
solplot.pngcrop depends on it.
 -dd dir         is a simpler alternative for global models

  -PNG [pnggeom]  will produce a decent-quality png-file in subdirectory ./PNG
 
               For alternative locations, see PNGDIR in the environment.
                 If   -d sol-dir basin  is given, the result appears in ~/www/OTEQ/basin/
                
If   -d sol-dir -      causes trouble, run the conversion manually:
                 ps2png [-rr] -m -d 144x144 -o PNG-dir/ ps-file
                 ( -rr is needed in landscape orientation.)
 
       pnggeom   is the cropping geometry. By default, no cropping will occur.
                 If CROP is specified, then
                    if a file ${dir}/solplot.pngcrop exists, its last line is used
                       for geom
                    else, if PNGCROP has been set in the enviroment, it's used,
                    else the internal default is used: 1050x1400+0+280

 
  -C assumes plane model, applies Cartesian projection (output x,y in km)
    May also be a global model, then notice sub-soptions copt;

    copt are sub-options to sol2xyz
 
-S assumes stereographic projection of a plane model
    (output x,y in degrees long/lat., program plane2sphere)

 -C and -S are mutually exclusive.
    Specifying neither -C nor -S defers to trivial projection

    (array indices are printed) which is to be preferred!

 -A If neither -C nor -S are given and the auto-detected area bounds appear

    inappropriate, the area can be enforced. E.g. -A 1/80/1/90
    (Will the script auto-detect the area size with C or -S ?)

 -q will report the amplitude range and skip plotting


 The colour bar:
 By default, every other color step will be labeled. 
 -r #a #r #s   specifies the amplitude range and the color step for makecpt.
  -r AUTO       will call grdinfo and axlim to derive suitable values.
               The results are always printed, but only applied with AUTO.
               Presently, -r AUTO is the default
 -ra #annot    Annotate every s'th level in the colour bar [2]
 -yax #length  Limit the y-axis (affects colour bar and headlines) [8.5]
 -u units      specifies the measurement units at the color scale bar
 -ug           short-form for [nm/s^2]


 -PI incr      the interval for phase lines, in degrees [30]
 -PA incr      the interval for annotated phase lines   [30]

 -cpb [bfile]  will create a new passive-boundary file.
 
-cb  [bfile]  will also include active boundaries.
 -upb  bfile   defines a boundary file for use.

 -no-ppb       will not plot it.

 -o { outdir | - }   (please explain .. something with regridding and projections).

 -s file [opts]  include sites, mark them with a symbol
               The file should look as follows:

                 x          y    :  s a f j text
               11.9264   57.3958 : 12 0 1 1 Onsala

               where x and y are longitude and latitude [deg]
               s, a, f, j  the usual size, angle, font-no, and justify-no
               for pstext. Notice the colon! The file will be run through
               sphere2xyz.

    opts       GMT-options. If preceded with a `+´ they are
               used in pstext ( `-´ in psxy).
               Default: -Sx0.1 -G255/0/0 -W1/255/0/0 +Dj0.1


ENVIRONMENT:

  PNGDIR   - create PNG in this directory [./PNG/]  Currently out of service
  PNGCROP  - cropping geometry, optional.
  SITEOPTS - options for pstext and psxy, see -s option above.


FILES: (precedence over corresponding environment parameters)

   $dir/solplot.pngdir   - if existent, last line is used to specify the
                          
PNG destination directory. 
   $dir/solplot.pngcrop  - if existent, last line is used to specify the
                           PNG cropping geometry under -PNG CROP
   $dir/solplot.siteopts - if existent, last line is used to specify
                           plotting options,
see -s option above.
                          


DEFAULTS:
  tide          -  M2    (to retrieve the file segment)
  symbol        -  tide  (a better symbol than the one from the file)

  units         -  [m]

  dir [basin]   -   ../ SkaKatt
  .dat          -  .dat
  flags         -  FLZU.DAT
  ootides       -  OOTIDES.DAT
  target        -  AaS
  version       -  0 meaning any one first in the input file,
                   wouldn't even care about the tide symbol.
 
  -C -S         -  neither; the coordinates produced are array indexes
  projection    -  X4.15/aspect*N/M  (GMT:  -J...)
  area          -  1/M/1/N auto-detected from FLZ.DAT
  geometry
      -  Without projection, 0.5/M+0.5/0.5/N+.5 (GMT: -R...)

                   with -S , a query sol2xyz will be issued

  pbfile        -  line.xy

 
  from to step  -  re-use the latest amp.cpt
  incr          -  30 (phase lines, isoline increment)
  ann           -  30 (phase lines, annotation interval)
  outdir        -  ./    note that a trailing / is significant.
                   -T O1 -o /home/hgs/Otide/hgs/netCDF/KATT_
                   will produce ...netCDF/KATT_O1.amp and ..._O1.pha
 
  add to title  -  (empty)
                   "basin" is used as a title
                   (give "-" for basin if -d is the last option)

  paperwidth_inch - (6.0) applies currently only to landscape orientation

  pnggeometry   -  1000x1400+0+350

  opts          -  (under option -s) -Sx0.1 -G255/0/0 -W1/255/0/0 +Dj0.1



EXAMPLES:
     otemt1 solutions:

cd ~/OTEQ/KATT/plot
                  solplot -r 0 0.2 0.005 -T M2 O1v6 1
           -T: Tide solution for M2 when O1v6 was the time-step
               determining tide.
               Solution file is ../O1v6.dat with version nr. 1
               User, check with

                  otecat ../O1v6.dat
               if uncertain whether the file contains this tide!

cd ~/OTEQ/NSEAL
ln -s FLZUb.DAT FLZU.DAT # once! (Until pbpbound.f is ready to accept flag-file names as arguments)
cd plot
solplot -W 7.5 -A 1/290/1/240 -cpb -cb -z OOTIDESb.DAT -f FLZUb.DAT -d ../ NSEAL -PNG -T M2 M2v2 1
results in http://holt.oso.chalmers.se/hgs/OTEQ/NSEAL/M2v2-M2-V1.png


cd ~/OTEQ/PETB/plot
mkdir PNG
                  solplot -t AaSOo -b 'Peterson Bay' -r 0 5 0.2 -PNG -T M2 M2v4xt 1
                 
Result: png

cd ~/OTEQ/FRIH/plot
mkdir PNG

                  solplot -b 'Seattle region' -r 0 2.0 0.05 -z OOTIDES.DAT -PNG 1000x1000+0+700 \
                          -t AaSsOo -T M2 M2v4xt 1
                  Result: png
 


     Two otem64 results:

cd ~/OTEQ/KATT/plot
                   setenv PNGDIR /home/hgs/www/4me/
                   setenv PNGCROP 950x1400+0+280
                   solplot -AT SAL -t S -r 0.0 0.02 0.0005 \

                           -PI 1 -PA 5 -z NONE M2v4x_sal NONE
           -z: In a SAL field, we don't have a load field in the OOAREA.
           -t: Target cells S are the only sensible ones.
      -PI -PA: The phase range is narrow and around zero.
          -AT: The title will be M2 SAL
                Result: png

                   solplot -s cities.dat -PNG CROP -ug -t SAOL \
                            -r 0 4.2 0.2 -T M2 M2v4xt_grav 101

                creates a map of Kattegat+Skagerrak loading, gravity
                Result: png
 

     A resampled grid plane -> sphere
     made with    plane2sphere KATT/  , and grd-file output
                  solplot -T O1 -r 0 0.1 0.01 -S s11/90/30i/53 \
                          -z NONE -o ../ \
                          -f SPHFLZ.DAT SPH_O1.DAT 1
           -S: Stereographic, the GMT projection is also stereographic
                     11 = centre longitude, 90 = pole
                    30i = scale = size in inch (strange!)
                     53 = lower latitude
               We could have entered a geometry; default is that
               solplot issues a query to sol2xyz.
           -z: No o.o.area for this kind
           -f: We need a specific flag file.
           -o: destination for output grid files.

     You will not be happy since text is placed awkward.
     Further coding is direly needed.
 

.bye