On 9/25/07, <b class="gmail_sendername">Jason Snyder</b> &lt;<a href="mailto:jmssnyder@ucdavis.edu">jmssnyder@ucdavis.edu</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I am trying to open two files in GRADS with different time indices.&nbsp;&nbsp;How can<br>I go about doing this.&nbsp;&nbsp;I want to subtract the values in one file from the<br>values in the other file.&nbsp;&nbsp;I have tried opening the files with XDFOPEN but
<br>it does not work.&nbsp;&nbsp;I am using GRADS 1.7.&nbsp;&nbsp;Is there a more advanced GRADS<br>that can allow me to do this?</blockquote><div><br>You can either type or you can lie. The verbose way requires that you be explicit about the &quot;t&quot; levels you are operating on:
<br><br>sdfopen <a href="http://file1.nc">file1.nc</a><br>sdfopen <a href="http://file2.nc">file2.nc</a><br>display var.1(t=1) - var.2(t=1)<br><br>Or you can lie to GrADS: just create a file2.ddf where you specify the TDEF keyword to force the same time axis as file 1; see the xdfopen documentation for info on creating DDF&#39;s. If you use a recent version of lats4d supporting the &quot;-j&quot; option you should be able to create a difference file like this:
<br><br>lats4d -v -i <a href="http://file.nc">file.nc</a> -j file2.ddf -o diff -func &#39;@.1-@.2&#39;<br><br>This will create file &quot;<a href="http://diff.nc">diff.nc</a>&quot; with the difference of the two. BTW, if you want to have a simple summary of the difference between the 2 files (min/max/ave) just use &quot;stats&quot; for format:
<br><br>lats4d -v -i <a href="http://file.nc">file.nc</a> -j file2.ddf -format stats -func &#39;@.1-@.2&#39;<br>
<br>This gives you a quick way to compare 2 structurally identical files. Or you can use &quot;stats&quot; on a single file, e.g.,<br><br>lats4d -i model -format stats<br><br>The output is something like this:<br><br>&lt;stats&gt;
<br>+<br>+ &lt;&gt; Statistics on 00Z01JAN1987 for &quot;model&quot;<br>+ <br>+&nbsp;&nbsp;&nbsp; Name&nbsp;&nbsp;&nbsp; Lev&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Min&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Max&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MEAN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STDV&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RMS<br>+ --------- ---- ----------- ----------- ----------- ----------- -----------
<br>+ ps&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sfc&nbsp;&nbsp;&nbsp; 481.9110&nbsp;&nbsp; 1049.9100&nbsp;&nbsp;&nbsp; 953.2780&nbsp;&nbsp;&nbsp; 102.9510&nbsp;&nbsp;&nbsp; 958.8190<br>+ ts&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sfc&nbsp;&nbsp;&nbsp; 230.9930&nbsp;&nbsp;&nbsp; 318.4930&nbsp;&nbsp;&nbsp; 278.5030&nbsp;&nbsp;&nbsp;&nbsp; 18.7761&nbsp;&nbsp;&nbsp; 279.1350<br>+ pr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sfc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.0000&nbsp; 0.00087738&nbsp; 3.1217e-05&nbsp; 5.9594e-05
&nbsp; 6.7267e-05<br>&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp; Name&nbsp;&nbsp;&nbsp; Lev&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Min&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Max&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MEAN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STDV&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RMS<br>&nbsp; --------- ---- ----------- ----------- ----------- ----------- -----------<br>&nbsp; ua&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1000&nbsp;&nbsp;&nbsp; -12.9719&nbsp;&nbsp;&nbsp;&nbsp; 20.0281
&nbsp;&nbsp;&nbsp;&nbsp; -0.5000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6.5431&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6.5601<br>&nbsp; ua&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 850&nbsp;&nbsp;&nbsp; -22.5107&nbsp;&nbsp;&nbsp;&nbsp; 29.7393&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.6346&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8.3796&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8.5361<br>&nbsp; ua&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 700&nbsp;&nbsp;&nbsp; -19.0453&nbsp;&nbsp;&nbsp;&nbsp; 33.9547&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.8051&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 9.2721&nbsp;&nbsp;&nbsp;&nbsp; 10.0211<br>&nbsp; ua&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 500&nbsp;&nbsp;&nbsp; -
26.0697&nbsp;&nbsp;&nbsp;&nbsp; 50.9303&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6.8472&nbsp;&nbsp;&nbsp;&nbsp; 11.9436&nbsp;&nbsp;&nbsp;&nbsp; 13.7655<br>&nbsp; ua&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 300&nbsp;&nbsp;&nbsp; -30.2449&nbsp;&nbsp;&nbsp;&nbsp; 73.7551&nbsp;&nbsp;&nbsp;&nbsp; 12.3417&nbsp;&nbsp;&nbsp;&nbsp; 16.0525&nbsp;&nbsp;&nbsp;&nbsp; 20.2465<br>&nbsp; ua&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 200&nbsp;&nbsp;&nbsp; -18.9862&nbsp;&nbsp;&nbsp;&nbsp; 81.0138&nbsp;&nbsp;&nbsp;&nbsp; 14.3253&nbsp;&nbsp;&nbsp;&nbsp; 16.6570&nbsp;&nbsp;&nbsp;&nbsp; 21.9678<br>&nbsp; ua&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 100&nbsp;&nbsp;&nbsp; -
19.2900&nbsp;&nbsp;&nbsp;&nbsp; 53.7100&nbsp;&nbsp;&nbsp;&nbsp; 11.3790&nbsp;&nbsp;&nbsp;&nbsp; 12.8742&nbsp;&nbsp;&nbsp;&nbsp; 17.1807<br>&nbsp; --------- ---- ----------- ----------- ----------- ----------- -----------<br>+ ua&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp; -30.2449&nbsp;&nbsp;&nbsp;&nbsp; 81.0138&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7.1190&nbsp;&nbsp;&nbsp;&nbsp; 11.9897&nbsp;&nbsp;&nbsp;&nbsp; 15.0878<br><br>
[snip]<br><br>You can pipe the output through &quot;grep &#39;^+&#39;&quot; to omit the vertical level details. This feature was added with the &quot;-j&quot; option. <br><br>&nbsp; Good Luck,<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Arlindo<br><br><br>
</div></div><br><br clear="all"><br>-- <br>Arlindo da Silva<br><a href="mailto:dasilva@alum.mit.edu">dasilva@alum.mit.edu</a>