1 ;********************************************************
2 ; histogram normalized by rain and compute correleration
3 ;********************************************************
4 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl.test"
5 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl.test"
6 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
8 procedure pminmax(data:numeric,name:string)
10 print ("min/max " + name + " = " + min(data) + "/" + max(data))
11 if(isatt(data,"units")) then
12 print (name + " units = " + data@units)
24 ;************************************************
26 ;************************************************
32 ;model_name_i = "i01.07cn"
33 ;model_name_f = "i01.10cn"
35 model_name_i = "i01.07casa"
36 model_name_f = "i01.10casa"
38 dirm = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
39 film_i = model_name_i + "_1990-2004_ANN_climo.nc"
40 film_f = model_name_f + "_1990-2004_ANN_climo.nc"
42 fm_i = addfile (dirm+film_i,"r")
43 fm_f = addfile (dirm+film_f,"r")
48 ;************************************************
50 ;************************************************
52 ob_name = "MODIS MOD 15A2 2000-2005"
54 diro = "/fis/cgd/cseg/people/jeff/clamp_data/lai/ob/"
55 filo = "land_class_"+model_grid+".nc"
57 fo = addfile(diro+filo,"r")
59 classob = tofloat(fo->LAND_CLASS)
61 class_name = (/"Water Bodies" \
62 ,"Evergreen Needleleaf Forests" \
63 ,"Evergreen Broadleaf Forests" \
64 ,"Deciduous Needleleaf Forest" \
65 ,"Deciduous Broadleaf Forests" \
69 ,"Woody Savannas (S. Hem.)" \
70 ,"Savannas (S. Hem.)" \
72 ,"Permanent Wetlands" \
74 ,"Urban and Built-Up" \
75 ,"Cropland/Natural Vegetation Mosaic" \
76 ,"Permanent Snow and Ice" \
77 ,"Barren or Sparsely Vegetated" \
79 ,"Woody Savannas (N. Hem.)" \
80 ,"Savannas (N. Hem.)" \
83 ;*******************************************************************
84 ; Calculate "nice" bins for binning the data in equally spaced ranges
85 ;********************************************************************
87 range = fspan(0,nclassn-1,nclassn)
90 ; Use this range information to grab all the values in a
91 ; particular range, and then take an average.
95 xvalues = new((/2,nx/),float)
96 xvalues(0,:) = range(0:nr-2) + (range(1:)-range(0:nr-2))/2.
97 dx = xvalues(0,1) - xvalues(0,0) ; range width
98 dx4 = dx/4 ; 1/4 of the range
99 xvalues(1,:) = xvalues(0,:) - dx/5.
103 DATA11_1D = ndtooned(classob)
104 DATA12_1D = ndtooned(npp_i)
105 DATA22_1D = ndtooned(npp_f)
107 yvalues = new((/2,nx/),float)
108 mn_yvalues = new((/2,nx/),float)
109 mx_yvalues = new((/2,nx/),float)
113 ; See if we are doing model or observational data.
123 ; Loop through each range and check for values.
126 if (i.ne.(nr-2)) then
128 ; print("In range ["+range(i)+","+range(i+1)+")")
129 idx = ind((data_ob.ge.range(i)).and.(data_ob.lt.range(i+1)))
132 ; print("In range ["+range(i)+",)")
133 idx = ind(data_ob.ge.range(i))
136 ; Calculate average, and get min and max.
138 if(.not.any(ismissing(idx))) then
139 yvalues(nd,i) = avg(data_mod(idx))
140 mn_yvalues(nd,i) = min(data_mod(idx))
141 mx_yvalues(nd,i) = max(data_mod(idx))
142 count = dimsizes(idx)
145 yvalues(nd,i) = yvalues@_FillValue
146 mn_yvalues(nd,i) = yvalues@_FillValue
147 mx_yvalues(nd,i) = yvalues@_FillValue
150 ; print(nd + ": " + count + " points, avg = " + yvalues(nd,i))
151 ; print("Min/Max: " + mn_yvalues(nd,i) + "/" + mx_yvalues(nd,i))
153 ; Clean up for next time in loop.
161 ;============================
163 ;============================
168 good = ind(.not.ismissing(u) .and. .not.ismissing(v))
171 ww = class_name(good)
173 n_biome = dimsizes(uu)
175 beta_biome = new((/n_biome/),float)
177 beta_biome = ((vv/uu) - 1.)/log(co2_f/co2_i)
179 beta_biome_avg = avg(beta_biome)
181 print("class/beta: " + ww + "/" + beta_biome)
182 print (beta_biome_avg)