<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Times New Roman;color: #000000;font-size: 12pt;">
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif">Hello,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif">I am computing the sums of variable “ESMF_sftlf_regrid” in the file “bcc” at each biome. Types of biomes was defined as “var2d” in the file “pft”.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif">I am expecting it will return ten different values (10 types of biomes). But it returned ten same values and with the error massage:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif;
color:red">fatal:["NclVar.c":1376]:Assignment type mismatch, right hand side can't be coerced to type of left hand side<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif;
color:red">fatal:Execute: Error occurred at or near line 41 in file BiomeTotals_CMIP5.ncl<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif">I have attached my code below and my data files.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif">I appreciate if someone can help figure out the problems in the code.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif">Lifen<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif"> </span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:"Times New Roman",serif">***************<o:p></o:p></span></p>
<p class="MsoPlainText"><span style="font-size:11.0pt;font-family:"Times New Roman",serif;
mso-fareast-font-family:宋体">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" <br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl" <br>
<br>
<br>
in1 = addfile("bcc.nc","r")<br>
in2 = addfile("pft.nc","r")<br>
t1 = in1->ESMF_sftlf_regrid<br>
t0 = in2->var2d<br>
<br>
t2 = t0(lat|:,lon|:) ; reorder<br>
<br>
t1 = lonFlip(t1)<br>
t2 = lonFlip(t2)<br>
printVarSummary(t1)<br>
printVarSummary(t2)<br>
<br>
lat = in1->lat<br>
lon = in1->lon<br>
<br>
bc_density = new(dimsizes(t1),typeof(t1))<br>
bc_sum = new(10,typeof(t2))<br>
do i = 0, 9<br>
bc_density = where(t2.eq. i, t1, bc_density@_FillValue) ; bc_density will be overwritten at each iteration of the loop<br>
re = 6.37122e06<br>
<br>
rad = 4.0 * atan(1.0) / 180.0<br>
con = re * rad <br>
clat = cos(lat * rad) ; cosine of latitude<br>
<br>
dlon = (lon(2) - lon(1)) ; assume dlon is constant<br>
dlat = (lat(2) - lat(1)) ; assume dlat is constant<br>
<br>
dx = con * dlon * clat ; dx at each latitude<br>
dy = con * dlat ; dy is constant<br>
dxdy = dx * dy ; dxdy(nlat)<br>
dydx = dy * dx ; dydx(nlat)<br>
<br>
wgt = new((/180, 360/), typeof(t1))<br>
wgt = conform(wgt, dxdy, 0)<br>
bc_sum(i) = wgt_areasum2(bc_density, wgt, 0)<br>
print(bc_sum(i))<br>
end do<br>
<br>
print(bc_sum)<br>
</span></p>
<div>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma">
<div style="font-family:Tahoma">
<div style="font-family:Tahoma">
<div>
<div></div>
<div style="font-size:13px">
<div></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>