netCDF write not working

From: Nicole Schiffer <nschiff2_at_nyahnyahspammersnyahnyah>
Date: Tue Aug 23 2011 - 15:53:16 MDT

Hi all-

When I try to write data to a netCDF file, the file is created but the
variable is empty. The variable in the program contains the correct
data, so it seems to be something with the file format or writing.
Here's a snip of the code. Thanks for your help.


; assign metadata to output vars
do x=1,w
   wetsurge(x-1) = x
end do
do x=1,d
   drysurge(x-1) = x
end do
wetrh!0 = "surge"
wetrh!1 = "hour"
wetrh&surge = surge
wetrh&hour = hour
dryrh!0 = "surge"
dryrh!1 = "hour"
dryrh&surge = surge
dryrh&hour = hour

; output wetsurgedates.txt and drysurgedates.txt
print("Writing output files...")

; list variables and data files for output
datavars = (/"wetrh","dryrh","wettmp","drytmp","wetdpt","drydpt"/)
datafiles =
surgedim =
surgedimsize = (/w,d,w,d,w,d/)
; remove old data files so new ones can be created
do x=0,5
   system("rm "+datafiles(x))
end do
; create new data files
outfile = addfiles(datafiles,"c")
; define variables and dimensions
do x=0,5
   ; put files into define mode
   ;define variables and dimensions of file vars
   ; take files out of define mode
end do
; write rh, dpt, tmp to files
outfile[0]->wetrh = (/wetrh(0:w-1,:)/)
outfile[2]->wettmp = (/wettmp(0:w-1,:)/)
outfile[4]->wetdpt = (/wetdpt(0:w-1,:)/)
outfile[1]->dryrh = (/dryrh(0:d-1,:)/)
outfile[3]->drytmp = (/drytmp(0:d-1,:)/)
outfile[5]->drydpt = (/drydpt(0:d-1,:)/)

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Tue Aug 23 15:53:25 2011

This archive was generated by hypermail 2.1.8 : Thu Aug 25 2011 - 09:54:48 MDT