File: example_45.sh

package info (click to toggle)
gmt 5.4.5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 149,844 kB
  • sloc: ansic: 202,639; sh: 7,742; xml: 149; makefile: 73; fortran: 49; lisp: 41; csh: 5
file content (29 lines) | stat: -rwxr-xr-x 1,573 bytes parent folder | download
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
#!/bin/bash
#               GMT EXAMPLE 45
#               $Id$
#
# Purpose:      Illustrate use of trend1d mixed models
# GMT modules:  pstext, psxy, trend1d
# Unix progs:   echo, rm
#

ps=example_45.ps
# Basic LS line y = a + bx
gmt trend1d -Fxm CO2.txt -Np1 > model.txt
gmt psxy -R1958/2016/310/410 -JX6i/1.9i -P -Bxaf -Byaf+u" ppm" -BWSne+gazure1 -Sc0.05c -Gred -K CO2.txt -X1.5i > $ps
gmt psxy -R -J -O -K -W0.5p,blue model.txt >> $ps
echo "m@-2@-(t) = a + b\264t" | gmt pstext -R -J -O -K -F+f12p+cTL -Dj0.1i -Glightyellow >> $ps
# Basic LS line y = a + bx + cx^2
gmt trend1d -Fxm CO2.txt -Np2 > model.txt
gmt psxy -R -J -O -Bxaf -Byaf+u" ppm" -BWSne+gazure1 -Sc0.05c -Gred -K CO2.txt -Y2.3i >> $ps
gmt psxy -R -J -O -K -W0.5p,blue model.txt >> $ps
echo "m@-3@-(t) = a + b\264t + c\264t@+2@+" | gmt pstext -R -J -O -K -F+f12p+cTL -Dj0.1i -Glightyellow >> $ps
# Basic LS line y = a + bx + cx^2 + seasonal change
gmt trend1d -Fxmr CO2.txt -Np2,f1+o1958+l1 > model.txt
gmt psxy -R -J -O -Bxaf -Byaf+u" ppm" -BWSne+gazure1 -Sc0.05c -Gred -K CO2.txt -Y2.3i >> $ps
gmt psxy -R -J -O -K -W0.25p,blue model.txt >> $ps
echo "m@-5@-(t) = a + b\264t + c\264t@+2@+ + d\264cos(2@~p@~t) + e\264sin(2@~p@~t)" | gmt pstext -R -J -O -K -F+f12p+cTL -Dj0.1i -Glightyellow >> $ps
# Plot residuals of last model
gmt psxy -R1958/2016/-4/4 -J -O -Bxaf -Byafg10+u" ppm" -BWSne+t"The Keeling Curve [CO@-2@- at Mauna Loa]"+gazure1 -Sc0.05c -Gred -K model.txt -i0,2 -Y2.3i >> $ps
echo "@~e@~(t) = y(t) - m@-5@-(t)" | gmt pstext -R -J -O -F+f12p+cTL -Dj0.1i -Glightyellow >> $ps
rm -f model.txt