[gradsusr] Help with averages - all undefined values

Sujata Mandke amin at tropmet.res.in
Thu Dec 2 07:30:04 EST 2021


Dear Jason,

  Sorry, the grads script sent
to you in the previous mail,
calculates monthly climatology 
and not anomaly.
  Try following :
-------------------
'reinit'
'sdfopen C:\OpenGrADS-2.2\data\hgt.mon.mean.nc'
'q file'
say result
say 'write xsize'
pull xl
say 'write ysize'
pull yl
'set gxout fwrite'
'set undef -999'
'set fwrite hgt.monanom.1948-2010.bin'
t=1 
'set x 1 'xl
'set y 1 'yl
'set time jan1948 dec2010'
'define hgtmoncl=ave(hgt,t+0,time=dec2010,12)' 
'modify hgtmoncl seasonal' 
while (t <= 756)
'set t 't
say 'Now at t= 't
'd hgt-hgtmoncl'
t=t+1
endwhile

This will monthly mean height anomalies
in Grads binary file-"hgt.monanom.1948-2010.bin"
You have to create corresponding grads control (.ctl)
file and plot anomalies.
With best regards
Dr. Sujata Mandke
Scientist, IITM, Pune-8

----- Original Message -----
From: "jason" <jason at solargrafix.com>
To: "gradsusr" <gradsusr at gradsusr.org>
Sent: Wednesday, December 1, 2021 11:54:27 PM
Subject: Re: [gradsusr] Help with averages - all undefined values

Hello,

I edited my code as you suggested, and now I get an error that says 
"Cannot contour grid - all undefined values".  Here is the code I am 
using...

'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'

count = 397
while (count <= 756)

'set t 'count

'set gxout shaded'
'set csmooth on'
'set grads off'
'cgpa -150 150 2  -gxout shaded -kind 
g11->g10->g9->g8->g7->g6->g5->g4->g3->g2->g1'
'define anom = hgt - hgtclim'
'd anom'

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

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

count = count + 1
'c'
endwhile




On 12/1/2021 12:00 PM, gradsusr-request at gradsusr.org wrote:
> Send gradsusr mailing list submissions to
> 	gradsusr at gradsusr.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://gradsusr.org/mailman/listinfo/gradsusr
> or, via email, send a message with subject or body 'help' to
> 	gradsusr-request at gradsusr.org
>
> You can reach the person managing the list at
> 	gradsusr-owner at gradsusr.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gradsusr digest..."
>
>
> Today's Topics:
>
>     1. Re: Help with average (Sujata Mandke)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 1 Dec 2021 16:53:00 +0530 (IST)
> From: Sujata Mandke <amin at tropmet.res.in>
> To: gradsusr <gradsusr at gradsusr.org>
> Cc: jason at solargrafix.com
> Subject: Re: [gradsusr] Help with average
> Message-ID:
> 	<95880721.1298614.1638357780213.JavaMail.zimbra at tropmet.res.in>
> Content-Type: text/plain; charset=utf-8
>
> 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
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
> ------------------------------
>
> End of gradsusr Digest, Vol 141, Issue 1
> ****************************************
_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr



More information about the gradsusr mailing list