From: <leonardo.silva_at_nyahnyahspammersnyahnyah>

Date: Tue Dec 15 2009 - 07:59:23 MST

Date: Tue Dec 15 2009 - 07:59:23 MST

Thank you very much.

Leonardo

= = = = = = =

Quoting Dennis Shea <shea@ucar.edu>:

*> Perhaps you want a matrix multiply? Change
*

*>
*

*> expcoeficientsL = transsvLeft*transsst
*

*>
*

*> to
*

*>
*

*> expcoeficientsL = transsvLeft#transsst
*

*>
*

*> http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclExpressions.shtml
*

*> ===
*

*> Also, it is better to write a acriptr than do this type of thing
*

*> interactively.
*

*>
*

*> Good luck
*

*>
*

*>
*

*>
*

*> leonardo.silva@cptec.inpe.br wrote:
*

*>> Hi all again
*

*>>
*

*>> This is the script that I'm using to calculate the expansion
*

*>> coeficients of the SVD calculus.
*

*>>
*

*>> I think that the things were ok until the matricies multiplying to
*

*>> construct the expasion coeficients. I type a printVarSummary below
*

*>> to show the dimension of the variables.
*

*>>
*

*>> If anyone could help me i will be grateful.
*

*>>
*

*>> ncl 0> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
*

*>> ncl 1> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
*

*>> ncl 2> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
*

*>> ncl 3>
*

*>> ncl 4> nsvd = 1
*

*>> ncl 5>
*

*>> ncl 6> ntim = 358
*

*>> ncl 7> nlat = 28
*

*>> ncl 8> mlon = 47
*

*>> ncl 9>
*

*>> ncl 10> ncase = 2
*

*>> ncl 11> ncase1 = 1
*

*>> ncl 12>
*

*>> ncl 13> a = new ( (/ncase,nlat,mlon,ntim/) , float)
*

*>> ncl 14> a!0 = "case" ; name dimension
*

*>> ncl 15>
*

*>> ncl 16> diri = "/media/disk/echam5/u-v10m/"
*

*>> ncl 17>
*

*>> ncl 18> f = addfile
*

*>> (diri+"EH5_OM_20C_2_TSURF_DETRENDRUNMEAN.nc", "r")
*

*>> ncl 19> sst = f->tsurf(lat|:,lon|:,time|:)
*

*>> ncl 20>
*

*>> ncl 21> f0 = addfile
*

*>> (diri+"EH5_OM_20C_2_U10M_DETRENDRUNMEAN.nc", "r")
*

*>> ncl 22> a(0,:,:,:) = f0->u10(lat|:,lon|:,time|:)
*

*>> ncl 23>
*

*>> ncl 24> f1 = addfile
*

*>> (diri+"EH5_OM_20C_2_V10M_DETRENDRUNMEAN.nc", "r")
*

*>> ncl 25> a(1,:,:,:) = f1->v10(lat|:,lon|:,time|:)
*

*>> ncl 26>
*

*>> ncl 27> dimsst = dimsizes(sst)
*

*>> ncl 28> nlat = dimsst(0)
*

*>> ncl 29> mlon = dimsst(1)
*

*>> ncl 30> ntim = dimsst(2)
*

*>> ncl 31>
*

*>> ncl 32> dimV = dimsizes(a)
*

*>> ncl 33> ncas1 = dimV(0)
*

*>> ncl 34> nlat1 = dimV(1)
*

*>> ncl 35> mlon1 = dimV(2)
*

*>> ncl 36> ntim1 = dimV(3)
*

*>> ncl 37>
*

*>> ncl 38> if (ntim.ne.ntim1) then
*

*>> ncl 39> print("time dimensions must be the same:
*

*>> ntim="+ntim+" , ntim1="+ntim1)
*

*>> ncl 40> exit
*

*>> ncl 41> end if
*

*>> ncl 42>
*

*>> ncl 43> T = onedtond( ndtooned(sst), (/ntim ,nlat *mlon /))
*

*>> ncl 44> V = onedtond( ndtooned(a) , (/ntim1,nlat1*mlon1/))
*

*>> warning:onedtond : output dimension sizes have fewer elements than
*

*>> input, some data not
*

*>> copied
*

*>> ncl 45> T!0 = "time"
*

*>> ncl 46> T!1 = "space"
*

*>> ncl 47> V!0 = "time"
*

*>> ncl 48> V!1 = "space"
*

*>> ncl 49>
*

*>> ncl 50> TT = T(space|:,time|:)
*

*>> ncl 51> VV = V(space|:,time|:)
*

*>> ncl 52>
*

*>> ncl 53> svLeft = new((/nsvd,nlat *mlon /),float)
*

*>> ncl 54> svRight = new((/nsvd,nlat1*mlon1/),float)
*

*>> ncl 55>
*

*>> ncl 56> svdec = svdstd_sv(TT,VV,nsvd,svLeft,svRight)
*

*>> ncl 57>
*

*>> ncl 58> asciiwrite("svd.dat", svdec)
*

*>> ncl 59> asciiwrite("svLeft.dat", svLeft)
*

*>> ncl 60> asciiwrite("svRight.dat", svRight)
*

*>> ncl 61>
*

*>> ncl 62>
*

*>> ncl 63> Le = svLeft
*

*>> ncl 64> Le!0 = "time"
*

*>> ncl 65> Le!1 = "space"
*

*>> ncl 66> Left = Le(space|:,time|:)
*

*>> ncl 67>
*

*>> ncl 68> Ri = svRight
*

*>> ncl 69> Ri!0 = "time"
*

*>> ncl 70> Ri!1 = "space"
*

*>> ncl 71> Right = Ri(space|:,time|:)
*

*>> ncl 72>
*

*>> ncl 73> transsvLeft = transpose(Left)
*

*>> ncl 74> transsst = transpose(T)
*

*>> ncl 75>
*

*>> ncl 76> transsvRight = transpose(Right)
*

*>> ncl 77> transV = transpose(V)
*

*>> ncl 78>
*

*>> ncl 79> expcoeficientsL = transsvLeft*transsst
*

*>> fatal:Mul: Dimension size, for dimension number 0, of operands does
*

*>> not match, can't
*

*>> continue
*

*>>
*

*>> fatal:Execute: Error occurred at or near line 79
*

*>>
*

*>> ncl 80> expcoeficientsR = transsvRight*transV
*

*>> fatal:Mul: Dimension size, for dimension number 0, of operands does
*

*>> not match, can't
*

*>> continue
*

*>>
*

*>> fatal:Execute: Error occurred at or near line 80
*

*>>
*

*>> ncl 81>
*

*>> ncl 82> printVarSummary(transsvLeft)
*

*>>
*

*>>
*

*>> Variable: transsvLeft
*

*>> Type: float
*

*>> Total Size: 5264 bytes
*

*>> 1316 values
*

*>> Number of Dimensions: 2
*

*>> Dimensions and sizes: [time | 1] x [space | 1316]
*

*>> Coordinates:
*

*>> Number Of Attributes: 1
*

*>> _FillValue : -999
*

*>> ncl 83> printVarSummary(transsst)
*

*>>
*

*>>
*

*>> Variable: transsst
*

*>> Type: float
*

*>> Total Size: 1884512 bytes
*

*>> 471128 values
*

*>> Number of Dimensions: 2
*

*>> Dimensions and sizes: [space | 1316] x [time | 358]
*

*>> Coordinates:
*

*>> ncl 84> printVarSummary(transsvRight)
*

*>>
*

*>>
*

*>> Variable: transsvRight
*

*>> Type: float
*

*>> Total Size: 5264 bytes
*

*>> 1316 values
*

*>> Number of Dimensions: 2
*

*>> Dimensions and sizes: [time | 1] x [space | 1316]
*

*>> Coordinates:
*

*>> Number Of Attributes: 1
*

*>> _FillValue : -999
*

*>> ncl 85> printVarSummary(transV)
*

*>>
*

*>>
*

*>> Variable: transV
*

*>> Type: float
*

*>> Total Size: 1884512 bytes
*

*>> 471128 values
*

*>> Number of Dimensions: 2
*

*>> Dimensions and sizes: [space | 1316] x [time | 358]
*

*>> Coordinates:
*

*>> Number Of Attributes: 1
*

*>> _FillValue : -999
*

*>>
*

*>> ----- Mensagem encaminhada de leonardo.silva@cptec.inpe.br -----
*

*>> Data: Tue, 15 Dec 2009 10:20:22 -0200
*

*>> De: leonardo.silva@cptec.inpe.br
*

*>> Endereço para Resposta (Reply-To): leonardo.silva@cptec.inpe.br
*

*>> Assunto: svdstd_sv doubt
*

*>> Para: ncl-talk@ucar.edu
*

*>>
*

*>> Hi all
*

*>>
*

*>> I'm trying to aplly a SVD on a covariance matrix to create a spatial
*

*>> pattern and a time series which represent the Atlantic Meridional
*

*>> Mode. I'm using SST and 10m wind.
*

*>>
*

*>> Is the svdstd_sv function suitable for that? The calculus done by the
*

*>> SVD of that function was made over the covariance matrix of the two
*

*>> fields?
*

*>>
*

*>> Regards
*

*>>
*

*>> Leonardo
*

*>>
*

*>>
*

*>>
*

*>> ----- Final da mensagem encaminhada -----
*

*>>
*

*>>
*

*>> _______________________________________________
*

*>> 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 Tue Dec 15 07:59:33 2009

*
This archive was generated by hypermail 2.1.8
: Thu Dec 17 2009 - 17:15:52 MST
*