[gradsusr] Help with average

Jeff Duda jeffduda319 at gmail.com
Tue Nov 30 01:34:18 EST 2021


Jason,
The literal translation of the error message you're getting is that the two
grids you're trying to operate on in your command:

'd hgt - gpa',

have different dimensionalities (either nx, ny, nz, nt, or some combination
thereof). Have you verified that the grids coming from those two files are
indeed identical (or can be constrained so that they are)? It seems like
the time dimension may be the root of the problem, but checking the
dimensionalities of each grid is the first step. Also, check that the time
increment between data slices is one month after you have read in the
fields.

If the dimensionalities are the same, then there could be something weird
happening with your use of 'set dfile'. In particular, since you're
defining a new field that has the same name as that from the source file,
and with no modifications, on two different dfiles, then it is possible
that they are being defined on different grids somehow. Regardless of that
oddity, it seems like a strange use of memory to do that.

Another way you can eliminate uncertainty in time is by specifying the time
string in your command, i.e., change

'define ave(hgt,t=397,t=757,12)'

to 'define ave(hgt,t=00Z01Jan1981,t=00Z31Dec2010,t=12)' [or whatever your
particular time bounds are]

Then you don't have to worry about the time index values in that
expression. By the way, you can get around the 'dfile' issue by using the
'.n' syntax on a grid. Placed after the field name, but before any slicing
or operations, it tells GrADS to look through file n for that grid. So you
could also use

'define ave(hgt.1,t=397,t=757,12)' or  'define
ave(hgt.1,t=00Z01Jan1981,t=00Z31Dec2010,t=12)'

without having the 'set dfile 1'; 'define hgt = hgt'  step in there first.

Hopefully something in here helps.

Jeff Duda

On Mon, Nov 29, 2021 at 9:48 PM Jason M. Warren <jason at solargrafix.com>
wrote:

> Hello,
>
> I have a file with monthly height data dating back to 1948.  I would
> like to create monthly averages of the data from 1981 to 2010 to create
> anomaly maps.
>
> I have been trying to create a script that will create the averages
> using ave.  Then subtract data from another height map I have to display
> the height anomalies. Here is what I have...
>
> 'clear'
> 'set datawarn off'
>
> 'sdfopen C:\OpenGrADS-2.2\data\hgt.mon.mean.nc'
>
> 'sdfopen C:\OpenGrADS-2.2\data\GFSGPA.nc'
>
> 'set dfile 1'
> 'define hgt = hgt'
>
> 'set dfile 2'
> 'set t 1 80'
> 'define gpa = gpa'
>
> count = 1
> while (count <= 80)
>
> 'set t 'count
>
> 'define ave(hgt,t=397,t=757,12)'
> 'modify hgt seasonal'
>
> 'd hgt-gpa'
>
> fmt='%02.0f'
> cc=math_format(fmt,count)
>
> 'gxprint C:\models\TEST\GPA-'cc'.png x1024 y768'
>
> count = count + 1
> 'c'
> endwhile
>
>
> What I get when I run this script is the following...
>
> Error in gagchk: axis sizes are not the same
> Operation error:  Incompatable grids
>    Error ocurred at column 11
> DISPLAY error:  Invalid expression
>    Expression = gpa-height
> Error in xcbar.gs: No shading information
> DEFINE error: Failed to find '=' after parsing the defined variable name
>                The name may be too long or contain non-alphanumeric
> characters
> Defined variable is now climatological
>
> I am very confused, and I would appreciate any help.
>
> Thanks,
>
> Jason Warren
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>


-- 
Jeff Duda, Research Scientist
University of Colorado Boulder
Cooperative Institute for Research in Environmental Sciences
NOAA/OAR/ESRL/Global Systems Laboratory
Boulder, CO
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20211129/9904838a/attachment.html>


More information about the gradsusr mailing list