These three tips solved my problem issue with the data looping in the north/south direction. Thank you all for your input!<br><br>1. remove -sq flag from 'set fwrite'<br>
2. just before fwrite, use 'set x 1 144' and 'set y 1 73' - leave your
other 'set lon' and 'set lat' lines as they are<br>
3. your ctl file should NOT have 'options sequential'<br><br><br><br><div class="gmail_quote">On Thu, May 10, 2012 at 3:22 PM, Thomas Robinson <span dir="ltr"><<a href="mailto:ter@hawaii.edu" target="_blank">ter@hawaii.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Thank you for taking time to help me. I know reading my code probably isn't the best part of your day. I have it running, so it will probably be done by Monday. I will update then.<div class="HOEnZb">
<div class="h5"><br><br><div class="gmail_quote">On Thu, May 10, 2012 at 2:20 PM, Eric Altshuler <span dir="ltr"><<a href="mailto:ela@cola.iges.org" target="_blank">ela@cola.iges.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Tom,<br>
<br>
I think I've found what's causing the problem. In your fortran code, you open unit 29 (the output from fwrite) as direct access, but the 'set fwrite' line in your grads script specifies sequential (-sq). This means that the control words in the fwrite output will be treated as data values when reading from unit 29, and the array 'chi' will not contain the correct data. To fix this, remove the -sq flag from your 'set fwrite' command.<br>
<br>
I suppose it's unnecessary to write the output file (unit 291) as 48212 individual time steps, since your machine apparently has no problem with a 144*73*48212 array. I assume your DO loop on 70 is in response to my previous suggestion. If you wish, you can remove this loop and the declaration of chi_out, and revert to your original method of writing chi (which you've commented out).<br>
<br>
In summary, your problem should go away if you do the following:<br>
<br>
1. remove -sq flag from 'set fwrite'<br>
2. just before fwrite, use 'set x 1 144' and 'set y 1 73' - leave your other 'set lon' and 'set lat' lines as they are<br>
3. your ctl file should NOT have 'options sequential'<br>
<div><br>
Eric<br>
<br>
----- Original Message -----<br>
From: "Thomas Robinson" <<a href="mailto:ter@hawaii.edu" target="_blank">ter@hawaii.edu</a>><br>
To: "GrADS Users Forum" <<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a>><br>
</div><div><div>Sent: Thursday, May 10, 2012 5:16:33 PM<br>
Subject: Re: [gradsusr] fwrite gridding issue<br>
<br>
<br>
I really appreciate all of our help. I'm just going to post all of my code now.<br>
<br>
Here is my FORTRAN code as it stands now.<br>
PROGRAM avg_chi<br>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br>
!! This FORTRAN 77 program is used to calculate the daily mean values for the!!<br>
!! entire data set. This mean value can then be used to calculate the !!<br>
!! anomalies to be plotted. First, the data are opened in their individual !!<br>
!! files. The full data set was divided into 30 files, so the parameter !!<br>
!! files=32 represents those files. The numbers are converted to string by !!<br>
!! writing their values to the string. !!<br>
<br>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br>
!!!!!!!!!!!! Tom Robinson University of Hawaii 2012 <a href="mailto:ter@hawaii.edu" target="_blank">ter@hawaii.edu</a> !!!!!!!!!!!!<br>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br>
PARAMETER (nx=144) !grid points in x<br>
PARAMETER (ny=73) !grid points in y<br>
PARAMETER (tsy=1460) !Time Steps in a Year<br>
PARAMETER (nt=709) !Number of time steps in each file<br>
PARAMETER (nrec=709) !Number of records in each file<br>
PARAMETER (files=68) !Number of input files<br>
Parameter (rearth=6378100) !radius of the earth in meters<br>
parameter (rpi=3.1415926) !pi<br>
parameter(omega=7.292E-5) !Rotational speed of the earth<br>
PARAMETER (south=-90) !Southern most latitude<br>
PARAMETER (dy=111131)!change in y between a degree of lattitude at 45 deg<br>
real chi (nx,ny,nt*files) ! Velocity potential<br>
real chi_out(nx,ny)<br>
real a_chi(nx,ny,tsy) !Average Velocity Potential<br>
real clatrad (ny) !latitude in radians<br>
real dx(iy) ! change in east-west direction (distance)<br>
Integer x !Place holder for the file number<br>
Character(2) xstring !Input file number > 9<br>
Character(1) xstrLT1 !Input file number < 10<br>
character(20) filename!Full input file name<br>
<br>
<br>
it=1 !Initialize it<br>
<br>
do 51 x=1,files!files !Loop through all of the file numbers<br>
<br>
if (x.lt.10)then !Check to see if the number is below 10. If it<br>
! is you have to use a single bit string<br>
Write( xstrLT1, '(i1)' ) x !COnvert the integer to a string<br>
write (6,*)"CHI_200hPa_",xstrLT1,'.dat'<br>
filename="CHI_200hPa_"//xstrLT1//".dat" !Concatenate strings to<br>
! get the file name<br>
write (6,*)filename<br>
!To open the file from a GrADS fwrite, you have to use direct<br>
! access and specify the record length which is four times the<br>
! dimensions<br>
open (29, file=filename,<br>
& status="OLD", access="direct",form="unformatted",<br>
& recl=4*nx*ny)<br>
do 52 irec=1,nrec !Go through each record of the input file<br>
read(29,rec=irec)((chi(ix,iy,it),<br>
& ix=1,nx),iy=1,ny)! Read in the data<br>
it=it+1 !Update it<br>
if (mod(it,100).eq.0)then<br>
write(6,*)it<br>
endif<br>
52 continue<br>
close (unit=29)<br>
elseif (x.ge.10 .AND. x.lt.100)then !If the number of the file is<br>
!GT 10, no 0 needs to be added<br>
Write( xstring, '(i2)' ) x<br>
write (6,*)"CHI_200hPa_",xstring,'.dat'<br>
filename="CHI_200hPa_"//xstring//".dat" !Concatenate strings to<br>
! get the file name<br>
open (29, file=filename,<br>
& status="OLD", access="direct",form="unformatted",<br>
& recl=4*nx*ny)<br>
do 53 irec=1,nrec<br>
itime=it*x<br>
read(29,rec=irec)((chi(ix,iy,it),<br>
& ix=1,nx),iy=1,ny)<br>
it=it+1<br>
53 continue<br>
close (unit=29)<br>
endif<br>
51 continue<br>
!! Write out some numbers to see if they make sense<br>
write (6,500)(chi(73,35,it)/1e6,it=5430,5436)<br>
500 FORMAT(f7.3,1x,f7.3,1x,f7.3,1x,f7.3,1x,f7.3,1x,f7.3,1x,f7.3,1x,)<br>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br>
!!<br>
!! Open the output data file<br>
open (unit=291,file="chi_33yr.dat", access="direct",<br>
& status="unknown",recl=4*nx*ny)<br>
!! Use chi_out to write each time step out as a record.<br>
DO 70 itt=1,files*nt<br>
do ix=1,nx<br>
do iy=1,ny<br>
chi_out(ix,iy)=chi(ix,iy,itt)<br>
enddo<br>
enddo<br>
write (291, rec=itt) chi_out !Write each time step as a record<br>
70 CONTINUE<br>
<br>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br>
!! Get the average values using the daily_ave subroutine<br>
do it=1,tsy !Loop through all 1464 6 hour times in the year (leap year)<br>
CALL daily_ave(chi,a_chi,it,nx,ny,nt,tsy)<br>
if (mod(it,100).eq.0)then<br>
write(6,*)it,a_chi(55,55,it)/1e6<br>
endif<br>
enddo<br>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br>
!! Write the data out to a file<br>
open (unit=290,file="mean_chi_33yr.dat", access="direct",<br>
& status="unknown",recl=4*nx*ny*tsy)<br>
write (290, rec=1) a_chi<br>
! open (unit=291,file="chi_33yr.dat", access="direct",<br>
! & status="unknown",recl=4*nx*ny*nt*files)<br>
! write (291, rec=1) chi<br>
<br>
stop<br>
end<br>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@<br>
I left out the subroutines because I think they are working correctly and don't have anything to do with the problem I'm having since they are used below where the data is written out.<br>
<br>
Here is the list of input files I have:<br>
CHI_200hPa_10.dat CHI_200hPa_26.dat CHI_200hPa_41.dat CHI_200hPa_57.dat<br>
CHI_200hPa_11.dat CHI_200hPa_27.dat CHI_200hPa_42.dat CHI_200hPa_58.dat<br>
CHI_200hPa_12.dat CHI_200hPa_28.dat CHI_200hPa_43.dat CHI_200hPa_59.dat<br>
CHI_200hPa_13.dat CHI_200hPa_29.dat CHI_200hPa_44.dat CHI_200hPa_5.dat<br>
CHI_200hPa_14.dat CHI_200hPa_2.dat CHI_200hPa_45.dat CHI_200hPa_60.dat<br>
CHI_200hPa_15.dat CHI_200hPa_30.dat CHI_200hPa_46.dat CHI_200hPa_61.dat<br>
CHI_200hPa_16.dat CHI_200hPa_31.dat CHI_200hPa_47.dat CHI_200hPa_62.dat<br>
CHI_200hPa_17.dat CHI_200hPa_32.dat CHI_200hPa_48.dat CHI_200hPa_63.dat<br>
CHI_200hPa_18.dat CHI_200hPa_33.dat CHI_200hPa_49.dat CHI_200hPa_64.dat<br>
CHI_200hPa_19.dat CHI_200hPa_34.dat CHI_200hPa_4.dat CHI_200hPa_65.dat<br>
CHI_200hPa_1.dat CHI_200hPa_35.dat CHI_200hPa_50.dat CHI_200hPa_66.dat<br>
CHI_200hPa_20.dat CHI_200hPa_36.dat CHI_200hPa_51.dat CHI_200hPa_67.dat<br>
CHI_200hPa_21.dat CHI_200hPa_37.dat CHI_200hPa_52.dat CHI_200hPa_68.dat<br>
CHI_200hPa_22.dat CHI_200hPa_38.dat CHI_200hPa_53.dat CHI_200hPa_6.dat<br>
CHI_200hPa_23.dat CHI_200hPa_39.dat CHI_200hPa_54.dat CHI_200hPa_7.dat<br>
CHI_200hPa_24.dat CHI_200hPa_3.dat CHI_200hPa_55.dat CHI_200hPa_8.dat<br>
CHI_200hPa_25.dat CHI_200hPa_40.dat CHI_200hPa_56.dat CHI_200hPa_9.dat<br>
<br>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@<br>
Here is my GrADS script that I use to calculate the velocity potential and then write it out using fwrite:<br>
function full_data(args)<br>
*##############################################################################<br>
*# Oh boy the fun stuff. This script opens a DODS file to get renalaysis ##<br>
*# data that goes all the way back to 1979. It looks like it updates every ##<br>
*# day (e'ryday e'ryday) so it should make thing interesting. The begin time##<br>
*# is 00Z01JAN1979 and the time step is 360mn (6 hours). That's going to ##<br>
*# complicate things. I suggest cutting it off at 18Z31DEC2011, that makes ##<br>
*# the final time 48212. This is divisible by 68, 48212/68=709. We should ##<br>
*# be able to do that many calculations (hopefully). We can! ##<br>
*# ##<br>
*# I took out the top 7 layers because the 200mb level is level 10. This ##<br>
*# will make it run a little more efficient in theory. What I should do is ##<br>
*# have it just do level 10. That would probably cut the time down a lot but##<br>
*# I am a masocist. ##<br>
<br>
*# This takes FOR-EV-ER! ##<br>
*##############################################################################<br>
*########### Tom Robinson University of Hawaii 2012 <a href="mailto:ter@hawaii.edu" target="_blank">ter@hawaii.edu</a> ############<br>
*##############################################################################<br>
*# Number of times divided - SHOULD BE 68 !!!<br>
divnum=subwrd(args,1)<br>
*# Number of file<br>
filenum=subwrd(args,2)<br>
say divnum ' ' filenum<br>
*# Reinitialize everything, including the gxout<br>
'reinit'<br>
'set gxout contour'<br>
'set looping off'<br>
*# Open the internet file<br>
'sdfopen <a href="http://nomad2.ncep.noaa.gov:9090/dods/reanalyses/reanalysis-2/6hr/pgb/pgb" target="_blank">http://nomad2.ncep.noaa.gov:9090/dods/reanalyses/reanalysis-2/6hr/pgb/pgb</a> '<br>
*#*****************************************************************************<br>
*# SET UP GLOBAL VARIABLES AND MAP **<br>
*#*****************************************************************************<br>
*# get nt from the descriptor file<br>
'q ctlinfo'<br>
*tdef=sublin(result,9)<br>
*nt=subwrd(tdef,2)<br>
nt=48212<br>
say nt<br>
*# make sure looping is off. Who knows why it comes on sometimes :-(<br>
'set looping off'<br>
*# Set up the dimensions of the data. Values starting with n indicate the<br>
*# number of data for the dimension that follows (x,y,z,t)<br>
*dx=2.5<br>
*dy=2.5<br>
*#<br>
nx=144<br>
ny=73<br>
nz=10<br>
nt=nt<br>
it=(((filenum-1)*nt)/divnum)+1<br>
nt=filenum*nt/divnum<br>
<br>
*# Set background to white<br>
'set background 1'<br>
*# Clear to get the white background<br>
'clear'<br>
'set grads off'<br>
'set mpdset hires'<br>
'set string 0'<br>
*#* Set the map to black<br>
'set map 0'<br>
*#* Set the labels and title to black<br>
'set annot 0'<br>
*#radius on the earth in m<br>
'define Re=6378100'<br>
*# pi<br>
'define pi=3.14159265'<br>
*# ytom is the conversion of 1 degree to meters at 30N<br>
'define ytom=110852.4248'<br>
*# SET UP FOR ALL LEVELS AND TIMES **<br>
*# set to full domain to define variables<br>
'set t ' it ' ' nt<br>
say 'set t ' it ' ' nt<br>
<br>
'set lon 0 360'<br>
'set lat -90 90'<br>
*######## Z is set up for 200mb ONLY!<br>
'set lev 200'<br>
*#*****************************************************************************<br>
*# CALCULATE VELOCITY POTENTIAL (chi) **<br>
*#*****************************************************************************<br>
*#** VELOCITY POTENTIAL FOR OPENGRADS ONLY ****<br>
*# Calculate the velocity potential using the opengrads function fish_chi<br>
'define chi = fish_chi(UGRDprs,VGRDprs)'<br>
*******************************************************************************<br>
** DISPLAY CHI AND DIV **<br>
*#*****************************************************************************<br>
*# Set up colors 16-20 are green, 21-25 are blue<br>
gnum = 16<br>
bnum = 21<br>
count = 1<br>
cnum = 25<br>
while (count<=5)<br>
*# Put the rgb colors in using gnum as gree and bnum as blue<br>
'set rgb 'gnum' 0 ' cnum ' 0'<br>
'set rgb 'bnum' 0 0 ' cnum<br>
*# Increment the counter and color numbers<br>
count=count+1<br>
gnum=gnum+1<br>
bnum=bnum+1<br>
*# Increase the rgb number by 55<br>
cnum=cnum+55<br>
endwhile<br>
'set gxout shaded'<br>
*# Set up the levels and colors using blue for negative and green for positive<br>
'set clevs -20 -15 -10 -5 0 5 10 15 20'<br>
'set ccols 22 23 24 25 1 1 20 19 18 17 '<br>
*# Change to a tropical latitude domain for display purposes<br>
'set lat -30 30'<br>
'set lon 0 360'<br>
'set t 'it<br>
'set lev 200 200'<br>
*# Display the velocity potential and divide by a million<br>
'd (chi/1e6)'<br>
*# Display the color bar<br>
'cbarn_black'<br>
*# Draw the title with the date<br>
'q time'<br>
date=subwrd(result,3)<br>
'q dim'<br>
rec=sublin(result,4)<br>
level=subwrd(rec,6)<br>
'draw title 'level'hPa Velocity Potential 'date<br>
** get the month<br>
month=substr(date,6,3)<br>
** get the year<br>
year=substr(date,9,4)<br>
** get the day<br>
day=substr(date,4,2)<br>
** get the hour<br>
hour=substr(date,1,3)<br>
say month ' ' year<br>
'printim 'year''month''day''hour'_'level'hPa.jpg'<br>
'printim 'year'_'filenum'.jpg'<br>
*#*****************************************************************************<br>
*# WRITE VOLOCITY POTENTIAL OUT TO A BINARY FILE **<br>
*#*****************************************************************************<br>
*# set up global domain once again<br>
'set looping off'<br>
'set lev 200 '<br>
'set lat -90 90'<br>
'set lon 0 360'<br>
*#**************************************************************<br>
say 'write data out to binary file called CHI.200hPa'filenum'.dat'<br>
'set fwrite -le -sq -cl CHI_200hPa_'filenum'.dat'<br>
'set gxout fwrite'<br>
while (it <= nt)<br>
'set t 'it<br>
'display chi'<br>
it=it+1<br>
endwhile<br>
'disable fwrite'<br>
*******************************************************************************<br>
*set fwrite <-be or -le> <-sq or -st> <-ap or -cl> fname<br>
*Sets the filename for data output as well as byte ordering and data format.<br>
<br>
* fname output filename (default = grads.fwrite)<br>
* -be output data byte ordering is big endian<br>
* -le output data byte ordering is little endian<br>
* -sq output data format is sequential<br>
* -st output data format is stream (default)<br>
* -ap output data is appended to existing file<br>
* -cl output data replaces existing file if it exists (default)<br>
*******************************************************************************<br>
'set looping off'<br>
** Looping should be turned off<br>
'set gxout contour'<br>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@<br>
<br>
<br>
On Thu, May 10, 2012 at 10:56 AM, Eric Altshuler < <a href="mailto:ela@cola.iges.org" target="_blank">ela@cola.iges.org</a> > wrote:<br>
<br>
<br>
Tom,<br>
<br>
There are three things I'll point out here:<br>
<br>
1. You seem to be trying to write out all the data at once, in a huge array dimensioned (144,73,48212). This array may require more memory than your computer has. Instead, try declaring your array as (144,73) and set up a DO loop in your fortran program to write out each time step individually. You'll need to substantially modify how your program reads the input data, too. If you send your complete fortran code, I might be able to modify it to implement my suggested method (no guarantees, though). This will eliminate the need to break up the 48212 time steps into 68*709.<br>
<br>
2. What is the size of the input files to your fortran program (i.e. the files written by fwrite)? This information will indicate if you have a wraparound problem.<br>
<br>
3. Your ctl file has the line:<br>
<br>
<br>
chi 0 x,y,t 1 ** velocity potential<br>
<br>
Since your data is binary, I think this line should be:<br>
<br>
chi 0 99 ** velocity potential<br>
<br>
<br>
Eric<br>
<br>
----- Original Message -----<br>
From: "Thomas Robinson" < <a href="mailto:ter@hawaii.edu" target="_blank">ter@hawaii.edu</a> ><br>
To: "GrADS Users Forum" < <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a> ><br>
<br>
Sent: Thursday, May 10, 2012 2:03:09 PM<br>
Subject: Re: [gradsusr] fwrite gridding issue<br>
<br>
<br>
<br>
<br>
The file is the correct size. 144*73*48212*4= <a href="tel:2027218176" value="+12027218176" target="_blank">2027218176</a><br>
<br>
-rw-r--r-- 1 ter businger <a href="tel:2027218176" value="+12027218176" target="_blank">2027218176</a> May 9 15:57 chi_33yr.dat<br>
<br>
My computer crashes if I try to do all 48212, so I had to break it up in 68 separate files each with 709 time steps. So:<br>
PARAMETER (nt=709) !Number of time steps in each file<br>
PARAMETER (nrec=709) !Number of records in each file<br>
PARAMETER (files=68) !Number of input files<br>
The FORTRAN program reads in all of the files and stores the data in one variable chi, then it goes written out to the file chi_33yr.dat.<br>
<br>
My FORTRAN program also calculates a 33 year 6-hourly mean, but the variable chi isn't affected by that and that is written to a separate file which is also having the same problem.<br>
<br>
-Tom<br>
<br>
<br>
<br>
On Thu, May 10, 2012 at 7:51 AM, Jennifer Adams < <a href="mailto:jma@cola.iges.org" target="_blank">jma@cola.iges.org</a> > wrote:<br>
<br>
<br>
<br>
I'm no fortran expert, but I think "direct" means the 4-byte headers and footers for each record are not written, so you should remove 'options sequential'. According to your descriptor, your data file (chi_33yr.dat) should be 144*73*48212*4 bytes large. Is it? What is 'files'?<br>
--Jennifer<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
On May 10, 2012, at 1:44 PM, Thomas Robinson wrote:<br>
<br>
<br>
Here is my code that opens and writes out the data:<br>
<br>
open (unit=291,file="chi_33yr.dat", access="direct",<br>
& status="unknown",recl=4*nx*ny*nt*files)<br>
write (291, rec=1) chi<br>
<br>
The variable chi has dimensions nx,ny,nt*files .<br>
<br>
I added options sequential to the descriptor file and the same thing is happening. Here is my descriptor file:<br>
<br>
dset ^chi_33yr.dat<br>
title Velocity Potential<br>
options sequential<br>
undef 9.999e+20<br>
xdef 144 linear 0 2.5<br>
ydef 73 linear -90 2.5<br>
zdef 1 levels 200<br>
tdef 48212 linear 00Z01JAN1979 360mn<br>
vars 1<br>
chi 0 x,y,t 1 ** velocity potential<br>
endvars<br>
<br>
All of your input is very much appreciated.<br>
<br>
-Tom<br>
<br>
<br>
<br>
On Fri, May 11, 2012 at 3:16 AM, Jennifer Adams < <a href="mailto:jma@cola.iges.org" target="_blank">jma@cola.iges.org</a> > wrote:<br>
<br>
<br>
<br>
Tom, Did you include 'options sequential' in your descriptor file for your new binary file? --Jennifer<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
On May 10, 2012, at 8:49 AM, Raghu Reddy wrote:<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
I am not a grads user, just responding to the FORTRAN/C issue.<br>
<br>
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.<br>
<br>
<br>
<br>
If you don’t want these EOR markers you could write the file out as direct access files in Fortran.<br>
<br>
Hope this helps.<br>
<br>
Thanks,<br>
<br>
--Raghu<br>
<br>
<br>
<br>
From: <a href="mailto:gradsusr-bounces@gradsusr.org" target="_blank">gradsusr-bounces@gradsusr.org</a> [mailto: <a href="mailto:gradsusr-bounces@gradsusr.org" target="_blank">gradsusr-bounces@gradsusr.org</a> ] On Behalf Of Thomas Robinson<br>
Sent: Wednesday, May 09, 2012 11:36 PM<br>
To: GrADS Users Forum<br>
Subject: [gradsusr] fwrite gridding issue<br>
<br>
<br>
Aloha,<br>
<br>
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.<br>
<br>
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)' :<br>
*# set up global domain<br>
'set lev 200 '<br>
'set lat -90 90'<br>
'set lon 0 360'<br>
*#**************************************************************<br>
say 'write data out to binary file called CHI.200hPa'filenum'.dat'<br>
'set fwrite -le -sq -cl CHI_200hPa_'filenum'.dat'<br>
'set gxout fwrite'<br>
while (it <= nt)<br>
'set t 'it<br>
'display chi'<br>
it=it+1<br>
endwhile<br>
'disable fwrite'<br>
<br>
Mahalo for your help!<br>
-Tom<br>
<br>
--<br>
Tom Robinson<br>
President Graduate Student Organization<br>
Student Caucus Representative for the Graduate Student Organization<br>
Graduate Student - Department of Meteorology<br>
<a href="tel:732-718-2323" value="+17327182323" target="_blank">732-718-2323</a> _______________________________________________<br>
<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
<br>
<br>
--<br>
Jennifer M. Adams<br>
IGES/COLA<br>
<br>
4041 Powder Mill Road, Suite 302<br>
Calverton, MD 20705<br>
<a href="mailto:jma@cola.iges.org" target="_blank">jma@cola.iges.org</a><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
<br>
<br>
<br>
--<br>
Tom Robinson<br>
President Graduate Student Organization<br>
Student Caucus Representative for the Graduate Student Organization<br>
Graduate Student - Department of Meteorology<br>
<a href="tel:732-718-2323" value="+17327182323" target="_blank">732-718-2323</a><br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
<br>
<br>
--<br>
Jennifer M. Adams<br>
IGES/COLA<br>
4041 Powder Mill Road, Suite 302<br>
Calverton, MD 20705<br>
<a href="mailto:jma@cola.iges.org" target="_blank">jma@cola.iges.org</a><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
<br>
<br>
<br>
--<br>
Tom Robinson<br>
President Graduate Student Organization<br>
Student Caucus Representative for the Graduate Student Organization<br>
Graduate Student - Department of Meteorology<br>
<a href="tel:732-718-2323" value="+17327182323" target="_blank">732-718-2323</a><br>
<br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
<br>
<br>
--<br>
Tom Robinson<br>
President Graduate Student Organization<br>
Student Caucus Representative for the Graduate Student Organization<br>
Graduate Student - Department of Meteorology<br>
<a href="tel:732-718-2323" value="+17327182323" target="_blank">732-718-2323</a><br>
<br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Tom Robinson<br>President Graduate Student Organization <br>Student Caucus Representative for the Graduate Student Organization<br>Graduate Student - Department of Meteorology<br>
<a href="tel:732-718-2323" value="+17327182323" target="_blank">732-718-2323</a><br><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Tom Robinson<br>President Graduate Student Organization <br>Student Caucus Representative for the Graduate Student Organization<br>Graduate Student - Department of Meteorology<br>
732-718-2323<br><br>