Opening multiple files, lats4d "stats" option
Arlindo da Silva
dasilva at ALUM.MIT.EDU
Wed Sep 26 13:10:02 EDT 2007
On 9/25/07, Jason Snyder <jmssnyder at ucdavis.edu> wrote:
>
> I am trying to open two files in GRADS with different time indices. How
> can
> I go about doing this. I want to subtract the values in one file from the
> values in the other file. I have tried opening the files with XDFOPEN but
> it does not work. I am using GRADS 1.7. Is there a more advanced GRADS
> that can allow me to do this?
You can either type or you can lie. The verbose way requires that you be
explicit about the "t" levels you are operating on:
sdfopen file1.nc
sdfopen file2.nc
display var.1(t=1) - var.2(t=1)
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's. If you use a recent version of lats4d supporting
the "-j" option you should be able to create a difference file like this:
lats4d -v -i file.nc -j file2.ddf -o diff -func '@.1- at .2'
This will create file "diff.nc" 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 "stats" for format:
lats4d -v -i file.nc -j file2.ddf -format stats -func '@.1- at .2'
This gives you a quick way to compare 2 structurally identical files. Or you
can use "stats" on a single file, e.g.,
lats4d -i model -format stats
The output is something like this:
<stats>
+
+ <> Statistics on 00Z01JAN1987 for "model"
+
+ Name Lev Min Max MEAN STDV RMS
+ --------- ---- ----------- ----------- ----------- ----------- -----------
+ ps sfc 481.9110 1049.9100 953.2780 102.9510 958.8190
+ ts sfc 230.9930 318.4930 278.5030 18.7761 279.1350
+ pr sfc 0.0000 0.00087738 3.1217e-05 5.9594e-05 6.7267e-05
Name Lev Min Max MEAN STDV RMS
--------- ---- ----------- ----------- ----------- ----------- -----------
ua 1000 -12.9719 20.0281 -0.5000 6.5431 6.5601
ua 850 -22.5107 29.7393 1.6346 8.3796 8.5361
ua 700 -19.0453 33.9547 3.8051 9.2721 10.0211
ua 500 -26.0697 50.9303 6.8472 11.9436 13.7655
ua 300 -30.2449 73.7551 12.3417 16.0525 20.2465
ua 200 -18.9862 81.0138 14.3253 16.6570 21.9678
ua 100 -19.2900 53.7100 11.3790 12.8742 17.1807
--------- ---- ----------- ----------- ----------- ----------- -----------
+ ua 7 -30.2449 81.0138 7.1190 11.9897 15.0878
[snip]
You can pipe the output through "grep '^+'" to omit the vertical level
details. This feature was added with the "-j" option.
Good Luck,
Arlindo
--
Arlindo da Silva
dasilva at alum.mit.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20070926/2156f5fb/attachment.html
More information about the gradsusr
mailing list