[gradsusr] Missing variables in 3-d fwrite binary file

Kevin Huyck klhuyck at meridian-enviro.com
Fri Jul 22 08:49:22 EDT 2011


Good morning.

I'm attempting to configure some post-processing subroutines for several 
parameters I find useful. For my pathfinder case, I am creating a binary 
file using "fwrite" to store four parameters. Each parameter varies in 
the horizontal plane, but not in the vertical (i.e. only one vertical 
level is computed). When I output a single timestep, I can open and 
retrieve the data file and the data display correctly. If I write each 
variable twice, once for each time step, I can retrieve the first time 
step, but not the second. At present I'm feeding commands into the 
command-line interpreter rather than executing a script. I've seen 
examples in the archives discussing varying the time dimension by way of 
a "while" loop. Since I'm entering the commands individually the result 
/should/ be the same as if run from a script.

I'm not sure where I'm making my mistake in the process, so any guidance 
would be appreciated.

Input data is the North American Mesoscale (NAM) 40 km model. I am 
computing values for "t 1" and "t 2" during this trial period.  The 
variables utilized in the process are "cpd", "isenps", "u", and "v". 
Command sequence is first, followed by the .ctl file. I use a homemade 
script file, "compute_cpd.gs", to conduct the necessary calculations. 
This script accepts three arguments, Theta surface (in Kelvin), grid 
skip, and working file number. compute_cpd.gs returns cpd, isenps, u, 
and v. In this case, "z" in NAM-2011072200.dat represents the "theta" 
level for the isentropic surface.

--- Command Listing ---
open NAM-2011072200.ctl
set t 1
run compute_cpd.gs 315 1 1

set fwrite ./cpd/NAM-2011072200.dat
set gxout fwrite

d cpd
d isenps
d u
d v

set t 2
run compute_cpd.gs 315 1 1

d cpd
d isenps
d u
d v

disable fwrite
reinit

open ./cpd/NAM-2011072200.ctl
set t 1
run ./draw-cpd.gs

clear graphics
set t 2
run ./draw-cpd.gs

--- Error Output ---
Low Level I/O Error:  Read error on data file
   Data file name = ./cpd/NAM-2011072200.dat
   Error reading 200 bytes at location 704000
Data Request Error:  Error for variable 'cpd'
   Error ocurred at column 1
DISPLAY error:  Invalid expression
   Expression = cpd
Cannot plot color bar: No shading information
Low Level I/O Error:  Read error on data file
   Data file name = ./cpd/NAM-2011072200.dat
   Error reading 200 bytes at location 704000
Data Request Error:  Error for variable 'cpd'
   Error ocurred at column 1
DISPLAY error:  Invalid expression
   Expression = cpd
Low Level I/O Error:  Read error on data file
   Data file name = ./cpd/NAM-2011072200.dat
   Error reading 200 bytes at location 880000
Data Request Error:  Error for variable 'isenps'
   Error ocurred at column 1
DISPLAY error:  Invalid expression
   Expression = isenps
Low Level I/O Error:  Read error on data file
   Data file name = ./cpd/NAM-2011072200.dat
   Error reading 200 bytes at location 1056000
Data Request Error:  Error for variable 'u'
Operation Error:  Error from skip function
   Error ocurred at column 1
DISPLAY error:  Invalid expression
   Expression = skip(u,2)

--- ./cpd/NAM-2011072200.ctl Contents ---
dset /home/Agena/klhuyck/cpd/NAM-2011072200.dat
title NAM 40km Condensation Pressure Deficit
undef -999000000.000000
options little_endian
xdef 200 linear -145.0 0.5
ydef 110 linear 12.0 0.5
zdef 1 levels 315
tdef 2 linear 00Z22Jul2011 3hr
vars 4
cpd                   2 99 Condensation Pressure Deficit (mb)
isenps                2 99 Pressure (mb)
u                     2 99 Zonal component of wind (ms^-1)
v                     2 99 Meridional component of wind (ms^-1)
endvars

-- 
Kevin L. Huyck
Forecaster, Meridian Environmental Technology, Inc.
klhuyck at meridian-enviro.com <mailto:klhuyck at meridian-enviro.com>

Composed using Mozilla Thunderbird!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110722/355430bd/attachment-0003.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: klhuyck.vcf
Type: text/x-vcard
Size: 307 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20110722/355430bd/attachment-0003.vcf 


More information about the gradsusr mailing list