[ncl-talk] dimension changed in ncl definition different ctl file's description

dyjbean soybean dyjbean at gmail.com
Fri Mar 13 04:02:14 MDT 2015


hi, i met a strange problem between grads and ncl.

the below is the ctl file for the data,
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

dset E:\lnw\postvar2010010100
options sequential big_endian
options sequential
title post output from grapes
undef -9.99E+33
xdef  360 linear    0.0000    1.0000
ydef  180 linear  -89.5000    1.0000
zdef   29 levels
 1000.000000
 962.5000000
 925.0000000
 887.5000000
 850.0000000
 800.0000000
 750.0000000
 700.0000000
 650.0000000
 600.0000000
 550.0000000
 500.0000000
 450.0000000
 400.0000000
 350.0000000
 300.0000000
 275.0000000
 250.0000000
 225.0000000
 200.0000000
 175.0000000
 150.0000000
 125.0000000
 100.0000000
 70.00000000
 50.00000000
 30.00000000
 20.00000000
 10.00000000
tdef   21 linear 00z01JAN2010   360mn
vars 46
u 29 0 u_wind
v 29 0 v_wind
t 29 0 temperature
h 29 0 geopotential height
q2 29 0 specific humidity
q3 29 0 specific humidity
q4 29 0 specific humidity
q5 29 0 specific humidity
q6 29 0 specific humidity
q7 29 0 specific humidity
ozone 29 0 cloud fraction from microphy
w 29 0 vertical wind
ps 0 0 surface pressure
psl 0 0 sea level pressure
rainc 0 0 precipitation
rainnc 0 0 precipitation
ts 0 0 surface temperature
glw 0 0 surface downward lw
gsw 0 0 surface net sw
glwu 0 0 surface upward lw
tglwu 0 0 toa upward lw
gclw 0 0 surface clear sky downward lw
gclwu 0 0 surface clear sky upward lw
tgclwu 0 0 toa clear sky upward lw
gswu 0 0 surface upward sw
tgsw 0 0 toa net sw
tgswu 0 0 toa upward sw
gcsw 0 0 surface clear sky net sw
gcswu 0 0 surface clear sky upward sw
tgcsw 0 0 toa clear sky net sw
tgcswu 0 0 toa clear sky upward sw
tcc 0 0 total cloud cover
hcc 0 0 high cloud cover
mcc 0 0 middle cloud cover
lcc 0 0 low cloud cover
tvw 0 0 column integrated qv
tcw 0 0 column integrated qc
tiw 0 0 column integrated qi
hfx 0 0 sueface heat flux
qfx 0 0 sueface vapour flux
zs 0 0 terrain
q2m 0 0 specific humidity at 2m
t2m 0 0 temperature at 2m
u10m 0 0 u wind at 10m
v10m 0 0 v wind at 10m
pblh 0 0 pbl height
endvars

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

according to the above ctl file, we can find some variables 4D and others
1D,
so i gave the following code  in ncl for test:

++++++++++++++++++++++++++++++++++++++++
fili="postvar2010010100"
nlat=180
mlon=360
nlev=29
ntim=21

setfileoption("bin","ReadByteOrder","BigEndian")
uwind=fbinrecread(fili,0,(/mlon,nlat,nlev,ntim/),"float")

++++++++++++++++++++++++++++++++++++++++

but there come the following warning,
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
warning:fbinrecread: size specified is less than record size, some data
will not be read
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

i changed its dimension description with "-1" instead of
(/mlon,nlat,nlev,ntim/),as follows,

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
uwind1=fbinrecread(fili,0,-1,"float")
print(dimsizes(uwind1))

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

then, come to the following result,

+++++++++++++++++++++++++++++++++
 print(dimsizes(uu))
(0)     64800
+++++++++++++++++++++++++++++++++

so i use the following code to read the first variable,

++++++++++++++++++++++++++++++++++++++++++++++++++++
uwind2=fbinrecread(fili,0,(/mlon,nlat/),"float")
++++++++++++++++++++++++++++++++++++++++++++++++++++

there is no warning appeared.


the above result shows that the first variable has the dimension
"mlon*nlat" not "mlon*nlat*nlev*ntim",which is so wierd.
and i cannot distinguish which level and time the uwind2 represented.

can somebody give me some advice about this difference between ctl file's
description and ncl realization?

if i should add two cycle, like following,

++++++++++++++++++++++++++++++++++++++++++++++++++++++
do i=0,ntim-1
  do j=0,nlev-1
     uwind=fbinrecread(fili,0,(/mlon,nlat/),"float")
     vwind=fbinrecread(fili,1,(/mlon,nlat/),"float")
     ttemp=fbinrecread(fili,2,(/mlon,nlat/),"float")

     ....................
     u10m=fbinrecread(fili,43,(/mlon,nlat/),"float")
     v10m=fbinrecread(fili,44,(/mlon,nlat/),"float")
     pblh=fbinrecread(fili,45,(/mlon,nlat/),"float")
  end do
end do

+++++++++++++++++++++++++++++++++++++++++++++++++++++


any help will be appreciated,thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150313/f3c7e789/attachment.html 


More information about the ncl-talk mailing list