<div dir="ltr"><div>Jason,</div><div>The literal translation of the error message you're getting is that the two grids you're trying to operate on in your command:</div><div><br></div><div>'d hgt - gpa', <br></div><div><br></div><div>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.<br></div><div><br></div><div>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.<br></div><div><br></div><div>Another way you can eliminate uncertainty in time is by specifying the time string in your command, i.e., change</div><div><br></div><div>

'define ave(hgt,t=397,t=757,12)' <br></div><div><br></div><div>to 'define ave(hgt,t=00Z01Jan1981,t=00Z31Dec2010,t=12)' [or whatever your particular time bounds are]<br></div><div><br></div><div>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</div><div><br></div><div>


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


'define ave(hgt.1,t=00Z01Jan1981,t=00Z31Dec2010,t=12)' <br></div><div><br></div><div>without having the 'set dfile 1'; 'define hgt = hgt'  step in there first.<br></div><div><br></div><div>Hopefully something in here helps.</div><div><br></div><div>Jeff Duda<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 29, 2021 at 9:48 PM Jason M. Warren <<a href="mailto:jason@solargrafix.com">jason@solargrafix.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
I have a file with monthly height data dating back to 1948.  I would <br>
like to create monthly averages of the data from 1981 to 2010 to create <br>
anomaly maps.<br>
<br>
I have been trying to create a script that will create the averages <br>
using ave.  Then subtract data from another height map I have to display <br>
the height anomalies. Here is what I have...<br>
<br>
'clear'<br>
'set datawarn off'<br>
<br>
'sdfopen C:\OpenGrADS-2.2\data\<a href="http://hgt.mon.mean.nc" rel="noreferrer" target="_blank">hgt.mon.mean.nc</a>'<br>
<br>
'sdfopen C:\OpenGrADS-2.2\data\GFSGPA.nc'<br>
<br>
'set dfile 1'<br>
'define hgt = hgt'<br>
<br>
'set dfile 2'<br>
'set t 1 80'<br>
'define gpa = gpa'<br>
<br>
count = 1<br>
while (count <= 80)<br>
<br>
'set t 'count<br>
<br>
'define ave(hgt,t=397,t=757,12)'<br>
'modify hgt seasonal'<br>
<br>
'd hgt-gpa'<br>
<br>
fmt='%02.0f'<br>
cc=math_format(fmt,count)<br>
<br>
'gxprint C:\models\TEST\GPA-'cc'.png x1024 y768'<br>
<br>
count = count + 1<br>
'c'<br>
endwhile<br>
<br>
<br>
What I get when I run this script is the following...<br>
<br>
Error in gagchk: axis sizes are not the same<br>
Operation error:  Incompatable grids<br>
   Error ocurred at column 11<br>
DISPLAY error:  Invalid expression<br>
   Expression = gpa-height<br>
Error in <a href="http://xcbar.gs" rel="noreferrer" target="_blank">xcbar.gs</a>: No shading information<br>
DEFINE error: Failed to find '=' after parsing the defined variable name<br>
               The name may be too long or contain non-alphanumeric <br>
characters<br>
Defined variable is now climatological<br>
<br>
I am very confused, and I would appreciate any help.<br>
<br>
Thanks,<br>
<br>
Jason Warren<br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="2"><span>Jeff Duda, Research Scientist</span></font></div><div dir="ltr"><font size="2"><span></span></font>University of Colorado Boulder</div><div dir="ltr"><font size="2"><span></span></font>Cooperative Institute for Research in Environmental Sciences</div><div dir="ltr">NOAA/OAR/ESRL/Global Systems Laboratory<br><font size="2"><span>

<span>Boulder, CO<br></span></span></font>



</div></div></div></div></div></div></div></div></div></div>