# [ncl-talk] Sub: EOF Analysis

Wed May 25 22:50:24 MDT 2016

```Hi Adam,
Reference:
http://www.ncl.ucar.edu/Document/Functions/Built-in/eofunc.shtml
>From example 7, what I understood is to retain same unit as data, EOF has
to be denormalised. It means EOF has unit.
Is that right?
I have been trying to do EOF analysis for obervation temperature data.

evecv_ts = eofunc_ts_Wrap (o,evecv,False)
EOF time series  result ranges from
min=-1693.35   max=1080.62
I would like to normalise these values to retain same unit as data. Since
the input data contains stations and corresponding time, there is no
latitude values to unweight and normalise as it is in the EOF sample
program. I did understood to use dim_standardise function to normalise, but
the unit is not retained as same as input data. What is the best way to
normalise and retain same unit as input data?
I don't want to use regression at this point, because I am only looking
into EOF time series.

Thank you

*Example 7*

Area-weight the data prior to calculation. Let p be four-dimensional with
dimensions lat, lon, and time. The array lat contains the latitudes.

; calculate the weights using the square root of the cosine of the latitude and
; also convert degrees to radians
wgt = *sqrt* <http://www.ncl.ucar.edu/Document/Functions/Built-in/sqrt.shtml>(*cos*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/cos.shtml>(lat*0.01745329))

; reorder <http://www.ncl.ucar.edu/Document/Language/reorder.shtml>
data so time is fastest varying
pt  = p(lat|:,lon|:,time|:)         ; (lat,lon,time)
ptw = pt                            ; create an array with metadata

; weight each point prior to calculation.
; *conform* <http://www.ncl.ucar.edu/Document/Functions/Built-in/conform.shtml>
is used to make wgt the same size as pt
ptw = pt**conform*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/conform.shtml>(pt,
wgt, 0)

evec= *eofunc*(ptw,neval,80.)

; denormalize the EOFs
; print the % variance explained
do ne=0,neval-1
evec(ne,:,:) = evec(ne,:,:)*sqrt( evec at eval(ne) )  ; units same as *data*

*print* <http://www.ncl.ucar.edu/Document/Functions/Built-in/print.shtml>("%
var="+ evec at pcvar(ne) )
end do

On Wed, May 25, 2016 at 4:36 PM, Adam Phillips <asphilli at ucar.edu> wrote:

> Hello,
> I am not sure what you mean by your question. The values coming out of
> eofunc are unitless, while the values coming out of eofunc_ts are the
> original units. A common approach to get the original units on a pattern is
> to normalize the PC, and regress the original data onto the normalized PC.
> The resulting regression plot will be in the original units per standard
> deviation change in the PC.
>
> Hope that makes sense. If not, please respond to the ncl-talk email list
> only and not to me personally.
>
>
> On Wed, May 25, 2016 at 9:23 AM, Adv <advita6 at gmail.com> wrote:
>
>>
>> Hi ,
>> Could someone suggest me a way to normalise the PC values and retain the
>> same unit?
>>
>>
>> Thanks
>>
>>
>> ;time=41,sta=392
>> xx1 = dats(time | :,sta|:)     ; reorder ... eofunc want 'time' as
>> rightmost dimension
>> printVarSummary(xx1)
>> printMinMax(xx1,0)
>> o=dats(sta|:,time|:)
>> printVarSummary(o)
>> evecv    = eofunc_Wrap    (o,neval,False)
>> evecv_ts = eofunc_ts_Wrap (o,evecv,False)
>> print(evecv_ts(0,:))
>> printVarSummary(evecv)
>> printMinMax(evecv(0,:),0);Normalised
>> ; ================================>   ; SUM OF THE SQUARES
>>                                       ; IF NORMALIZED, THEY SHOULD BE 1
>> ;  sumsqr = dim_sum(evecv^2)
>> ;  print("sum of squares: " + sumsqr)
>>
>> ;To retain same unit;Denormalise
>>   do ne=0,neval-1
>>      evecv(ne,:) = evecv(ne,:)*sqrt( evecv at eval(ne) )
>>   end do
>> printMinMax(evecv(0,:),0);Normalised
>> evecv_ts = eofunc_ts_Wrap (o,evecv,False)
>>
>> Output of min/max
>>     min=-1693.35   max=1080.62
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --