[ncl-talk] error message associated with month_to_annual_weighted function
Lei Meng
dream916 at gmail.com
Wed Jan 28 09:54:02 MST 2015
Hi,
I tried to convert monthly values to annual valued weighted by the number
of days. Here is my code:
----
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
begin
diri = "/Users/nmb1441/research/papers/china/monsoons/cru_data/pet/"
srcFileName = "cru_ts3.21.1951.1960.pet.dat.nc"
refile= addfile(diri + srcFileName,"r")
pet = refile->pet
lat = refile->lat
lon = refile->lon
time = refile->time
time at calendar = "gregorian"
yearfrac = cd_calendar(time, 4)
yyyymm1 = cd_calendar(time, 1)
dym = cd_calendar(time, 1)
print(dym)
printVarSummary(pet)
printVarSummary(dym)
pet_annual_total1= month_to_annual_weighted(dym,pet,0)
end
--
The summaries of variables pet and dym are as follows:
Variable: pet
Type: double
Total Size: 248832000 bytes
31104000 values
Number of Dimensions: 3
Dimensions and sizes: [time | 120] x [lat | 360] x [lon | 720]
Coordinates:
time: [18642..22264]
lat: [-89.75..89.75]
lon: [-179.75..179.75]
Number Of Attributes: 5
long_name : potential evapotranspiration
units : mm/day
correlation_decay_distance : -999
_FillValue : 9.969209968386869e+36
missing_value : 9.969209968386869e+36
Variable: dym
Type: double
Total Size: 960 bytes
120 values
Number of Dimensions: 1
Dimensions and sizes: [120]
Coordinates:
Number Of Attributes: 1
calendar : gregorian
(0) month_to_annual_weighted: mm must be 1-to-12 inclusive
The error message is " mm must be 1-to-12 inclusive".
dym values are from 195101 to 196012.
This is a very simple code. I couldn't figure out what was wrong with my
code.
The data is too big and I will send it if necessary. Thanks for any
suggestions.
Lei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150128/57264997/attachment.html
More information about the ncl-talk
mailing list