[gradsusr] Need Help for specific command
MD ABDUS SATTAR
md-abdus.sattar at students.mq.edu.au
Wed Nov 4 20:34:00 EST 2015
Dear Rashed
Thank you very much for your cooperation. I am still in trouble to
calculate this. See my script my as follow:
"reinit"
"sdfopen \Users\mq43879691\documents\sst5014.mnmean.v4.nc"
"set t 1 12"
"define avesst=ave(sst2,t+0,t=780,12)"
"modify avesst seasonal"
"set t 1 780"
"define sstanom=sst2-avesst"
"define N4=aave(sstanom,lon=160,lon=210,lat=-5,lat=5)"
"define N3=aave(sstanom,lon=210,lon=270,lat=-5,lat=5)"
"define prod = N3*N4"
if ( prod > 0)
alpha = 0.4
else
alpha = 0
endif
"define Nct = N3-alpha*N4"
"define Nwp = N4-alpha*N3"
"set lev 0"
"set lon 210"
"set lat -5"
"set timelab off"
"set Grads off"
"set cmark 0"
"set t 1 780"
"d Nct"
>From the above script I was trying to calculate time series of Nct and Nwp
during 1950-2014. Nct and Nwp have single values for each month (January to
December). If i can use this command for yearly time series then I can use
it for monthly time series as well.
Please suggest me where I did mistake again.
I look forward to your message
Regards
Abdus
On Wed, Nov 4, 2015 at 8:28 AM, Rashed Mahmood <rashidcomsis at gmail.com>
wrote:
> 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
>>
>>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20151105/c0d8efb3/attachment-0001.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/20151105/c0d8efb3/attachment-0001.png
More information about the gradsusr
mailing list