I have a NCL file that calls in some files (up to 14) then
computes some averages of them. However, with NCL version
5.1.1 I get the following error:
fatal:NclMalloc Failed:[errno=12]
fatal:dim_avg_n: Could not coerce input data to double,
can't continue
fatal:Execute: Error occurred at or near line 40 in file
NARCCAPAVG.ncl
Which I know has something to do with memory allocation. I
am guessing I need to have my variables somehow be set to
float when I use the function dim_avg_n_Wrap. Here is a
print out of my variable, WSPD:
Variable: WSPD
Type: float
Total Size: 488317440 bytes
122079360 values
Number of Dimensions: 3
Dimensions and sizes: [time | 8760] x [yc | 104] x [xc |
134]
Coordinates:
time: [0.125..1096]
yc: [600000..5750000]
xc: [600000..7250000]
Number Of Attributes: 9
_FillValue : 1e+20
original_units : m s-1
original_name : UA
missing_value : 1e+20
coordinates : lon lat level
units : m s-1
long_name : wind speed
standard_name : eastward_wind
grid_mapping : Transverse_Mercator
Looking at the NCL archive, I didn't see anything related
to this particular problem with this function,
dim_avg_n_Wrap. Maybe because it is rather new?
Any advice would be helpful.
My code:
;*************************************************
;NARCCAPAVG.ncl
;
;************************************************
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"
;************************************************
begin
;************************************************
; read in multiple netCDF files
;************************************************
diri = "/home/rasmussen/NARCCAP/netCDF/RCM3/" ; directory
where files reside
fils = systemfunc("ls "+diri+"*as_RCM3_*.nc")
nfil = dimsizes(fils)
print(fils)
;*************************Get Variables**********
f = addfiles (fils, "r")
UAS = f[:]->uas ; (time,yc,xc)
VAS = f[:]->vas ; (time,yc,xc)
printVarSummary(UAS)
printVarSummary(VAS)
WSPD = sqrt(UAS^2 + VAS^2) ; calculate wind speed
magnitude
WSPD=(WSPD*2.2) ; convert to miles per hour
copy_VarMeta(UAS, WSPD) ; copy dimensions to new
averaged wind speed array
WSPD_at_long_name = "wind speed"
printVarSummary(WSPD)
;*************************Calculate Average******
WSPD_AVG = dim_avg_n_Wrap(WSPD,0) ; (lat,lon)
WSPD_AVG_at_long_name = "mean wind speed"
printVarSummary(WSPD_AVG)
;************************************************
; output ascii
;************************************************
fName = "RCM3AVG.txt"
system("/bin/rm -f "+fName) ; remove if file is present
asciiwrite (fName , WSPD)
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 22 2009 - 11:40:20 MDT
This archive was generated by hypermail 2.2.0 : Thu Sep 24 2009 - 13:55:09 MDT