[gradsusr] Help with average

Sujata Mandke amin at tropmet.res.in
Wed Dec 1 06:23:00 EST 2021


Hello Jason,

  It appears from your grads script that
you have a 63-year (1948-2010)time series 
of monthly mean height data(a variable 
named hgt with 756 time steps)and you 
want to create a climatology and then
look at the monthly anomalies for
the period 1981-20210.


If this is your requirement, then you do not
need two input files. Your error is due to the
differences in dimension of the two files. 

You can easily get monthly mean height anomalies
for 1981-2010 using only one input data file
as follows:

'sdfopen C:\OpenGrADS-2.2\data\hgt.mon.mean.nc'
'set t 1 12'
'define hgtclim = ave(hgt, t+0, t=756, 12)'
'modify hgtclim seasonal'
'set t 397 756'
'define anom = hgt - hgtclim'

Alternatively, you can first calculate
climatology using the steps given above 
and then  use counter for estimating anomalies: 


count = 397
while (count <= 756)

'set t 'count

'define anom = hgt - hgtclim'

fmt='%02.0f'
cc=math_format(fmt,count)

'gxprint C:\models\TEST\GPA-'cc'.png x1024 y768'

count = count + 1
'c'
endwhile
---------------
You may be getting error due
to time set as t=757 in ave command
instead of t=756. As time=757 does not exist
in your input height data file.

Hopefully, the above solution helps.
Please let me know if the problem
persist even after using these steps.

With best regards
Dr. Sujata Mandke
Scientist,IITM, Pune-8

-------------


----- Original Message -----
From: "Jason M. Warren" <jason at solargrafix.com>
To: "gradsusr" <gradsusr at gradsusr.org>
Sent: Tuesday, November 30, 2021 10:13:44 AM
Subject: [gradsusr] Help with average

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



More information about the gradsusr mailing list