[gradsusr] Need Help for specific command
Rashed Mahmood
rashidcomsis at gmail.com
Tue Nov 3 16:28:29 EST 2015
The way you wrote it, won't work because this is not how "if else endif"
statements are used .
Please see the following page for a detailed information on statements:
http://iges.org/grads/gadoc/script.html#statement
Assuming that your N3 and N4 are defined (have a single value each) before
the following:
Try this:
'prod = N3*N4'
if ( prod > 0)
alpha = 0.4
else
alpha = 0
endif
'Nct = N3-alpha*N4'
'Nwp = N4-alpha*N3'
And you can use it inside a loop to calculate for a time series.
On Mon, Nov 2, 2015 at 7:57 PM, MD ABDUS SATTAR <
md-abdus.sattar at students.mq.edu.au> wrote:
> Dear Rashed
> I wrote my script as:
>
> "define prod=N3*N4"
> "define alpha=0.4,if(prod>0)"
> "define alpha=0, if (prod<0)"
> "endif"
> "define Nct=N3-alpha*N4"
> "define Nwp=N4-alpha*N3"
>
> However, it does not work and I do not know my mistake here. I am
> using NOAA Extended Reconstructed Sea Surface Temperature (SST) V4 data (
> http://www.esrl.noaa.gov/psd/data/gridded/data.noaa.ersst.v4.html).
>
> Could please tell me where I did mistake?
>
> I look forward to your message.
>
> Cheers
> Abdus Sattar
>
>
> On Tue, Nov 3, 2015 at 12:27 PM, Rashed Mahmood <rashidcomsis at gmail.com>
> wrote:
>
>> It should be simple using if else statement.
>> Untested:
>>
>> prod = N3*N4
>>
>> if ( prod > 0)
>> alpha = 0.4
>> else
>> alpha = 0
>> endif
>>
>> Nct = N3-alpha*N4
>> Nwp = N4-alpha*N3
>>
>> hope that helps
>>
>>
>>
>> On Mon, Nov 2, 2015 at 4:52 PM, MD ABDUS SATTAR <
>> md-abdus.sattar at students.mq.edu.au> wrote:
>>
>>> Dear Team
>>> I was trying to calculate year by year time series from monthly mean SST
>>> data by using following formula:
>>>
>>> [image: Inline image 1]
>>> Where, N3 and N4 denote Nino3 and Nino4 indices respectively. I would
>>> like to calculate NCT and NWP for a specific year, for instance, 1997
>>> (January to December). My question is how can I define "α
>>>
>>> value" in GrADS so that it can use the value of 2/5 or 0 automatically?
>>> If anybody could help me, it would be great.
>>>
>>> I look forward to your message.
>>>
>>> Best regards
>>> Abdus
>>> --
>>> Md. Abdus Sattar
>>> PhD Student
>>> Department of Environmental Sciences
>>> Level 2, Australian Hearing Hub Building
>>>
>>> Faculty of Science and Engineering
>>> Macquarie University
>>> NSW 2109 Australia
>>>
>>>
>>> Cell: +61404400401
>>> Email: md-abdus.sattar at students.mq.edu.au
>>>
>>> *AND*
>>>
>>> Assistant Professor
>>> Department of Disaster Risk Management (DRM)
>>> Faculty of Disaster Management
>>> Patuakhali Science and Technology University, Dumki, Patuakhali,
>>> Bangladesh
>>>
>>> Cell: +8801716851612
>>> Email: abdus.sattar at pstu.ac.bd
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
>
> --
> Md. Abdus Sattar
> PhD Student
> Department of Environmental Sciences
> Level 2, Australian Hearing Hub Building
>
> Faculty of Science and Engineering
> Macquarie University
> NSW 2109 Australia
>
>
> Cell: +61404400401
> Email: md-abdus.sattar at students.mq.edu.au
>
> *AND*
>
> Assistant Professor
> Department of Disaster Risk Management (DRM)
> Faculty of Disaster Management
> Patuakhali Science and Technology University, Dumki, Patuakhali, Bangladesh
>
> Cell: +8801716851612
> Email: abdus.sattar at pstu.ac.bd
>
> _______________________________________________
> 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/20151103/c6f037d2/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 5520 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20151103/c6f037d2/attachment.png
More information about the gradsusr
mailing list