NADCON5-ng  0.0.2
NADCON5 Next Generation Documentation
cpt.f
Go to the documentation of this file.
1 c> \ingroup core
2 c> \if MANPAGE
3 c> \page cpt
4 c> \endif
5 c>
6 c> This subroutine generates the color pallette variables
7 c> for a GMT color plot
8 c>
9 c> \param[in] ave Average of the gridded data
10 c> \param[in] std Standard deviation of the gridded data
11 c> \param[in] csm Color Sigma Multiplier (how many sigmas on each
12 c> side of the average do you want the colors to range?)
13 c> \param[out] xlo Low value
14 c> \param[out] xhi High value
15 c> \param[out] xin Interval
16 c>
17 c> ## Changelog
18 c>
19 c> ### 2016 09 06:
20 c> Modified because the forcing of "scave" to be one non zero
21 c> digit was throwing off the scalebar so far in Guam that
22 c> the data in Guam wasn't even plotting. Change to make
23 c> the interval still be one non zero digit, but then a
24 c> simpler formula for the scaled average was put in.
25 c>
26 c> ### 2016 07 29:
27 c> Modified from original version to reflect "new math" invented
28 c> this week that helps shrink the color bar and/or widen the
29 c> color bar (see issues 14 and 15 in DRU-12, p. 48)
30 c>
31  subroutine cpt(ave,std,csm,xlo,xhi,xin)
32 
33 c - 2016 09 06
34 c Modified because the forcing of "scave" to be one non zero
35 c digit was throwing off the scalebar so far in Guam that
36 c the data in Guam wasn't even plotting. Change to make
37 c the interval still be one non zero digit, but then a
38 c simpler formula for the scaled average was put in.
39 
40 c - 2016 07 29
41 c Modified from original version to reflect "new math" invented
42 c this week that helps shrink the color bar and/or widen the
43 c color bar (see issues 14 and 15 in DRU-12, p. 48)
44 
45  implicit none
46  real*8 ave,std,csm,xlo,xhi,xin
47  real*8 qv,qq,scave
48  integer*4 iv,iq
49  real*8 spread8,onzd2
50 c - This subroutine generates the color pallette variables
51 c - for a GMT color plot
52 c
53 c - Input:
54 c ave = Average of the gridded data
55 c std = Standard deviation of the gridded data
56 c csm = Color Sigma Multiplier (how many sigmas on each
57 c side of the average do you want the colors to range?)
58 c - Output:
59 c xlo = Low value
60 c xhi = High value
61 c xin = Interval
62 
63  spread8 = 2 * csm * std / 8.d0
64  xin = onzd2(spread8)
65 
66 c iv = floor(dlog10(std))
67 c qv = 10.d0**iv
68 c qq = std / qv
69 c iq = nint(qq)
70 
71 c - 2016 09 06
72 c write(6,*) ' cpt: ave (pre onzd2) = ',ave
73 c scave = onzd2(ave)
74 c write(6,*) ' cpt: ave (post onzd2) = ',ave
75  scave = xin * nint(ave / xin)
76 
77 c xin = iq * qv
78 c scave = qv * nint(ave/qv)
79 
80 c xlo = scave - csm*xin
81 c xhi = scave + csm*xin
82 
83  xlo = scave - 4*xin
84  xhi = scave + 4*xin
85 
86  write(6,*) ' ---------------------'
87  write(6,*) 'cpt: ave = ',ave
88  write(6,*) 'cpt: std = ',std
89  write(6,*) 'cpt: csm = ',csm
90  write(6,*) 'cpt: spread8 = ',spread8
91  write(6,*) 'cpt: targ low = ',ave-csm*std
92  write(6,*) 'cpt: targ high= ',ave+csm*std
93  write(6,*) ' '
94  write(6,*) 'cpt: xin = ',xin
95  write(6,*) 'cpt: scave = ',scave
96  write(6,*) 'cpt: xlo = ',xlo
97  write(6,*) 'cpt: xhi = ',xhi
98 
99  return
100  end
101  include 'onzd2.f'
subroutine cpt(ave, std, csm, xlo, xhi, xin)
This subroutine generates the color pallette variables for a GMT color plot.
Definition: cpt.f:32