Spelling: [optional]
.............keyword
or fixed name, symbol etc.
.............Environment
parameter
.............variable
shell-script coding inside swemap
user commands, examples etc
GMT terms: color - a GMT color parameter red/green/blue
or gray
Each saturation parameter is a number between 0 and 255
.............pen
- a GMT pen parameter: width/color[ttexture][p]
.............width
- typically a small integer and ttexture is a
code like ta for dashes, to for dots or
"morse-code" numbers (like 20_10_5_10:10
in general: stroke_gap[_stroke_gap...]:offset)
for
explicit dash-dotting.
If you append p you ask for line widths or morse-code
in units of (1/72"), else it's the device's resolution
(DPI). See Chapter 4.12 (p.13) of GMT3.0 manual
Background information:
man psbasemap | online
man page
man pscoast | online
man page
man mapproject | online
man page
(include in MANPATH /usr/local/GMT/man) Also: GMT
online man pages (html)
Usage: swemap
[-O|-K] [-t {topo|-|-p}] [-s
style] -o xxx.ps
[±N ±L ±T ±v ±V -vc -vv -vr -vs +c]
abc def
Synopsis: swemap
[-O|-K] [topo option] [style option] [output
option]
[drawing options and methods].netcode
[ netcode ... ]
Options:
-O Leave the plot area open at exit time.
-K
Continue on a previous open plot area.
To overlay plots it is recommended to create separate
ps-files. Finally concatenating them (cat) in order.
An -O or -K option must be placed first. They are mutually exclusive.
-t topo topo is
the
file
name root of a topomap
result. The
grid is not reprojected.
-t - If topo
is specified as a placeholder "-", the file names
are taken from the environment:
............SWEMAP_TOPOTF
(colors)
............SWEMAP_TOPOIF
(intensities)
............Then,
complete file names must be given.
-t -p topo file names
(.grd-files) are taken from environment as
under -t -
The grid is re-projected to fit the map region and projection.
However, problems may arise with non-cylindrical projections.
Mercator seems to work well. Reprojection works at present
with fixed parameters grdproject -N200/200 -S0.5 ...
-s style refers to REGION_style
and PRJCT_style predifined in
environment or hard-widred in swemap
Example: setenv REGION_asiaminor 30/30/50/40r
setenv PRJCT_asiaminor s40/35/1:25000000
We know: style = euro nkg fnosk fnoskm spets gl ons
Check the definitions of region_$style and
prjct_$style
in the body of this script.
Default style fnosk (for Fennoskandia) but if environment
parameters REGION and PRJCT exist, they will take
precedence.
-o output This option can be placed
anywere.
If omitted, output
is to stdout and a copy named PSF (default xxx.ps
) is kept.
abc def ... ("netcode" = network
codes)
are short name prefixes for
a series of data files that contain the data to be plotted:
locations, labels, vectors, titles and others.
Associated with these codes are a number of internal
control parameters which can be interacted with using
the unix environment.
±N ±L ±T Netcodes
may be interleaved with
+N +L -N -L in order
to control the GMT -N option on psxy and pstext for
data (+N -N), labels (+T -T), and legend titles (+L -L).
............-N
reinstalls
the GMT -N option, +N takes it away (!)
The default is -N +T -L (i.e. allow out-of-frame features).
-v..
Netcodes may also be interleaved
with
-v -V -vc -vv -vr -vs +v +V +c
Vector drawing methods: -v requests psxy,
...................................-vc
requests psxy, draws a "clockface"
background of the size of the vector.
....................................+c
resets the clockface option.
....................................-V
requests to include all file columns
(i.e. the label column),
....................................+V
requests to suppress the label column.
...................................-vv
psvelo with -Se (page-aligned) and -L (draw line)
...................................-vw
psvelo with -Se (page-aligned) without -L (for simple arrows)
-vr psvelo with -Sr (grid-aligned) and -L (draw line)
-vs psvelo with -Sr
(grid-aligned) without -L
+v nil.
The psxy-associated file names are netcode-vecs.dat (vectors)
and
netcode-sigs.dat (sigmas=error ellipses).
The psvelo-associated file name is netcode-vels.dat
containing both vector and error-ellipse information.
There is an optional label column that can be ignored using +V
............See
chapter on vectors below.
-e +e Error ellipses drawing under -v can be switched on(-)/off(+)
-
(Minus) Delimiter, needed if -N etc. must preceed a netcode.
In the following description abc designates a netcode
Environment:
parameter
meaning
[default]
SWEMAP_TITLE page top title, fixed position no title
PSF
postscript temporary file name root
(you can drop ".ps")
[xxx]
SX_style GMT
-X
and -Y options to specify distance
SY_style of
lower left corner from
origin
[-X0 -Y0]
RESOL_style resolution of
coastline
[i]
(I made it style-specific since you might like
a different resolution inside a map inset)
REGION
map
region (high
priority)
[5/54/37/70r]
REGION_style ... lower priority
PRJCT
projection
parameters
[s16/65/1:9000000]
PRJCT_style ... lower priority
SWEMAP_WESN frame drawing and
annotation
options
[WeSn]
WESN_style ... lower
priority
TIXX_style
[a10g10]
TIXY_style
frame tickmark and gridline
options
[a5g5]
COLOR_abc marker
colors
[tp]
special value "tp" = transparent.
VCOLOR_abc specifies vector and symbol outline pen/color [1/0/0/255]
VOPT_abc
vector
modes, v = vertical
..............................V
=
horizontal
[V]
ECOLOR_abc If vectors
are
drawn with psvelomeca (-vr or -vv)
the error ellipse is filed with this color.
Instead of a color you can specify
tp for transparent
v to fill it with the same color as the vector
COLOR_abc..........................................[tp]
SYMBOL_abc marker shapes
(see -S option on psxy
man page) [a0.05]
Use p to get a simple, almost invisible dot.
TITLE_abc legend
text
[no legend entry]
Note that vector plots take their legend text
from the netcode-vecs.dat or netcode-vels.dat file
(keyword "SAMPLE").
SWEMAP_TOPO yes or file_name_root
(drop
".grd"):
include a shaded relief.
................yes
must be combined with -t
option.
[no]
SWEMAP_TOPOTF name of a grd file to color the
background,
the
result of a clr_map or topomap job.
Consider to combine with setenv SWEMAP_BATHY yes
SWEMAP_TOPOIF name of a grd file for intensities
(like "haze").
Specify command line option -t - (together!) to
use the environment definition.
(-t -p with
grdproject).
[no defaults]
RESCALE_TOPO numerical value to rescale
topographic
map. It's
the ratio ( scale_t : scale ) where
................p[x/y]1:scale_t
was PRJCT in topomap
and scale
actually used
here.
[1]
SWEMAP_BATHY yes under SWEMAP_TOPO
= yes or under -t will avoid
to paint the ocean blunt light-blue. Unfortunately
lakes cannot be
excepted.
[no]
SWEMAP_POLIT enter option for political
boundaries,
e.g.
-N1/0.25tap for national boundaries as
dashed lines. You can specify more than one:
setenv SWEMAP_POLIT "-N1/0.25tap
-N2/0.1tap"
[]
SWEMAP_CPT the basename of the cpt (color scheme) file [topo]
SWEMAP_SYMBOL specify symbol code and size
without
blanks.
Default is a 0.05 inch,
asterisk:
[a0.05]
SWEMAP_NB yes: draw national borders [no]
SWEMAP_ORIENT -L for landscape, -P for portrait [-P]
PUTLABELS no
to suppress labels (put only
symbols)
[yes]
LEGEND
Name
of a file to collect legend drawing commands
[maplegend]
LEGFONT fontnumber and size [0/14]
LEGBOX
Options
to draw legend box:
................-L
to draw box outline, optionally add -Wpen
................-G[color
for the
background]
[]
Default color for the background is LEGTXTB
LEGX LEGY Options to place legend (lower left corner) [0 0]
LEGSIZE Size of the legend [2/2]
LEGTXTB
Background
color in the narrow rectangle around
only the
text.
[255]
LEGBOT LEGTOP Extra space below lowest
and
above highest text
line in the legend box, in units of line height.
Legtop will write another but empty legend line. [0 0]
LEGNSYMBOFF Extra offset X/Y for
curve
symbol in the legend
in units of box width / line
height
[0/0.2]
LEGNTXTOFF Extra offset X/Y for
label text in the legend
in units of box width / line
height
[0.01/0.25]
LEGVSYMBOFF Extra offset X/Y for
vector
symbol in the legend
in units of box width / line
height
[0/0.2]
LEGVTXTOFF Extra offset X/Y for
label text in the legend
in units of box width / line
height
[0.01/0.25]
LEGESPACE Extra space
above
top line of legend. Does not
produce an empty legend
entry.
[0.5]
LEGSEXOFF x and y offset
in
units of the legend box.
Used only on an eventual SAMPLEXPL record
in a vector
file.
[-0.1/0.3]
The following environment parameters control color of map features.
Check with man pscoast
LANDCOLOR
[255/255/220]
OCEANCOLOR
[200/250/250]
LAKECOLOR
[180/220/220]
COASTCOLOR
[100/160/220]
COASTPEN
[2/$COASTCOLOR]
RIVERCOLOR
[-220/220/240]
RIVERS
[-I1/3/$RIVERCOLOR -I2/2/$RIVERCOLOR]
WETFEATURES size parameters after
-A
[100/0.5/4]
Example:
/hgs/gps/stacov2ll
/gps2/SWEPOS_RESULTS/SMHI_RESULTS/smhi5_mrg_sweref
smhi
setenv COLOR_smhi 200/200/0
setenv SYMBOL_smhi t0.1
setenv TITLE_smhi "SMHI"
swemap -s fnosk smhi -o smhi.ps
You can collect/edit the setenv parameters in a file
and issue
source file
before swemap.
The following parameters are autmatically written into short files to set the environment properly in associated jobs (utilised by topomap)
echo "setenv REGION $region" >
STYLE_style.csh
echo "setenv PRJCT $prjct" >>
STYLE_style.csh
echo "setenv RESOL $resol" >>
STYLE_style.csh
echo "REGION=$region" > STYLE_style.sh
echo "PRJCT=$prjct" >> STYLE_style.sh
echo "RESOL=$resol" >> STYLE_style.sh
echo "export REGION PRJCT RESOL"
>>
STYLE_style.sh
Employ by
source STYLE_style.csh # csh/tcsh
or
. STYLE_style.sh
# sh/ksh
Files:
abc-labels.dat If you code abc
in the parameter list, this file must
exist else the program aborts.
Optional Files:
abc-locs.dat if not
existent,
a new one is made from abc-labels.dat
psxy is used to plot isolated symbols (SYMBOL_abc)
abc-title.dat if not existent, environment TITLE_abc is used. Rarely used.
abc-vecs.dat vectors
using
psxy. Made by e.g. ~/gps/p/m/hdrvecs.f
..................SAMPLE
and SAMPLEXPL codewords in column 5 mark a sample vector
that is to be put into the legend.
Parameters in columns 3 and 4 control the sample vector
according to the psxy-rules.
abc-sigs.dat error ellipses using psxy. Made by e.g. ~/gps/p/m/hdrvecs.f
abc-vels.dat psvelomeca
is
used in vector + error-ellipse mode.
Seven columns are required.
..................SAMPLE
and SAMPLEXPL in columns
6 or 7 with optional text beyond mark a sample vector to be
put into the legend. Columns 1 and 2 are ignored.
Column 3 and 4 control size, 5 the size of the error circle.
..................STRAINSAMPLE
in columns 6 or 7 is special in that it will
place two vectors back-to-back as the legend sample.
abc-line.dat psxy is used to plot '>' - segmented lines.
abc-box.dat psxy
-L
is used to plot closed boxes on a region measured in
paper units. Separator ´>´ between segments.
Examples:
swe-labels.dat
11.9264 57.3958
12 0.0 4 11 Onsala \040
20.9684 67.8574
12 0.0 4 3 Kiruna \040
...
Observe that the two blanks at the end of the name (\040 is also a blank) are needed to place labels to the left of the marker (placement options 3, 7 or 11) in the 12pt font. Smaller fonts may require more blanks.
nuvelver-vecs.dat
18.1249
66.3180
90.0 .6120
13.7181
56.0922
270.0 .1170
14.0596
57.7455
90.0 .3727
13.5056
59.4440
90.0 .3120
...
Vectors:
abc-vecs.dat (vector data) can be combined with abc-sigs.dat
(sigmas).
Options to select this mode: -v -e abc
The error ellipses are plotted at the base of the vector.
If you need error bars at the tips of the vectors,
psvelomeca must be used. The data must be provided in a file
abc-vels.dat, the swemap option is -vv abc
There is a man page for psvelomeca.
Example in /home/hgs/gps/maps/vec-vecs.dat , netcode is vec
In this case vec-vecs.dat
contains the vector data:
...............................x
y angle length
...............................Last
row codes the sample vector
...............................for
the legend. It must be marked
...............................with
the word SAMPLE in column 5 <----
...............................and
may contain title text
/____
|
...............................in
column 6 and
beyond
\ | |
| |
...............vec-locs.dat
has been made
automatically.
| |
TITLE_vec vec-title.dat
may contain legend sample
text
| |
...............................to
override the one at -------------' |
...............................Rules:
see Chap. Titles below
|
|
...............................A
record
|
...............................x
y 0 0 SAMPLEXPL text
|
...............................may
appear below the SAMPLE -------------'
This text is added in the legend
above the sample line.
...............................x
and y are offsets with respect to
the default position (-0.1/0.3);
the offsets are used only if
...............................$LEGSEXOFF
= file
...............................else
$LEGSEXOFF
may specify the offset.
Useful default parameters exist for network codes that end with
characters hor or vec (horizontal
vectors) and ver (vertical).
Example: nuvelver-vecs.dat
which might specify GPS-determined vertical rate residuals with
respect to a plate motion model.
18.1249
66.3180
90.0 .6120
13.7181
56.0922
270.0 .1170
14.0596
57.7455
90.0 .3727
13.5056
59.4440
90.0 .3120
30.0000
46.5000
90.0 .2000 SAMPLE
More controls:
Environment:
VECTOR_abc specifies the vector size [ default 0.01/0.1/0.03 ]
VOPT_abc specifies the vector
drawing
mode ( GMT: the symbol code, v or V after -S
)
.............h or
H
will be accepted as synonymous with V.
Horizontal vectors should be plotted with -V in order to align the
symbols with the latitude-longitude grid.
Default: If the netcode contains the string hor , V
will
be selected,
if the netcode contains the string ver , v will be
selected.
else V will be used.
Command line:
+V -V Switch
off/on
the plotting of names from the string-column of the
.............netcode-vecs.dat
or netcode-vecs.dat file.
A pair of -vels files can be used to plot strain crosses, e.g. with compressive strain in red and extensional in blue. There is an example below.
setenv COLOR_xstrain 0/0/255
setenv COLOR_cstrain 255/0/0
setenv VCOLOR_xstrain 1/0/0/255
setenv VCOLOR_cstrain 1/255/0/0
setenv VECTOR_xstrain 0.01/0.1/0.03n # n:
downscale
the tip of small vectors
setenv VECTOR_cstrain 0.01/-0.1/0.03n # reverts the
tip inward
xstrain-vels.dat:
x1 y1 v1 w1 0 0 0
x1 y1 -v1 -w1 0 0 0
...
0 0 0.2 0 0 0 0 STRAINSAMPLE Rate 10 n/yr
0 0 0 0 0 0 0 SAMPLEXPL Extension
cstrain-vels.dat:
x1 y1 v2 w2 0 0 0
x1 y1 -v2 -w2 0 0 0
...
0 0 0.2 0 0 0 0 STRAINSAMPLE Rate 10 n/yr
0 0 0 0 0 0 0 SAMPLEXPL
Compression
swemap -o strain.ps - +V -vr cstrain xstrain
Titles:
They designate legend entries; addlegend
and pslegend
are used to plot them.
Environment TITLE_abc takes
precedence
over file abc-title.dat.
A default may be defined in this procedure, setting title_abc
else
no legend entry will be made.
In the case of site networks, the netcodes are used to resolve title entries. Typical netcodes are swe fin nor
In the case of vector files, legend entries are usually written due
to SAMPLE and SAMPLEXPL
records contained at the end of the files:
0 0 angle length SAMPLE text
x y 0 0 SAMPLEXPL text
The offset of the SAMPLEXPL text within the
legend
box is controlled by environment variable LEGSEXOFF.
If it is set to the special value file,
setenv LEGSEXOFF file
the first two parameters ( x y ) at the SAMPLEXPL
record
in the file are used and added to -0.1/0.3 . Else
setenv LEGSEXOFF x/y
can be used to define a fixed offset. Default is -0.1/0.3
(in units of the legend box region = 0/1/0/1)
Example: Vectors
setenv LEGSEXOFF file
The last three lines of the vector file:
...
12.8789
49.1442
90.0 .0470
35.0000
56.0000
90.0 .3750 SAMPLE v 5.0 mm/yr
0.2
0
0
0 SAMPLEXPL Bifrost
Example: Networks
Code swe may refer to the following
files:
swe -> swe-labels.dat
swe-locs.dat swe-titles.dat swe-vecs.dat
and environment variables:
......swe -> SYMBOL_swe..COLOR_swe.TITLE_swe..VOPT_swe
The global default symbol is SWEMAP_SYMBOL or
.-a0.05,
color
black, no title, horizontal vector.
Defaults exist for COLOR_abc .and
.SYMBOL_abc.for
some networks, see the body of swemap.
More examples:
A nice VLBI map - look here.
Make a combined map in two strokes, Scandinavia with Spetsbergen.
We will use the -O and -K options in the first and second stroke,
repectively,
and combine the postscript output using cat.
File swe+spets contains
setenv LEGFONT 1/14
setenv LEGX 4.5 setenv LEGY -7 setenv LEGSIZE 2/0.6 setenv LEGBOX "-G255 -L -W0" setenv SX_spets -X0.2 setenv SY_spets -Y7.0 setenv COLOR_spets 255 setenv VCOLOR_spets 2/200/0/200 setenv SYMBOL_spets t0.12 setenv TITLE_spets IGS We have also swe-labels.dat
Run the job by
|
(to be continued)
FAQ:
Q: How do I get Scandinavian characters ?
A: Use \nnn. Here's the table
å | \376 |
ä | \342 |
ö | \363 |
ü | \370 |
Å | \375 |
Ä | \276 |
Ö | \331 |
Ü | \335 |
æ | \361 |
Æ | \341 |
Q: Why don't I get Scandinavian characters although I use that
coding?
A: You need a file .gmtdefaults
in the current directory. It must contain a line
WANT_EURO_FONT = TRUE.
Q: What symbols are available?
A: You code -S followed by a code letter followed by a size
parameter (inch). Codes:
a - asterisk; t - triangle up, i - triangle down;
x - cross; p - point;
s - square; d - diamond; h - hexagon; c
-circle
Letters and text strings can be produced by -Sl
-Slsize/text
Q: What coastline resolutions are available ?
A: c -crude; l - low; i - intermidiate;
h
- high; f - full
full resolution | intermediate resolution | intermediate resolution | crude resolution |
Q: Give me hints for REGION and PRJCT that work ?
A: Sorry, it's not so simpe. A REGION expression for a
rectangular
map is
west/south/east/northr
Note the r ! These longitude-latitude pairs refer to the corner
of the map.
A REGION expression for a map bounded by longitude and latitude
lines is
west/east/south/north
Note the order ! A length of 1000 km on the earth to map on 10 cm of
paper
means scale 1:10000000. This corresponds to 9 degrees along a great
circle.
I use mostly two projections, mercator (PRJCT mscale)
and stereographic
(PRJCT slon/lat/scale)
The stereographic projection is not quite equidistant. Mercator is
not at all equidistant.
The stereographic projection is equal-area, and Mercator is conformal.
The stereographic projection works by putting the drafting plane
tangential
to the earth
ellipsoid. Therefore you must specify a tangent point, the map pole.
Thus,
s20/60/1:20000000 is a typical PRJCT parameter for Scandinavia.
You probably
need to fine-adjust the pole's longitude. Ideally it should run
vertically
through the
centre of the map. Find the center longitude and the corner
coordinates in map units and on the paper using the tool mapproject.
You'll need to
iterate a couple of times!
Example
Oftentimes you know the centre of your map (eg. 17/60) and you have
a good idea of the lower
left corner (e.g. 8/54). Determine the upper right corner using
echo 17 60 | mapproject -Js17/60/1:20000000 -R8/54/20/61r | awk '{print 2*$1,2*$2}' | mapproject -Js17/60/1:20000000 -R8/54/20/61r -I
(the gray-toned parameters are arbitrary, (but need to greater in value in order to describe a rectangle)
Next example: Stereographic map from Iceland to Finland, Denmark
to North Cape.
Obviously, Iceland and Finland are critical for the longitude (-25
to 35 deg), and Iceland
is far from the lower left corner. Centre longitude 5 deg might be
a good guess.
$ echo 5 62 | mapproject
-Js5/62/1:20000000
-R-25/54/60/70r | awk '{print 2*$1,2*$2}' | mapproject
-Js5/60/1:20000000
-R-25/54/60/70r -I
42.228121 60.984149
Make a first test map:
$ setenv REGION -25/54/43/61
$ setenv PRJCT s5/62/1:20000000
$ swemap -o icefin.ps
Measure on the map how many centimeters the corners have to be
moved.
For the lower corner (guess 0 -2)
$ echo 0 -2 | mapproject -Js5/62/1:20000000
-R-25/54/60/70r -I
-19.650346 45.807163
Find the upper corner again:
$ echo 5 62
| mapproject -Js5/62/1:20000000 -R-20/45/60/70r | awk '{print
2*$1,2*$2}'
| mapproject -Js5/62/1:20000000 -R-20/45/68/80r -I
57.527069
67.936659
Thus, we issue the better guess
$ setenv REGION
-20/45/57/68r
$ swemap -o icefin.ps
Make the map higher by 1 inch, but not wider:
$ echo 5 62
| mapproject -Js5/62/1:20000000 -R-20/45/68/80r | awk '{print 2*$1,2*$2+1}'
| mapproject -Js5/62/1:20000000 -R-20/45/68/80r -I
Additional trimming is still required.We cut
one
inch left and right, and scale up 30 percent...