dist_clusters_normctrl.c File Reference

Compute distances to clusters normalized by control run mean and variance. More...

#include <classif.h>
Include dependency graph for dist_clusters_normctrl.c:

Go to the source code of this file.

Functions

void dist_clusters_normctrl (double *dist_pc, double *pc, double *clusters, double *var_pc, double *var_pc_norm_all, double *mean_ctrl, double *var_ctrl, int neof, int nclust, int ntime)
 Compute distances to clusters normalized by control run mean and variance.

Detailed Description

Compute distances to clusters normalized by control run mean and variance.

Definition in file dist_clusters_normctrl.c.


Function Documentation

void dist_clusters_normctrl ( double *  dist_pc,
double *  pc,
double *  clusters,
double *  var_pc,
double *  var_pc_norm_all,
double *  mean_ctrl,
double *  var_ctrl,
int  neof,
int  nclust,
int  ntime 
)

Compute distances to clusters normalized by control run mean and variance.

Parameters:
[out] dist_pc Distances (normalized by control run mean and variance) of normalized EOF-projected large-scale field to clusters
[in] pc EOF-projected large-scale field
[in] clusters Cluster centroids for each EOF in EOF-projected space of the large-scale field
[in] var_pc Variance of EOF-projected large-scale field of the learning period, for each EOF separately.
[in] var_pc_norm_all Norm of the variance of the first EOF of the EOF-projected large-scale field of the control run.
[in] mean_ctrl Mean of the distances to clusters for the control run, for each cluster separately.
[in] var_ctrl Variance of the distances to clusters for the control run, for each cluster separately.
[in] neof EOF dimension
[in] nclust Clusters dimension
[in] ntime Time dimension

Definition at line 59 of file dist_clusters_normctrl.c.

Referenced by wt_downscaling(), and wt_learning().

00061                                                         {
00075   double sum;
00076   double val;
00077   
00078   int eof;
00079   int nt;
00080   int clust;
00081 
00082   for (clust=0; clust<nclust; clust++) {
00083     for (nt=0; nt<ntime; nt++) {
00084       sum = 0.0;
00085       for (eof=0; eof<neof; eof++) {
00086         val = (pc[nt+eof*ntime] / sqrt(var_pc_norm_all[eof])) - (clusters[eof+clust*neof] / sqrt(var_pc[eof]));
00087         sum += (val * val);
00088         //        if (nt == (ntime-5)) {
00089         //          printf("dist_val %d %d %d %lf %lf %lf %lf %lf\n",clust,nt,eof,val,pc[nt+eof*ntime],var_pc_norm_all[eof],clusters[eof+clust*neof],var_pc[eof]);
00090         //        }
00091       }
00092       dist_pc[nt+clust*ntime] = ( (sqrt(sum) - mean_ctrl[clust]) / sqrt(var_ctrl[clust]) );
00093       //      if (nt == (ntime -5))
00094       //        printf("dist_pc %d %d %lf %lf %lf %lf %lf\n",clust,nt,dist_pc[nt+clust*ntime],sqrt(sum),mean_ctrl[clust],var_ctrl[clust]);
00095       //    }
00096     }
00097   }
00098 }


Generated on 12 May 2016 for DSCLIM by  doxygen 1.6.1