GRADS calculating problem

All other topics about postprocessing model data (GrADS and other software), about other numerical weather prediction software (including WRF-NMM and WRF-ARW discussion unrelated to UEMS/WRF EMS), and general meteorology talk go in this forum.
Post Reply
nebojsa
Posts: 133
Joined: Sun Mar 21, 2010 3:40 pm

GRADS calculating problem

Post by nebojsa » Mon Feb 06, 2017 10:28 am

Hi folks!


I have one problem in GRADS scripting.

I've defined variable:

Code: Select all

'define gdd=((((TMP2m(t='i+6')-'kelvin')+(TMP2m(t='i+12')-'kelvin'))/2)-10)'
and I need to set gdd = 0 if gdd < 0 but to do on the whole field so I can draw it.

I may put in drawings options to start to draw with 0, all below with the same color, but I have to make accumulated variable too:

Code: Select all

gddsum = SUM(gdd(1),.., gdd(n)).
I've tried with

Code: Select all

 if(gdd < 0); gdd = 0; endif 
in several variants (with or without quotes, partial quotes, semi quotes,....) but nothing gave any result. Sometimes I've got errors, sometimes it just pass over it without calculating...
I've tried with math_nint, nothing happened...

Do you have any idea how to solve this problem?

Thanks in advance!

Nebojša

nebojsa
Posts: 133
Joined: Sun Mar 21, 2010 3:40 pm

Re: GRADS calculating problem

Post by nebojsa » Mon Feb 06, 2017 8:56 pm

Well, a very simple solution of this problem got on my mind and it works.
Problem: I need only positive values of the variable and if it is negative it should be set on 0.
So, to achieve this, I used abs() function!

Code: Select all

'define gdd=((((TMP2m(t='i+6')-'kelvin')+(TMP2m(t='i+12')-'kelvin'))/2)-10)'
'define gddx = (gdd + abs(gdd))/2

dominic
Posts: 312
Joined: Thu Jun 14, 2012 7:19 am

Re: GRADS calculating problem

Post by dominic » Tue Feb 07, 2017 5:24 pm

I did not understand what you're getting with this formula

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest