[gradsusr] Differencing values from two files in GrADS

Andrew Friedman andfried at berkeley.edu
Wed Sep 18 19:17:01 EDT 2013


Hi Phil,

First, I would set x and y before defining the variable uave (I don't know if this is directly related to your issue, but it tends to make things simpler).

For the differencing, check out the command 'modify' in the documentation. I think you can set the long-term mean as wildcard variable which would allow you to subtract it from the time series.

Andrew

On Sep 18, 2013, at 3:57 PM, Phil Klotzbach <philk at atmos.colostate.edu> wrote:

> 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
> ----------------------------------------------------
> 
> <2013uwind.jpg><zonalwindclimatology.jpg>_______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr





More information about the gradsusr mailing list