[ncl-talk] Creating netCDF file from ascii file
Najib Yusuf
najibgal at yahoo.com
Fri Mar 3 07:49:45 MST 2017
Dear ncl users,
I have some ascii files from observation data (see attached please), I want to convert these file to netCDF file for easy comparison with model data. I am writing the codes but came across some errors as can be seen below, please help to put me through to correct the error and complete my script. Thank you
[model-user at model-vm~]$ ncl
Copyright (C) 1995-2015 - All Rights Reserved
University Corporation for AtmosphericResearch
NCAR Command Language Version 6.3.0
The use of this software is governed by aLicense Agreement.
See http://www.ncl.ucar.edu/ for more details.
ncl 0> time =("julian day")
ncl 1> ntim =dimsizes("time")
ncl 2> lev =("350")
ncl 3> klev =dimsizes("lev")
ncl 4> lat =("8.32")
ncl 5> nlat =dimsizes ("lat")
ncl 6> lon =("4.34")
ncl 7> nlon =dimsizes ("lon")
ncl 8> diri ="/home/model-user/"
ncl 9> fili ="Thirteen.nc"
ncl 10>system("/bin/rm -f " + diri + fili)
ncl 11> fout =addfile (diri + fili, "c")
ncl 12>setfileoption(fout,"DefineMode",True)
ncl 13> fAtt =True
ncl 14>fAtt at title = "netCDF creation"
ncl 15>fAtt at source_file = "original-file.nc"
ncl 16>fAtt at Conventions = "None"
ncl 17>fAtt at creation_date = systemfunc ("date")
ncl 18>fileattdef(fout, fAtt)
ncl 19> dimNames= (/"time", "lat", "lon", "lev"/)
ncl 20> dimSizes= (/-1, nlat, nlon, klev/)
ncl 21> dimUnlim =(/True, False, False, False/)
ncl 22> filedimdef(fout,dimNames,dimSizes,dimUnlim)
ncl 23>filevardef(fout, "time", typeof(time),getvardims(time))
fatal:["Execute.c":8573]:Execute:Error occurred at or near line 23
ncl 24>filevardef(fout,"time", typeof(time),getvardims(time))
fatal:["Execute.c":8573]:Execute:Error occurred at or near line 24
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170303/a3058cab/attachment.html
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: AOT_550_2013.txt
Url: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170303/a3058cab/attachment.txt
More information about the ncl-talk
mailing list