compute_secondary_large_scale_diff.c

Go to the documentation of this file.
00001 /* ***************************************************** */
00002 /* Compute secondary large-scale field difference        */
00003 /* between value of learning field at analog date vs     */
00004 /* model field at downscaled date.                       */
00005 /* compute_secondary_large_scale_diff.c                  */
00006 /* ***************************************************** */
00007 /* Author: Christian Page, CERFACS, Toulouse, France.    */
00008 /* ***************************************************** */
00013 /* LICENSE BEGIN
00014 
00015 Copyright Cerfacs (Christian Page) (2015)
00016 
00017 christian.page@cerfacs.fr
00018 
00019 This software is a computer program whose purpose is to downscale climate
00020 scenarios using a statistical methodology based on weather regimes.
00021 
00022 This software is governed by the CeCILL license under French law and
00023 abiding by the rules of distribution of free software. You can use, 
00024 modify and/ or redistribute the software under the terms of the CeCILL
00025 license as circulated by CEA, CNRS and INRIA at the following URL
00026 "http://www.cecill.info". 
00027 
00028 As a counterpart to the access to the source code and rights to copy,
00029 modify and redistribute granted by the license, users are provided only
00030 with a limited warranty and the software's author, the holder of the
00031 economic rights, and the successive licensors have only limited
00032 liability. 
00033 
00034 In this respect, the user's attention is drawn to the risks associated
00035 with loading, using, modifying and/or developing or reproducing the
00036 software by the user in light of its specific status of free software,
00037 that may mean that it is complicated to manipulate, and that also
00038 therefore means that it is reserved for developers and experienced
00039 professionals having in-depth computer knowledge. Users are therefore
00040 encouraged to load and test the software's suitability as regards their
00041 requirements in conditions enabling the security of their systems and/or 
00042 data to be ensured and, more generally, to use and operate it in the 
00043 same conditions as regards security. 
00044 
00045 The fact that you are presently reading this means that you have had
00046 knowledge of the CeCILL license and that you accept its terms.
00047 
00048 LICENSE END */
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 #include <dsclim.h>
00057 
00059 void
00060 compute_secondary_large_scale_diff(double *delta, double **delta_dayschoice, analog_day_struct analog_days, double *sup_field_index,
00061                                    double *sup_field_index_learn, double sup_field_var, double sup_field_var_learn, int ntimes) {
00073   int t; /* Time loop counter */
00074   int ii; /* ndayschoice loop counter */
00075   //  double sup_diff; /**< Secondary large-scale field difference. */
00076   //  int count = 0;
00077 
00078   /* Process each downscaled day */
00079   for (t=0; t<ntimes; t++) {
00081     delta[t] = (sup_field_index[t] * sqrt(sup_field_var)) -
00082       (sup_field_index_learn[analog_days.tindex[t]] * sqrt(sup_field_var_learn));
00083     for (ii=0; ii<analog_days.ndayschoice[t]; ii++)
00084       delta_dayschoice[t][ii] = (sup_field_index[t] * sqrt(sup_field_var)) -
00085       (sup_field_index_learn[analog_days.tindex_dayschoice[t][ii]] * sqrt(sup_field_var_learn));
00086     
00087     //    if (fabs(sup_diff) > 2.0) {
00088     //      delta[t] = sup_diff;
00089       //      printf("%d %lf\n",t,delta[t]);
00090       //      count++;
00091     //    }
00092     //    else
00093     //      delta[t] = 0.0;
00094     //    if (t == (ntimes-1))
00095     //      printf("%d %lf %lf %lf %d %d %d\n",count,delta[t],sup_field_index[t],sup_field_index_learn[analog_days.tindex[t]],analog_days.year[t],analog_days.month[t],analog_days.day[t]);
00096 
00097   }
00098 }

Generated on 12 May 2016 for DSCLIM by  doxygen 1.6.1