[gradsusr] Difference two files in GrADS continued

Jeff Duda jeffduda319 at gmail.com
Thu Sep 19 13:21:02 EDT 2013


If you used sdfopen to open the files, then they don't have the same time
dimension.  The 2010 data are defined ONLY when the time dimension is in
2010, and likewise for the 2009 data.  So when you switched the default
file and changed the time values, you changed the valid time that Grads is
considering from one year to the next.  There are two ways to get around
this.

1) Write a full control file for each data set.  You can manipulate the
TDEF entry to make the control files have the exact same time dimensions
without causing the data to be invalid.  As long as you have the projection
parameters of the grid, this should not be a problem.  See #3 on this
page<http://www.iges.org/grads/gadoc/SDFdescriptorfile.html>,
a link in which should take you to this
page<http://www.iges.org/grads/gadoc/descriptorfile.html>on how to
construct a control file.

2) Use dimension alterations when displaying the variable.  For example,
suppose you have isobaric coordinates and your current dimension
environment is fixed at 1000 mb.  You want to display MSLP and 500 mb
heights.  You can do this:
'd mslp'
'set lev 500'
'd hgt'

OR you can do this
'd mslp'
'd hgt(lev=500)'

You can do this with any dimension, including time.  Say I wanted to
display MSLP at two different times.  I could do it in two commands:
(time is set to a given index)
'd mslp'
'd mslp(time=12Z01JAN2010)'

You could also do something as simple as incrementing the index.  So if
your data were 24 hours apart, then the following commands
'd mslp'
'd mslp(t+1)'

Would display MSLP at the same time on two consecutive days.

Try one of these and let me know if you still can't get it to work.

Jeff Duda


On Thu, Sep 19, 2013 at 11:45 AM, Phil Klotzbach
<philk at atmos.colostate.edu>wrote:

> Hi everyone,
>
> Thanks so much for your help!  In order to zero in on the problem
> further, I've tried to simplify the problem by opening two files with
> the exact same dimensions (latitude/longitude/time/levels) (uwnd.2009.nc
> and uwnd.2010.nc).  Basically, what I want to obtain is a height/time
> cross-section of the difference between the two years (e.g., zonal wind
> in 2010 minus zonal wind in 2009).  Let's say in this case, I've opened
> up uwnd.2010.nc first and then uwnd.2009.nc second - using the sdfopen
> command.  Since I want to create a height/time cross-section, I need to
> set the following dimensions before starting the calculation:
>
> set dfile 1
> set t 152 258
> set z 1 16
> set x 1
> set y 1
>
> Then, I want to create an average over a specific area:
>
> uave = aave(uwnd, lon=-70, lon=-20, lat=0, lat=30)
>
> When I display the uave field, it looks perfect - a height/time
> cross-section for zonal wind in 2010.   But, if I then switch to the
> second file (e.g., set dfile 2) (zonal wind in 2009) and try to change
> the dimensions on that file, it instantly tells me that uave (the
> variable that had the height/time cross-section for 2010) has all
> undefined values.  For example:
>
> set dfile 2
> set t 152 258
> display uave - Gives message saying cannot contour grid - all undefined
> values
>
> I'm not sure how to get around this issue.  I tried this with two files
> that have the exact same dimensions (e.g., uwnd.2009.nc and
> uwnd.2010.nc) - in order to make sure that it wasn't a time dimension
> mismatch that was causing the original problem.
>
> Is there any way to specify the dimensions in both files at the same
> time?  Thanks for any additional help.
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130919/672bc110/attachment-0003.html 


More information about the gradsusr mailing list