[ncl-talk] Problem in writing the output from netcdf file

Muhammad Omer Mughal m.mughal1 at postgrad.curtin.edu.au
Tue Aug 19 23:49:16 MDT 2014


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
u1=a[:]->vrect_x(:,:,:)
u1 at _FillValue =-99
v1=a[:]->vrect_y(:,:,:)
v1 at _FillValue =-99
??ntim    = dimsizes(time)
       end do
    mlon    = dimsizes(lon)
nlat    = dimsizes(lat)
npts  = nlat*mlon        ; total number of grid points
x=(/ntim,nlat,mlon/)
  fName = "foo.txt"
  data  = new( npts, "string")
  npt   = -1
  do nl=0,nlat-1
    do ml=0,mlon-1
       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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140820/e3fdbfee/attachment.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: foo.txt
Url: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140820/e3fdbfee/attachment.txt 


More information about the ncl-talk mailing list