Re: svdcov_sv

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Jul 17 2013 - 17:05:03 MDT

??? 2d fields [timexlatxlon] <=== this is 3d

[1]
   Let x(time,lat,lon) ; sizes ==> (ntim,nlat,mlon)
       y(time,lat,lon)

   nxy = nlat*mlon
                                ; reorder so time varying fastest
   X = x(lat|:,lon|:,time|:) ; sizes ===>(nlat,mlon,ntim)
   X2 = onedtond( ndtooned(X), (/ nxy, ntim /) ) ; (:,:)

   Y = ...
   Y2 = ...
   delete( [/x,y,X,Y/])

   nsvd = ...

   svLeft = new((/nsvd,nxy/),typeof(x)) ; pre-allocate space
   svRight = new((/nsvd,nxy/),typeof(x))

   pc = svdcov_sv(X2,Y2,nsvd,svLeft,svRight)

   printVarSummary(pc)

[2]
   No. You can write your own plot code.

   do ns=0,nsvd-1
      left = onedtond(svLeft(ns,:) , (/nlat,mlon/) ) ; reshape
      rght = onedtond(svRight(ns,:), (/nlat,mlon/) )

      left!0 = "lat"
      left!1 = "lon"
      left&lon = x&lon
      left&lat = x&lat

      rght!0 = "lat"
      rght!1 = "lon"
      rght&lon = x&lon
      rght&lat = x&lat

; plot code here

   end do

[3] lags .. the following is untested

   ntim = dimsizes(x&time)

   nlag = 3

   nxStrt = 0
   nxLast = ntim-1-nlag
   nxTime = nxLast-nxStrt+1
   X = x(lat|:,lon|:,time|nxStrt:nxLast) ; sizes ===>(nlat,mlon,ntim)
   X2 = onedtond( ndtooned(X), (/ nxy, nxTime /) ) ; (:,:)

   nyStrt = nlag
   nyLast = ntim-1
   nyTime = nyLast-nyStrt+1
   Y = y(lat|:,lon|:,time|nyStrt:nyLast) ; sizes ===>(nlat,mlon,ntim)
   Y2 = onedtond( ndtooned(X), (/ nxy, nyTime /) ) ; (:,:)

X2 leads Y2 by 'nlag' time steps

+++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++
NOTE: I do not have the time for multiple emails.
You will have to figure the rest out yourself.
+++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++

On 07/11/2013 12:31 AM, Ahmad Farsyud wrote:
> Hi NCL,
>
> I have several question regarding this function "svdcov_sv":
> http://www.ncl.ucar.edu/Document/Functions/Built-in/svdcov_sv.shtml
> 1. How could I apply this function for 2d fields [timexlatxlon]
> 2. Is there any example of the display output using this function in NCL?
> 3. One can give me suggestion , what should I do if I want to use svd
> for time-lagged analysis?
>
> Thank you,
> - AF
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 17 17:05:08 2013

This archive was generated by hypermail 2.1.8 : Fri Jul 19 2013 - 15:39:06 MDT