Re: Maximum Covariance Analysis

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Dec 02 2009 - 19:52:04 MST

Sorry .. attached

 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

   nsvd = 2

   diri = "/Users/shea/Data/netCDF/"
   f1 = addfile (diri+"EH5_OM_20C_2_TSURF_DETRENDRUNMEAN.nc", "r")
   tsm = f1->tsurf ; (time,lat,lon)

   f2 = addfile (diri+"EH5_OM_20C_2_U10M_DETRENDRUNMEAN.nc", "r")
   u = f2->u10 ; (time,lat,lon)

   dimtsm = dimsizes(tsm)
   ntim = dimtsm(0)
   nlat = dimtsm(1)
   mlon = dimtsm(2)

   dimu10 = dimsizes(u)
   ntim1 = dimu10(0)
   nlat1 = dimu10(1)
   mlon1 = dimu10(2)

   if (ntim.ne.ntim1) then
       print("time dimensions must be the same: ntim="+ntim+" , ntim1="+ntim1)
       exit
   end if

   T = onedtond( ndtooned(tsm), (/ntim ,nlat *mlon /))
   U = onedtond( ndtooned(u) , (/ntim1,nlat1*mlon1/))
   T!0 = "time"
   T!1 = "space"
   U!0 = "time"
   U!1 = "space"

   TT = T(space|:,time|:)
   UU = U(space|:,time|:)

   homlft = new((/nsvd,nlat *mlon /),float)
   hetlft = new((/nsvd,nlat *mlon /),float)
   homrgt = new((/nsvd,nlat1*mlon1/),float)
   hetrgt = new((/nsvd,nlat1*mlon1/),float)

   covar = svdcov(TT,UU,nsvd,homlft,hetlft,homrgt,hetrgt)
   print(covar)

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Dec 2 19:52:55 2009

This archive was generated by hypermail 2.1.8 : Thu Dec 03 2009 - 09:53:22 MST