Re: How can I reconstruct two arrays after an SVD

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Jul 23 2014 - 09:44:21 MDT

I believe so. Why not set nsvd=ntim and see if you can reconstruct the
original series.



On Mon, Jul 21, 2014 at 9:12 AM, Cheung <zuibeidemei@126.com> wrote:

> *Dear all:*
>
> * Like in the example of svdcov_sv:*
>
> *begin
> ; PARAMETERS
> ntime = 8 ; # time steps
> ncols = 3 ; # columns (stations or grid pts) for S
> ncolz = 6 ; # columns (stations or grid pts) for Z
> nsvd = 3 ; # svd patterns to calculate
> ; [nsvd <= **min* <http://www.ncl.ucar.edu/Document/Functions/Built-in/min.shtml>*(ncols, ncolz) ]
> froot = "/fs/scd/home1/shea/ncldata_input/"
> s = **asciiread* <http://www.ncl.ucar.edu/Document/Functions/Built-in/asciiread.shtml>* (froot+"svd_ex01_S.asc",(/ntime,ncols/), "float")
> z = **asciiread* <http://www.ncl.ucar.edu/Document/Functions/Built-in/asciiread.shtml>* (froot+"svd_ex01_Z.asc",(/ntime,ncolz/), "float")
>
> s!0 = "time" ; name dimensions for reordering
> s!1 = "col"
> z!0 = "time"
> z!1 = "col"
>
> svLeft = new((/nsvd,ncols/),float) ; pre-allocate space
> svRight = new((/nsvd,ncolz/),float)
> ; reorder so time varying fastest
> pcVar = **svdcov_sv**(s(col|:,time|:),z(col|:,time|:),nsvd,svLeft,svRight)
>
> print("**svdcov_sv**: percent variance= " + pcVar)
> print("**svdcov_sv**: singular values = " + pcVar@sv)*
>
> * end *
>
> -------------------------------
>
> * After this prodedure, I have an svLeft and an svRight and a PC series.*
>
> * Now I'd like to use the first two modes to reconstruct the s and z.*
>
> * Can I just simply use s={SUM(svLeft(i)*PC(i)),i=1,2} and z={SUM(svRight(i)*PC(i)),i=1,2}?*
>
> * Thanks in advance for any suggestion.*
>
> Regards
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

Received on Wed Jul 23 03:44:27 2014

This archive was generated by hypermail 2.1.8 : Fri Aug 01 2014 - 15:10:55 MDT