creating contour plots with .txt data

bhatt vihang vihang_75 at YAHOO.COM
Fri Oct 7 00:29:49 EDT 2005


hi
if your data is in format as follows
lat lon data
then you can try following program

program main
integer, parameter :: ngx,ngy
real(4), dimension(ngx,ngy) :: data
open(1,file=filein)
open(2,file=fileout,access='direct',recl=ngx*ngy*4)

do j=1,ngy
   do i=1,ngx
      read(1,*)lat,lon,data(i,j)
   enddo
enddo

irec=1

write(2,rec=irec)((data(i,j),i=1,ngx),j=1,ngy)
end program main

this program is in f90 format.

you need to specify perticularly filein and fileout
i/o file names,ngx,ngy dimension of the arrays.

then you need to write a ctl file to open this data in
grads.

like xx.ctl

dset fileout
undef -999.0
xdef ngx linear xmin xinc
ydef ngy linear ymin yinc
zdef ngz linear zmin zinc
tdef tgz linear tmin tinc
vars 1
name_of_var 0 99 'what is the variable'
endvars

it should be noted that
xmin,ymin,zmin,xinc,yinc,zinc,tgz, tmin and tinc are
numerical values.

you are also requested you go through grads mannual
for some detailed examples.

hope you will find it.

regards



--- Mark Schuster <m_schus at YORKU.CA> wrote:

> Hi
>
> I was wondering if anybody knows if I could use
> grads to make a contour
> plot of variables that i have in a regular text
> file.  A have average
> moisture flux values for specific lat/lon squares
> and would like to create
> a contour plot of these. I have tried doing this
> with Excel, but Excel
> creates the stupidest looking plot, and my values
> are averages over a
> 2.5x2.5 degree square, and Excel is interpreting
> them as being point
> values.  Or is grads only able to make plots with
> data from .nc etc files?
>
> Can anyone suggest anything?
>
> Thanks a lot
>
> Mark
>


Vihang Bhatt
Project Scientist
Indian Institute of Technology-Delhi
Hauz Khas
New Delhi
web: http://www.geocities.com/vihang_75/index.html



__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com



More information about the gradsusr mailing list