[gradsusr] fwrite gridding issue

Raghu Reddy raghu.reddy at noaa.gov
Thu May 10 08:49:43 EDT 2012


I am not a grads user, just responding to the FORTRAN/C issue.

 

If you do a normal sequential FORTRAN write, it writes an end-of-record
marker at the beginning *and* at the end of *every* write.  Since you
mentioned that the data is skewed, I assume you wrote all the 48,000 values
with one write statement, and that would result in one EOR marker at the
beginning and one EOR marker at the end.

 

If you don't want these EOR markers you could write the file out as direct
access files in Fortran.

 

Hope this helps.

 

Thanks,

 

--Raghu

 

 

 

From: gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org]
On Behalf Of Thomas Robinson
Sent: Wednesday, May 09, 2012 11:36 PM
To: GrADS Users Forum
Subject: [gradsusr] fwrite gridding issue

 

Aloha, 

I used fwrite to write out to a binary file in order to create a large file
with about 48000 time steps for global data (because I am crazy).  I noticed
that when I use fortran to create a new data file that has all 48000, it
doesn't match with what the original data plotted, instead it seems skewed.
No manipulations were done to the data, it was just read it all in and write
it out.  When I tried to loop the data, I further noticed that the northern
border looped around the south and then moved upwards back to the north.  It
just keeps looping around and it's odd because the top boundary of the map
isn't continuous with the bottom boundary (unlike the side boundaries which
are continuous).  Anyways, I am wondering why this happened and what I can
do to make it work out correctly.  

Here is my fwrite code.  it is the first time step, nt is the last time
step, chi is the velocity potential that was calculated using 'define chi =
fish_chi(UGRDprs,VGRDprs)' :
*# set up global domain
'set lev 200 '
'set lat -90 90'
'set lon 0 360'
*#**************************************************************
say 'write data out to binary file called CHI.200hPa'filenum'.dat'
'set fwrite -le -sq -cl CHI_200hPa_'filenum'.dat'
'set gxout fwrite'
while (it <= nt)
     'set t 'it
     'display chi'
it=it+1
endwhile
'disable fwrite'

Mahalo for your help! 
-Tom

-- 
Tom Robinson
President Graduate Student Organization 
Student Caucus Representative for the Graduate Student Organization
Graduate Student - Department of Meteorology
732-718-2323

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20120510/102451fc/attachment-0003.html 


More information about the gradsusr mailing list