Re: if then statements

From: Rick Brownrigg <brownrig_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 07 2013 - 14:46:06 MDT

Hi,

In the first instance, you are saying if "any* value in the array Teq is greater than 355.15, then set *all* values of hot to 1.

Rick

On Jun 7, 2013, at 2:27 PM, jbuzan <jbuzan@purdue.edu> wrote:

> Hello NCL-talk,
>
> I am having trouble with my if-then statements.
> I am not sure why my statement is failing.
>
> -Jonathan
>
>
> Teq = (/200.,\
> 205.,210.,215.,220.,225.,\
> 230.,235.,240.,245.,250.,\
> 255.,260.,265.,270.,275.,\
> 280.,285.,290.,295.,300.,\
> 305.,310.,315.,320.,325.,\
> 330.,335.,340.,345.,350.,\
> 355.,360.,365.,370.,375./)
>
> Incorrect:
> ; hot = where((Teq.gt.355.15),1.,0.)
> if (any(Teq.gt.355.15 )) then
> hot = 1.0
> else
> hot = 0.0
> end if
>
> Variable: hot
> ...
> (0) 1
>
> (35) 1
>
> Correct:
> hot = where((Teq.gt.355.15),1.,0.)
> ; if (any(Teq.gt.355.15 )) then
> ; hot = 1.0
> ; else
> ; hot = 0.0
> ; end if
>
> Variable: hot
> ...
> (0) 0
>
> (31) 0
> (32) 1
> (33) 1
> (34) 1
> (35) 1
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 7 14:46:16 2013

This archive was generated by hypermail 2.1.8 : Tue Jun 11 2013 - 12:03:58 MDT