[gradsusr] Differencing values from two files in GrADS
Rupak Rajbhandari
rupak.rajbhandari at gmail.com
Wed Sep 18 21:51:28 EDT 2013
Hi,
The problem arises from the fact that two files are opened at same time and
their time steps are different. Your first file starts from 1st Jan 2013.
This means time step t=1 is 2013 01 01 and goes on increasing. But your
second file starts from 1981. When your default file is 1, t=1 for second
file will not be equal to for 1981 01 01. 't' value for 1981 01 01 will be
something like
-(2013-1981)*365 (minus sign). I hope it is clear.
Either create a dummy file from 1981-2012 or separate 2013 from the
climatology file. This should solve your issue. I hope.
-rupak
Rupak Rajbhandari
Department of Meteorology
Tri-Chandra College
Kathmandu, NEPAL
On Thu, Sep 19, 2013 at 7:03 AM, Jeff Duda <jeffduda319 at gmail.com> wrote:
> There appears to be a dimension mismatch between your two files if you're
> getting that error message. Post the PDEF, XDEF, YDEF, ZDEF, and TDEF (and
> if it exists, EDEF) lines of each control file for comparison. We can help
> you with that.
>
> Jeff Duda
>
>
> On Wed, Sep 18, 2013 at 6:23 PM, Goodson,Ron [Edm] <Ron.Goodson at ec.gc.ca>wrote:
>
>>
>> slight correction ... meant to say "uave2" below. But .. I guess in
>> your case it doesn't really matter since you a not comparing the two
>> files
>>
>> (and I see you have d uave in both sections .. but assume that was a
>> typo?)
>>
>> ron
>>
>>
>>
>> -----Original Message-----
>> From: Goodson,Ron [Edm]
>> Sent: September 18, 2013 5:15 PM
>> To: 'GrADS Users Forum'
>> Subject: RE: [gradsusr] Differencing values from two files in GrADS
>>
>> 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
>> ----------------------------------------------------
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>
>
>
> --
> Jeff Duda
> Graduate research assistant
> University of Oklahoma School of Meteorology
> Center for Analysis and Prediction of Storms
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130919/74b99c2b/attachment-0003.html
More information about the gradsusr
mailing list