File: GMT_chunking.sh

package info (click to toggle)
gmt 5.3.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 150,460 kB
  • ctags: 18,539
  • sloc: ansic: 194,217; sh: 7,349; xml: 149; makefile: 72; fortran: 49; lisp: 41; csh: 5
file content (42 lines) | stat: -rwxr-xr-x 1,033 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# $Id: GMT_chunking.sh 12063 2013-08-08 13:50:59Z fwobbe $
#
# Make an illustration of grid chunking
#

PS=GMT_chunking.ps

gmt set MAP_FRAME_PEN      thick \
        FONT_ANNOT_PRIMARY 9p

n=1 # current cell number

for ((x=0;x<12;++x)); do
  # x: number of chunk
  for ((j=2;j>=0;--j)); do
    # j: y-coordinate in each chunk
    for ((i=0;i<3;++i)); do
      # i: x-coordinate in each chunk
      echo "$i $j $((n++))"
    done
  done > chunk.tmp

  # plot chunks
  if [ $x -eq 0 ]; then
    # first chunk
    gmt pstext chunk.tmp -R-0.5/2.5/-0.5/2.5 -Bg1+0.5 -JX2c/0 -Y10c -K > $PS
  elif [ $x -eq 4 -o $x -eq 8 ]; then
    # new chunk row
    gmt pstext chunk.tmp -R -J -B+glightblue -Bg1+0.5 -X-6.3c -Y-2.1c -O -K >> $PS
  elif [ $x -eq 5 -o $x -eq 9 -o $x -eq 10 ]; then
    # colored chunks
    gmt pstext chunk.tmp -R -J -B+glightblue -Bg1+0.5 -X2.1c -O -K >> $PS
  else
    gmt pstext chunk.tmp -R -J -Bg1+0.5 -X2.1c -O -K >> $PS
  fi
done

# finalize PS
gmt psxy -R -J -O <<< "-99 -99" >> $PS

rm -f chunk.tmp