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