[gradsusr] Differencing values from two files in GrADS

Goodson,Ron [Edm] Ron.Goodson at EC.gc.ca
Wed Sep 18 19:14:56 EDT 2013


When I'm fiddling with two files with different times (or time steps),
and I get confused by var.1(t=XX) or var.2(t=YY) at least, for debugging
purposes, I will explicitly do a

set dfile 1

.. work with file 1

set dfile 2

.. work with file 2

This way I know what t = 1, N really stands for.  So, in your case I'd
probably open both file then

set dfile 2
  .. calculate uave

set dfile 1
  .. compare variables in dfile 1 to uave


ron



-----Original Message-----
From: gradsusr-bounces at gradsusr.org
[mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Phil Klotzbach
Sent: September 18, 2013 4:57 PM
To: gradsusr at gradsusr.org
Subject: [gradsusr] Differencing values from two files in GrADS

Hello,

I've made a bit of progress since yesterday, but I'm still running into
trouble.  Effectively, the problem seems that I am trying to manipulate
two files at the same time, but I'm not sure how to get around this,
given that I have values for 2013 as well as a 30-year long-term
climatology:

What I am trying to do is as follows, generate a height/time
cross-section of zonal wind anomalies from June 1 - September 15, 2013.

I have two files that each have the same lat/lon grids.  I can
manipulate each file individually (with no other files open) and
generate a figure, but what is giving me trouble is doing these
calculations when both files are open at the same time.  What I want to
do is basically difference the 2013 zonal wind from the zonal wind
climatology to get the anomaly.  To generate the attached figures (with
only one file open), here are the commands that I used:

For 2013 Zonal Wind File:

sdfopen uwnd.2013.nc
set t 152 258
set z 1 16
define uave = aave (uwnd, lon=-70, lon=-20, lat=0, lat=30) set x 1 set y
1 d uave draw ylab height draw xlab date draw title 2013 Zonal Wind
printim c:\2013uwind.jpg

For 1981-2010 Climatology

sdfopen uwnd.day.1981-2010.ltm.nc
set t 152 258
set z 1 16
define uave2 = aave (uwnd.2, lon=-70, lon=-20, lat=0, lat=30) set x 1
set y 1 d uave draw ylab height draw xlab date draw title 1981-2010
Zonal Wind Climatology printim c:\zonalwindclimatology.jpg

It seems like the problem arises when I try to do the same calculations
with both files open at the same time.  Even if I explicitly specify the
t and z dimensions for both files before making the calculations, it
appears that GrADS forgets(?) the dimensions in the file not being used
for the specific calculation. For example, if I do the calculation for
2013 first and then attempt the long-term climatology, the first
calculation will be done correctly, and it will tell me that the second
request is completely outside of file limits.  If I change the active
file and then make the calculation, the value in the first variable is
lost.

Any ideas?  Thanks so much!

Phil

--
----------------------------------------------------
Phil Klotzbach, Ph.D.
Research Scientist
Department of Atmospheric Science
Colorado State University
Email: philk at atmos.colostate.edu
----------------------------------------------------





More information about the gradsusr mailing list