Tuesday, September 1, 2009

Anomaly- GrADS and Scripting

I've been doing this for this week (and last week)...now, i need to do a control file that grab the data and save it...(..and now i'm confused. what should i do next?? i should ask Mr.O...)

************************************************************************************
* Long Term Mean Skin Temperature, NCEP/NCAR data taken from cdc.noaa.gov
* ////////////////////////////////////
* AVERAGE TEMPERATURE EACH MONTH FROM 1978 - 2008

'reinit'
'sdfopen f:\ncep\skt.temp\skt.mon.mean.nc'
'set lat -60 80'
'set lon 80 300'
*
* calculating mean by month*
*JANUARY MEAN
'define atmpjan = ave(skt,t=361,t=732,12)'
*FEB MEAN
'define atmpfeb = ave(skt,t=362,t=732,12)'
*MARCH MEAN
'define atmpmar = ave(skt,t=363,t=732,12)'
*APRIL MEAN
'define atmpapr = ave(skt,t=364,t=732,12)'
*MAY MEAN
'define atmpmay = ave(skt,t=365,t=732,12)'
*JUNE MEAN
'define atmpjun = ave(skt,t=366,t=732,12)'
*JULY MEAN
'define atmpjul = ave(skt,t=367,t=732,12)'
*AUGUST MEAN
'define atmpaug = ave(skt,t=368,t=732,12)'
*SEPTEMBER MEAN
'define atmpsep = ave(skt,t=369,t=732,12)'
*OCTOBER MEAN
'define atmpoct = ave(skt,t=370,t=732,12)'
*NOVEMBER MEAN
'define atmpnov = ave(skt,t=371,t=732,12)'
*DECEMBER MEAN
'define atmpdec = ave(skt,t=372,t=732,12)'
*******************************************************
* calculating diff for respective month
* for interested year. let 2008
* time index start with t=372 until t=732

'define djan08 = skt(t=721) - atmpjan'
'define dfeb08 = skt(t=722) - atmpfeb'
'define dmar08 = skt(t=723) - atmpmar'
'define dapr08 = skt(t=724) - atmpapr'
'define dmay08 = skt(t=725) - atmpmay'
'define djun08 = skt(t=726) - atmpjun'
'define djul08 = skt(t=727) - atmpjul'
'define daug08 = skt(t=728) - atmpaug'
'define dsep08 = skt(t=729) - atmpsep'
'define doct08 = skt(t=730) - atmpoct'
'define dnov08 = skt(t=731) - atmpnov'
'define ddec08 = skt(t=732) - atmpdec'
*
*******************************************************
p=1
while (p=1)
'c'
prompt "Enter the time index "
pull tindex
prompt "Enter the month "
pull mth

'set gxout contour'
'set csmooth on'
'set cint 0.5'
'define diffx = skt(t='tindex') - atmp'mth''
'd diffx'
'run basemap L 0 1 M'

prompt "continue? ( 1 to end 0 to cont) "
pull resp

if ( resp = 1)
p = p + resp
endif
endwhile
*endscript

*************************************************************************************


it's quite easy actually, but without strong basic it's damn confusing. anyway, manipulating it for real life use can be very confusing. well, i need to learn this a lot more. (including all the AO, ENSO writing and Dynamic meteorology stuff)

me: _"(x.x)__

No comments:

Post a Comment