Hi Marjolaine,

On Tue, Feb 10, 2009 at 12:31 PM, Marjolaine Rouault <mroua...@csir.co.za>wrote:

> Hi,
>
> I am struggling to do a PCA analysis on a masked array. Anybody has
> suggestions on how to deal with masked array when doing PCAs?



You need to remove missing values at each time step.
This means that your missing data are always at the same place.
Maybe something like this can work :

# Let's say we analyse myfullvar(nt,ny,nx)
mask = myfullvar[0]
ns = numpy.count(~mask)
myvar = numpy.zeros(nt,ns)
for it in xrange(nt):
  myvar[it] = myfullvar[it].compressed()

# Then you make a PCA decomposition of myvar and you get back your EOFs
myeofs(neof,ns)
myfulleofs = numpy.ma.zeros(neof,ny,nx)+numpy.ma.masked
for ieof in xrange(neof):
  myfulleofs[~mask.flat] = myeofs[ieof]



>
> Best regards, Marjolaine.
>
>
>
> --
> This message is subject to the CSIR's copyright terms and conditions,
> e-mail legal notice, and implemented Open Document Format (ODF) standard.
> The full disclaimer details can be found at
> http://www.csir.co.za/disclaimer.html.
>
> This message has been scanned for viruses and dangerous content by
> MailScanner,
> and is believed to be clean.  MailScanner thanks Transtec Computers for
> their support.
>
>
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with
> Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code
> to
> build responsive, highly engaging applications that combine the power of
> local
> resources and data with the reach of the web. Download the Adobe AIR SDK
> and
> Ajax docs to start building applications today-
> http://p.sf.net/sfu/adobe-com
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>



-- 
Stephane Raynaud
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to