14 filename = fdbdir +
"/" + \
15 attributes[
"expver"] +
"." + \
16 attributes[
"type"] +
"." + \
17 attributes[
"referencedate"]
19 if attributes[
"type"]==
"fc": filename +=
"." + attributes[
"step"]
21 print 'reading from file ' + filename
22 infile = open(filename,
"r") 24 [nx, ny, nl, nf, ns] = [int(i) for i
in infile.readline().split()]
25 print "grid dimensions are: nx=",nx,
" ny=",ny
27 validity_date = infile.readline()
28 print "validity date is: ",validity_date
30 psi = np.fromfile(file=infile,dtype=
"float64", \
31 count=(2*ny*nx),sep=
" ").reshape((2,ny,nx))
32 print "max(psi)=",np.amax(psi),
" min(psi)=",np.amin(psi)
34 pv = np.fromfile(file=infile,dtype=
"float64", \
35 count=(2*ny*nx),sep=
" ").reshape((2,ny,nx))
36 print "max(pv)=",np.amax(pv),
" min(pv)=",np.amin(pv)
38 u = np.fromfile(file=infile,dtype=
"float64",\
39 count=(2*ny*nx),sep=
" ").reshape((2,ny,nx))
40 print "max(u)=",np.amax(u),
" min(u)=",np.amin(u)
42 v = np.fromfile(file=infile,dtype=
"float64", \
43 count=(2*ny*nx),sep=
" ").reshape((2,ny,nx))
44 print "max(v)=",np.amax(v),
" min(v)=",np.amin(v)
def readFields(self, fdbdir, attributes)