[ncl-talk] quation
yohanan sweet
marsilas23 at gmail.com
Tue Jul 11 02:29:34 MDT 2017
Hello
I try to convert txt file to NetCDF but I got an error in my code.
fatal:NclMalloc Failed:[errno=12]
Segmentation fault
please help me
Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170711/3b64ae47/attachment.html
-------------- next part --------------
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/diagnostics_cam.ncl"
begin
;---------------------------------------------------------------------------
ncol = 4
nrow = numAsciiRow ("all_point_rf")
ntime =384
nlat = 384
nlon = 384
data = asciiread ("all_point_rf",(/nrow,ncol/), "float")
data at FillValue = -99.9
printVarSummary(data)
time = data(:ntime-1,0)
mtime = dimsizes(time)
lat = data (::nlat,1)
mlat = dimsizes(lat)
lon = data (::nlon,2)
mlon = dimsizes(lon)
precip = data (:,3)
precip at units = "mm/month"
lat at long_name = "latitude"
lat at units = "degrees_north"
lon at long_name = "longitude"
lon at units = "degrees_east"
time at units = "days since 1983-01-01"
time at calendar = "standard"
;print(lon)
printVarSummary(time)
printVarSummary(lat)
printVarSummary(lon)
printVarSummary(precip)
;exit
;---------------------------------------------------------------------------
pre = onedtond(precip,(/mtime,mlat,mlon/))
delete ([/x,y,z/])
printVarSummary(pre)
exit
;------------------------------------------------------------------------
; Assign named dimension
;----------------------------------------------------------------------
lat!0 = "lat"
lon!0 = "lon"
time!0 = "time"
pre!0 = "time"
pre!1 = "lat"
pre!2 = "lon"
;-----------------------------------------------------------------------
; Assign coordinate variables
;-----------------------------------------------------------------------
pre&time = time
pre&lat = lat
pre&lon = lon
;---------------------------------------------------------------------
; write netcdf
;--------------------------------------------------------------------
system("rm -rf precip_mon.nc")
fout = addfile("precip_mon.nc","c")
fout->precip = pre
end
More information about the ncl-talk
mailing list