How can I reconstruct two arrays after an SVD

From: Cheung <zuibeidemei_at_nyahnyahspammersnyahnyah>
Date: Mon Jul 21 2014 - 09:12:12 MDT

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(ncols, ncolz) ]
  froot = "/fs/scd/home1/shea/ncldata_input/"
  s = asciiread (froot+"svd_ex01_S.asc",(/ntime,ncols/), "float")
  z = asciiread (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 Mon Jul 21 03:12:22 2014

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