[ncl-talk] A binary file contains 6 variables(3-dimensional)

김가은 gaeun.kim0921 at gmail.com
Mon Mar 13 23:41:49 MDT 2017


Hello, world!

I want to draw several plots with data which is a binary file contains 6
variables(3-dimensional) and made like below:

open(2,file=ofile,status='unknown',form='unformatted')
     write(2) (((hgtm(i,j,k),i=1,imx),j=1,jmx),k=1,lx)
     write(2) (((ugrdm(i,j,k),i=1,imx),j=1,jmx),k=1,lx)
     write(2) (((vgrdm(i,j,k),i=1,imx),j=1,jmx),k=1,lx)
     write(2) (((vvelm(i,j,k),i=1,imx),j=1,jmx),k=1,lx)
     write(2) (((tmpm(i,j,k),i=1,imx),j=1,jmx),k=1,lx)
     write(2) (((rhm(i,j,k),i=1,imx),j=1,jmx),k=1,lx)
  close(2)

And then I wrote a NCL script to read and plot them.
Here is the prob:
fatal:No coordinate variable exists for dimension (level) in variable (hgt)

My script:

  nlon = 659
  nlat = 539
  nlev = 17

  dims  = (/nlat,nlon,nlev/)
  lat      = fspan(slat,elat,nlat)
  lon      = fspan(slon,elon,nlon)
 level = (/1000.,925.,850.,700.,600.,500.,400.,300.,\
           250.,200.,150.,100.,70.,50.,30.,20.,10./)

  hgt       = fbindirread(path_prs, 0, dims, "float")
  u       = fbindirread(path_prs, 1, dims, "float")
  v       = fbindirread(path_prs, 2, dims, "float")
  vvel       = fbindirread(path_prs, 3, dims, "float")
  temp       = fbindirread(path_prs, 4, dims, "float")
  rh      = fbindirread(path_prs, 5, dims, "float")

  lon!0         = "lon"
  lon at long_name = "lon"
  lon at units     = "degrees_east"
  lon&lon       = lon

  lat!0         = "lat"
  lat at long_name = "lat"
  lat at units     = "degrees_north"
  lat&lat       = lat

  level!0                 = "level"
  level at units             = "hPa"
  level at long_name         = "isobaric_surface"
  level&level           = level

hgt!0                   = "level"
hgt!1                   = "lat"
hgt!2                   = "lon"
hgt&level               = level <--- this one makes error!
hgt&lat                 = lat
hgt&lon                 = lon
hgt&level at units         = "hPa"
hgt&lat at units           = "degrees_north"
hgt&lon at units           = "degrees_east"
hgt at units               = "gpm"
hgt at long_name           = "geopotential height"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170314/5db6e944/attachment.html 


More information about the ncl-talk mailing list