[gradsusr] if else statement

Rupak Rajbhandari rupak.rajbhandari at gmail.com
Sat Jul 18 06:32:44 EDT 2015


Hi,

What exactly is the value when t=5? According to your example, it is an
error and the if condition is never true or less than -99999. According to
your example

d var(t=5)
Display error: there is no value
Try comparing with exact value when t=5; in this case it is "there"

val=subwrd(result,3)
if (val = 'there')
pp=99999
else
pp=val
endif


-rupak


On Wed, Jul 15, 2015 at 2:12 PM, Manoranjan LPAS <lpasmanoranjan at gmail.com>
wrote:

> Dear users,
> Sorry!! I am not able to do it. Part of my grads output looks as:
>
> d var(t=1)
> printing value 89
> d var(t=2)
> printing value 77
> d var(t=3)
> printing value 85
> d var(t=4)
> printing value 79
> d var(t=5)
> Display error: there is no value
> d var(t=6)
> printing value 81
> d var(t=7)
> printing value 88
>
> I would like to write these grads output values in ACSII format as:
> 89
> 77
> 85
> 79
> 99999
> 81
> 88
>
> I tried with the following, but it is giving all the values 99999.
> t1=1
> t2=7
> while(t1<=t2)
> set t 't1
>  'd 'var''
> val=subwrd(result,3)
> if (val < -99999)
> pp=99999
> else
> pp=val
> endif
> rc=write(outfile.txt,pp)
> t1=t1+1
> endwhile
>
> I sincerely appreciate, in advance, for any kind of help or suggestion in
> this regard.
>
> Thank you Rupak for your suggestion, but that doesn't work.
>
> Mano
> ***************************************
> Mr. M L P A Sridharan
> System Analyst; HPC Lab
> **************************************
>
> On 3 July 2015 at 11:22, Rupak Rajbhandari <rupak.rajbhandari at gmail.com>
> wrote:
>
>> TRY
>>
>>  'd 'var''
>> val=subwrd(result,3)
>>
>> if ( val < -99999)
>>    ...
>> else
>>    ...
>> endif
>> rc=write(outfile.txt,val)
>>
>>
>>
>> -rupak
>>
>>
>> On Thu, Jul 2, 2015 at 3:16 PM, Manoranjan LPAS <lpasmanoranjan at gmail.com
>> > wrote:
>>
>>> Dear Ryan,
>>> Thank you very much for your suggestion. But this could not solve my
>>> problem. Because, at some times (e. g. at t 101) there is no data.
>>> e.g. If I display the variable by setting lat 5 , lon 80 and time 1 to
>>> 100, it is fine.
>>> But at t 101, it is giving error.
>>> Again from t 102 to 250, it is fine... Like this.
>>>
>>> Kind regards
>>> Sridhara
>>>
>>> On Thursday, July 2, 2015, Ryan Hickman <ryan at allisonhouse.com> wrote:
>>>
>>>> Mano,
>>>>
>>>> Use 'set undef 99999' instead of looping over every grid point
>>>> (inefficient.)
>>>>
>>>> - Ryan
>>>>
>>>> > On Jul 1, 2015, at 9:44 PM, Manoranjan LPAS <lpasmanoranjan at gmail.com>
>>>> wrote:
>>>> >
>>>> > Dear users,
>>>> > I was trying to save the grads output values at a grid point in ACSII
>>>> format. I found that there are some missing values at many times. So I
>>>> wanted to write those missing values as 99999. When I used the following, I
>>>> am getting every values 99999.
>>>> >
>>>> >  'd 'var''
>>>> > if (subwrd(result,3) > -99999)
>>>> > val=subwrd(result,3)
>>>> > else
>>>> > val=99999
>>>> > endif
>>>> > rc=write(outfile.txt,val)
>>>> >
>>>> > Can anybody help me where am I doing mistake.
>>>> >
>>>> > Thanking You,
>>>> > Kind Regards
>>>> > Mano
>>>> > _______________________________________________
>>>> > 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
>>>>
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150718/3df75309/attachment.html 


More information about the gradsusr mailing list