[ncl-talk] FW: Problem in writing the output from netcdf file
Dennis Shea
shea at ucar.edu
Wed Aug 20 07:17:57 MDT 2014
The email text you wrote does not agree with the script you included.
[1] Please clean the script coding so it is nicely formatted. People do not
have time to unravel code.
[2] As noted frequently on ncl-talk, users should include output from
printVarSummary(...)
for selected variables. This is not just for ncl-talk to examine but
also you. Please
examine the output.
[3] The email text states "The netcdf files are from the instrument but are
not in the regular
netcdf format meaning that the time is not included in the dimensions
of the variables
to be extracted". This is not clear.
Yet your code has
u1 = a[:]->vrect_x ; (:,:,:)
and subsequently
data(npt) = data(npt) + sprintf("%7.1f ",u1(nt,nl,ml))
where u1 references a time dimension via subscrip 'nt' . Very
confusing.
[4] You use
x = (/ntim,nlat,mlon/)
If you were to use
printVarSummary(x)
you would see that it is a one dimensional array of tyope integer
and length 3.
Later you use
data(npt) = data(npt) + sprintf("%10.3f ", x(nt))
why x(nt)????
On Tue, Aug 19, 2014 at 11:52 PM, Muhammad Omer Mughal <
m.mughal1 at postgrad.curtin.edu.au> wrote:
>
> Hi everyone
>
> I am running NCL version 6.1.0. I have to write output
> from multiple netcdf file into the ascii fromat containing wind speed
> comparison at a particular latitude and longitude.This aim is to get the
> comparison from the wrf ouput and the instrument at a particular location.
> The netcdf files are from the instrument but are not in the regular netcdf
> format meaning that the time is not included in the dimensions of the
> variables to be extracted and each file contains one value of time.The
> first problem that I am facing is that the fill value is not getting
> deleted in the ascii output.I use the following to generated the ascii
> output .
>
> b=addfile("/20090711/20090711_000239_01_g.nc","r")
> lon=b->yp(0,0,:)
> lat=b->xp(0,:,0)
> DATADir = "./"
> fils = systemfunc (" ls -1 " + DATADir + "/20090711* ")
> numfils = dimsizes(fils)
> do j = 0,numfils-1,1
> a = addfiles(fils(j)+".nc","r")
> time=a[:]->time
> ::::::::::::::
> ::::::::::
> npt = npt + 1
> data(npt) = sprinti("%0.5i", (npt+1) )
> data(npt) = data(npt) + sprintf("%7.1f ",lat(nl))
> data(npt) = data(npt) + sprintf("%7.1f ",lon(ml))
> do nt=0,ntim-1
> data(npt) = data(npt) + sprintf("%10.3f ", x(nt))
> data(npt) = data(npt) + sprintf("%7.1f ",u1(nt,nl,ml))
> data(npt) = data(npt) + sprintf("%7.1f ",v1(nt,nl,ml))
> end do
> end do
> end do
> asciiwrite (fName , data)
> In this way I get the output that is attached .Any help to correct this
> code will be appreciated
>
>
>
>
> *Regards*
> *Muhammad Omer Mughal*
> *Department of Applied Physics*
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140820/84b4a276/attachment.html
More information about the ncl-talk
mailing list