<div dir="ltr">Hi,<div><br></div><div>I tried to convert monthly values to annual valued weighted by the number of days. Here is my code:</div><div><br></div><div>----</div><div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl&quot;</div><div>begin</div><div> </div><div>  diri = &quot;/Users/nmb1441/research/papers/china/monsoons/cru_data/pet/&quot;</div><div>  srcFileName = &quot;<a href="http://cru_ts3.21.1951.1960.pet.dat.nc">cru_ts3.21.1951.1960.pet.dat.nc</a>&quot;   </div><div>  refile= addfile(diri + srcFileName,&quot;r&quot;)</div><div><br></div><div>  pet = refile-&gt;pet</div><div>  lat = refile-&gt;lat</div><div>  lon = refile-&gt;lon</div><div>  time = refile-&gt;time</div><div>  </div><div>  time@calendar = &quot;gregorian&quot;</div><div>  yearfrac = cd_calendar(time,  4)</div><div>  </div><div>  yyyymm1 = cd_calendar(time, 1)</div><div>  </div><div>  dym      = cd_calendar(time,  1) </div><div>  </div><div>  print(dym)</div><div><br></div><div>  printVarSummary(pet)</div><div>  printVarSummary(dym)</div><div>  pet_annual_total1= month_to_annual_weighted(dym,pet,0)</div><div>     </div><div>end</div></div><div>--</div><div>The summaries of variables pet and dym are as follows:</div><div><br></div><div>







<p class=""><span class="">Variable: pet</span></p>
<p class=""><span class="">Type: double</span></p>
<p class=""><span class="">Total Size: 248832000 bytes</span></p>
<p class=""><span class="">            31104000 values</span></p>
<p class=""><span class="">Number of Dimensions: 3</span></p>
<p class=""><span class="">Dimensions and sizes:<span class="">        </span>[time | 120] x [lat | 360] x [lon | 720]</span></p>
<p class=""><span class="">Coordinates: </span></p>
<p class=""><span class="">            time: [18642..22264]</span></p>
<p class=""><span class="">            lat: [-89.75..89.75]</span></p>
<p class=""><span class="">            lon: [-179.75..179.75]</span></p>
<p class=""><span class="">Number Of Attributes: 5</span></p>
<p class=""><span class="">  long_name :<span class="">        </span>potential evapotranspiration</span></p>
<p class=""><span class="">  units :<span class="">        </span>mm/day</span></p>
<p class=""><span class="">  correlation_decay_distance :<span class="">        </span>-999</span></p>
<p class=""><span class="">  _FillValue :<span class="">        </span>9.969209968386869e+36</span></p>
<p class=""><span class="">  missing_value :<span class="">        </span>9.969209968386869e+36</span></p><p class="">Variable: dym</p><p class=""><span class=""></span></p>
<p class=""><span class="">Type: double</span></p>
<p class=""><span class="">Total Size: 960 bytes</span></p>
<p class=""><span class="">            120 values</span></p>
<p class=""><span class="">Number of Dimensions: 1</span></p>
<p class=""><span class="">Dimensions and sizes:<span class="">        </span>[120]</span></p>
<p class=""><span class="">Coordinates: </span></p>
<p class=""><span class="">Number Of Attributes: 1</span></p>
<p class=""><span class="">  calendar :<span class="">        </span>gregorian</span></p>
<p class=""><span class="">(0)<span class="">        </span>month_to_annual_weighted: mm must be 1-to-12 inclusive</span></p><p class="">The error message is &quot; mm must be 1-to-12 inclusive&quot;. </p><p class="">dym values are from 195101 to 196012.</p><p class="">This is a very simple code. I couldn&#39;t figure out what was wrong with my code.</p><p class="">The data is too big and I will send it if necessary. Thanks for any suggestions. </p><p class="">Lei</p><p class=""><br></p><p class=""><span class=""><br></span></p></div><div><br></div></div>