<HTML>
<HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="OPENWEBMAIL" name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>
Dear Bernd,
<br />
<br />I would use the fwrite command:
<br />
<br />For each computation, you can fwrite the new defined fields in a single binary file, if they have the same horizontal dimensions. With an appropriate ctl that describe correctly the new binary file as the defined fields were at the same time, you can do calculations.
<br />
<br />Ricardo
<br />
<br /><font size="2"><b>On Sat, 10 Sep 2011 09:30:06 +0100, Becker, Bernd wrote</b>
<br />> <span class="116280308-10092011"><font size="2" face="Arial" color="#0000ff">Thanks
Arlindo,</font></span>
<br />> <span class="116280308-10092011"></span>
<br />> <span class="116280308-10092011"><font size="2" face="Arial" color="#0000ff">That would be nice for single
numbers.</font></span>
<br />> <span class="116280308-10092011"></span>
<br />> <span class="116280308-10092011"><font size="2" face="Arial" color="#0000ff">It as one notch more
elaborate:</font></span>
<br />> <span class="116280308-10092011"></span>
<br />> <span class="116280308-10092011"><font size="2" face="Arial" color="#0000ff"> 'set dfile 2'
<br />> 'set t 2 33'
<br />>
'define obs = 'var'.2'
<br />>
</font></span>
<br />> <span class="116280308-10092011"><font size="2" face="Arial" color="#0000ff"> 'set dfile 3'
<br />> 'set t 2 33'
<br />>
'define fx = 'var'.3'
<br />>
</font></span>
<br />> <font size="2" face="Arial" color="#0000ff"><span class="116280308-10092011">file 2
and 3 have different time
frames.</span></font>
<br />> <font size="2" face="Arial" color="#0000ff"><span class="116280308-10092011"></span></font>
<br />> <font size="2" face="Arial" color="#0000ff"><span class="116280308-10092011">d
fx-obs
</span></font>
<br />> <font size="2" face="Arial" color="#0000ff"><span class="116280308-10092011"></span></font>
<br />> <font size="2" face="Arial" color="#0000ff"><span class="116280308-10092011">fails.
</span></font>
<br />> <font size="2" face="Arial" color="#0000ff"><span class="116280308-10092011">And it
would be a real bummer to have to calculate the times from one file
relative</span></font>
<br />> <font size="2" face="Arial" color="#0000ff"><span class="116280308-10092011">to
the
other
file.</span></font>
<br />> <font size="2" face="Arial" color="#0000ff"><span class="116280308-10092011"></span></font>
<br />> <font size="2" face="Arial" color="#0000ff"><span class="116280308-10092011">Compositing in this way would be really hard.
</span></font>
<br />> <font size="2" face="Arial" color="#0000ff"><span class="116280308-10092011"></span></font>
<br />> <font size="2" face="Arial" color="#0000ff"><span class="116280308-10092011">Enjoy
the weekend!
<br />>
Bernd.</span></font>
<br />> <font size="2" face="Arial" color="#0000ff"><span class="116280308-10092011"></span></font>
<br />> <font size="2">--
<br />> Bernd Becker Climate Impacts
Product
Development
<br />> Met Office Hadley Centre FitzRoy Road
Exeter Devon EX1 3PB United Kingdom
<br />> Tel.: +44 (0) 1392
884511 Fax: +44 (0)870 900 5050
<br />> E-mail:bernd.becker@metoffice.gov.uk -
<a href="http://www.metoffice.gov.uk/research/our-scientists/seasonal-to-decadal/bernd-becker">http://www.metoffice.gov.uk/research/our-scientists/seasonal-to-decadal/bernd-becker</a>
<br />>
<a href="http://www.metoffice.gov.uk/news/releases/archive/2011/weather-game">http://www.metoffice.gov.uk/news/releases/archive/2011/weather-game</a>
<br />>
</font>
<br />>
<br />>
<br />>
<hr tabindex="-1" />
<font size="2" face="Tahoma"><b>From:</b> gradsusr-bounces@gradsusr.org
[mailto:gradsusr-bounces@gradsusr.org] <b>On Behalf Of </b>Arlindo da
Silva
<br />> <b>Sent:</b> 09 September 2011 17:40
<br />> <b>To:</b> GrADS
Users
Forum
<br />> <b>Subject:</b> Re: [gradsusr] define variable independent of
time
<br />> </font>
<br />>
<br />> On Fri, Sep 9, 2011 at 12:05 PM, Becker,
Bernd <span dir="ltr"><<a href="mailto:bernd.becker@metoffice.gov.uk">bernd.becker@metoffice.gov.uk</a>></span>
wrote:
<br />>
<br />>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<br />> Simple question,
<br />> complicated answer:
<br />>
<br />> I would
like to composite stuff from several files.
<br />>
<br />> Each file
has its own
time and date info in its own .ctl file.
<br />>
<br />> How can I add
elements from
different such files?
<br />>
<br />> How can I break away from the strict
treatment of
the time dimension in
<br />> grads?
<br />>
<br />> open file1.ctl
<br />>
define
a=ave(b,t=1,t=34)
<br />> close 1
<br />> open file2.ctl
<br />> define c=
ave(b,t=3,t=9)
<br />> close 2
<br />> etc.
<br />>
<br />> d a+c
<br />>
Cannot contour grid - all
undefined values
<br />>
<br />>
</blockquote>
<br />>
<br />>
Try:
<br />>
<br />> d
a(t=1)+c(t=1)
<br />>
<br />> --
<br />> Arlindo da Silva
<br />> <a href="mailto:dasilva@alum.mit.edu">dasilva@alum.mit.edu</a>
<br />
<br />
</font>
</BODY>
</HTML>