Hi Vishali,
Anytime you get a Malloc error, the system you are running on is likely
running out of memory. If that is the case, and you cannot run on a
different machine, the best solution is to reduce the number of
timesteps you are reading in, form multiple files of wind speed, and
concatenate them together using the netCDF operator ncrcat...
Hope that helps..
Adam
On 09/27/2010 05:52 AM, Vishali P. wrote:
> I've tried to use the first method to output of netCDF only for the
> first year (1998). But I found an error.
> This is my script
>
>
> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> ;*************************************************
> ; wind.ncl (1998)
> ;************************************************
> 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/csm/shea_util.ncl"
> ;************************************************
> begin
> ;************************************************
> ; read in netCDF file
> ;************************************************
>
> a = addfile("/home/Vishali/Documents/dadosVentos/uwnd.1998.nc
> <http://uwnd.1998.nc>","r")
> print(a)
> b = addfile("/home/Vishali/Documents/dadosVentos/vwnd.1998.nc
> <http://vwnd.1998.nc>","r")
>
> ;************************************************
> ; read in zonal [u] and meridional [v] winds
> ;************************************************
>
> u = short2flt(a->uwnd(:,:,:,:))
> v = short2flt(b->vwnd(:,:,:,:))
>
> printVarSummary(u)
> printVarSummary(v)
>
> ;************************************************
> ; Calculate Wind speed
> ;************************************************
>
> speed = sqrt(u^2+v^2) ; wind speed magnitude
>
> copy_VarMeta(u, speed)
>
> speed@long_name = "wind speed"
>
> printVarSummary(speed)
>
>
> ;************************************************
> ; Create netCDF output
> ;************************************************
>
> system("/bin/rm -f wind1998.nc <http://wind1998.nc>") ;
> remove any pre-existing file
> ncdf = addfile("wind1998.nc <http://wind1998.nc>" ,"c")
> ; open output netCDF file
>
> ; make time and UNLIMITED dimension ; recommended for
> most applications
> filedimdef(ncdf,"time",-1,True)
>
> ; output variables directly
> ncdf->u = u ; 4D
> ncdf->v = v ; 4D
>
> speed!0 = "time"
> speed!1 = "level"
> speed!2 = "lat"
> speed!3 = "lon" ; assign named dimensions
>
> speed&time = u&time
> speed&level= u&level
> speed&lat = u&lat ; copy variables
> from u to speed
> speed&lon = u&lon
>
> speed@long_name = "Wind Speed" ; assign
> attributes of speed
> speed@units = "m/s"
>
> ncdf->WSpeed = speed
>
> end
>
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> fatal:NclMalloc Failed:[errno=12]
> fatal:Could not coerce values for operation
> fatal:Execute: Error occurred at or near line 1488 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl
>
> fatal:Execute: Error occurred at or near line 23 in file Wind.ncl
>
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
>
> Can anyone help me to solve the problem?
>
> Thanks in advance
>
> Vp
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- __________________________________________________ Adam Phillips asphilli@ucar.edu National Center for Atmospheric Research tel: (303) 497-1726 Climate and Global Dynamics Division fax: (303) 497-1333 P.O. Box 3000 Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Mon Sep 27 11:45:17 2010
This archive was generated by hypermail 2.1.8 : Mon Oct 04 2010 - 08:55:54 MDT