<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:&quot;Times New Roman&quot;,serif">Hello,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:&quot;Times New Roman&quot;,serif">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:&quot;Times New Roman&quot;,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:&quot;Times New Roman&quot;,serif">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:&quot;Times New Roman&quot;,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:&quot;Times New Roman&quot;,serif">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:&quot;Times New Roman&quot;,serif;
color:red">fatal:[&quot;NclVar.c&quot;: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:&quot;Times New Roman&quot;,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:&quot;Times New Roman&quot;,serif">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:&quot;Times New Roman&quot;,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:&quot;Times New Roman&quot;,serif">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:&quot;Times New Roman&quot;,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:&quot;Times New Roman&quot;,serif">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:&quot;Times New Roman&quot;,serif">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:&quot;Times New Roman&quot;,serif">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:&quot;Times New Roman&quot;,serif">Lifen<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:&quot;Times New Roman&quot;,serif">&nbsp;</span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt;"><span style="font-family:&quot;Times New Roman&quot;,serif">***************<o:p></o:p></span></p>
<p class="MsoPlainText"><span style="font-size:11.0pt;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&#23435;&#20307;">load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;&nbsp; <br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl&quot; <br>
<br>
<br>
in1 = addfile(&quot;bcc.nc&quot;,&quot;r&quot;)<br>
in2 = addfile(&quot;pft.nc&quot;,&quot;r&quot;)<br>
t1 = in1-&gt;ESMF_sftlf_regrid<br>
t0 = in2-&gt;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-&gt;lat<br>
lon = in1-&gt;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&nbsp;&nbsp; = 6.37122e06<br>
<br>
rad&nbsp; = 4.0 * atan(1.0) / 180.0<br>
con&nbsp; = re * rad&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
clat = cos(lat * rad)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; cosine of latitude<br>
&nbsp;&nbsp; <br>
dlon = (lon(2) - lon(1))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; assume dlon is constant<br>
dlat = (lat(2) - lat(1))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; assume dlat is constant<br>
<br>
dx&nbsp;&nbsp; = con * dlon * clat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; dx at each latitude<br>
dy&nbsp;&nbsp; = con * dlat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; dy is constant<br>
dxdy = dx * dy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; dxdy(nlat)<br>
dydx = dy * dx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; dydx(nlat)<br>
&nbsp;&nbsp; <br>
wgt&nbsp; = new((/180, 360/), typeof(t1))<br>
wgt&nbsp; = 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>