[gradsusr] Converting the grid with conditional loop in grads

Jayakrishnan P.R prjayakrishnan at gmail.com
Mon Dec 31 02:31:26 EST 2018


Thank you very much Davide and Andrew. I wrote the program as follows and
got the output. Kindly check it is correct or not.

'reinit'
'sdfopen population_ssp2_global_annual_1950-2005.nc'
'set gxout grfill'
'set t 1'
'define p1=population'
'set t 56'
'define p2=population'
'set grads off'
'define mask1=const(maskout(p1,p1-10000)*maskout(p2,p2-10000),1)'
'd mask1'
'draw title Population in the year 1950 above 10000 and above 10000 in 2005'
'printim type1grid_above10K.png white'

'define mask1=const(maskout(p1,p1-10000)*maskout(p2,p2-10000), 1)'
'define mask2=const(maskout(p1,10000-p1)*maskout(p2,p2-10000), 1)'
'define mask3=const(maskout(p1,10000-p1)*maskout(p2,10000-p2), 1)'

Jayakrishnan


On Fri, Dec 28, 2018 at 7:56 PM Andrew Friedman <andfried at gmail.com> wrote:

> Hi,
>
> You should be able to do all this in GrADS.
>
> If you haven’t, I recommend updating to at least version 2.1.1.b0, which
> introduced easier logical scripting expressions:
> http://cola.gmu.edu/grads/gadoc/expressions.html
> See the example here:
> http://gradsusr.org/pipermail/gradsusr/2017-February/040717.html
>
> -Andrew
>
> On Dec 28, 2018, at 4:04 AM, Jayakrishnan P.R <prjayakrishnan at gmail.com>
> wrote:
>
>
>
> Dear All,
>
>          I have a gridded data of population globally from 1950 to 2005. I
> wanted to do as follows.
>
> 1) Convert the grid into three different types.
>
> ie
>
> Type 1 grid>>> Display those grids if greater than value 10000 in the year
> 1950 and greater than value 10000 in the year 2015..
>
> Type 2 grid  Display those grids if value less than 10000 in the year 1950
> and greater than 10000 in the year 2015...
>
> Type 3 grid Display those grids if less than value 10000 in the year 1950
> and less than value 10000 in 2015
>
> Any thoughts in grads will be appreciated....Can we do this using maskout
> function, constant function and if else statement ?. I am unable to do it
> in grads. Trying to do in mathlab...
>
> Jayakrishnan
>
>
> --
>
> Sincerely
>
>
> **************************************************
>
> Dr. Jayakrishnan P.R
>
> Post Doctoral Research Fellow
>
> Science Technology Building
>
> School of System Science
>
> Beijing Normal University
>
> No. 96 XInjiekouwai Street
>
> Beijing 100875
>
> China
>
> Tel: +86-188 11005715
>
>
> ****************************************************
>
>
>
>
>
> _______________________________________________
>
> gradsusr mailing list
>
> gradsusr at gradsusr.org
>
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>


-- 
Sincerely

**************************************************
Dr. Jayakrishnan P.R
Post Doctoral Research Fellow
Science Technology Building
School of System Science
Beijing Normal University
No. 96 XInjiekouwai Street
Beijing 100875
China
Tel: +86-188 11005715

****************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20181231/2d528c9f/attachment.html>


More information about the gradsusr mailing list