Writing out to a file and cdiff

Thiago Veloso thi_veloso at YAHOO.COM.BR
Tue Feb 9 19:16:16 EST 2010


  Hello, Jeffrey.
  Regardind doubt #2, I have a script which saves the "display" command into a file, instead of exhibiting the contents in the monitor. Here you are:
'reinit''open /media/Dados/Academico/cmorph/data/2009/CMORPH_8km_hourly.ctl'
itime=1ftime=24while (itime <= 744)'set t 'itime'q time'data=subwrd(result,3)diaf=substr(data,4,2)mesf=substr(data,6,3)anof=substr(data,9,4)
lx=-796while (lx <= -673)ly=357while (ly <= 455)'set x 'lxlon=subwrd(result,4)'set y 'lylat=subwrd(result,4)'d sum(cmorph*0.2,t='itime',t='ftime')'rec=sublin(result,2)prec=subwrd(rec,4)prec1='%3.2f'precf=math_format(prec1,prec)
a=write('prec_'anof''mesf''diaf'.txt', lon';'lat';'precf';'diaf''mesf''anof)ly=ly+1endwhilelx=lx+1endwhileitime=itime+24ftime=ftime+24endwhilesay 'End of the process!'
  Basically there are three loops: longitude, latitude and time. And then just wrote the variables (including coordinates and time) into a ascii file. You can modify it according to your requirements.
  Best regards,
  Thiago.
--- On Tue, 9/2/10, Jeffrey Duda <jdduda at IASTATE.EDU> wrote:

From: Jeffrey Duda <jdduda at IASTATE.EDU>
Subject: Writing out to a file and cdiff
To: GRADSUSR at LIST.CINECA.IT
Date: Tuesday, 9 February, 2010, 19:55

I have two questions.

1) How do you write data out to a file in text format?  I know there is an fwrite command, but I don't really know how it works.

2) Can the cdiff command work when three environment dimensions are varying?  I'm trying to compute EPV, but to do so, I need to do a cdiff command in the x, y, and z dimensions, but I always get an error and usually Grads crashes when I do it.


Jeff Duda

-- 
Jeff Duda
Iowa State University
Meteorology Graduate Student
3134 Agronomy Hall
www.meteor.iastate.edu/~jdduda




      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20100209/1139c487/attachment.html 


More information about the gradsusr mailing list