~javier-lopez/ubuntu/quantal/cdo/sru-1023329

« back to all changes in this revision

Viewing changes to src/percentiles.c

  • Committer: Bazaar Package Importer
  • Author(s): Alastair McKinstry
  • Date: 2010-09-22 15:58:09 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100922155809-u1d3vlmlqj02uxjt
Tags: 1.4.6.dfsg.1-1
New upstream release. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include <stdlib.h>
20
20
#include <math.h>
21
21
 
22
 
#include "cdi.h"
 
22
#include <cdi.h>
23
23
#include "cdo.h"
24
24
#include "cdo_int.h"
25
25
#include "nth_element.h"
71
71
 
72
72
static void histBin(HISTOGRAM *hist)
73
73
{
74
 
  static const char func[] = "histBin";
 
74
  static const char *func = "histBin";
75
75
  int i;
76
76
  double *values;
77
77
  
121
121
}
122
122
 
123
123
 
124
 
static double histGetPercentile(const HISTOGRAM *hist, int p)
 
124
static double histGetPercentile(const HISTOGRAM *hist, double p)
125
125
{
126
126
  double s, t;
127
127
  int i = 0, count = 0;
129
129
  assert( hist != NULL );
130
130
  assert( hist->nsamp > 0 );
131
131
  assert( hist->nbins > 0 );
132
 
  assert( p > 0 );
133
 
  assert( p < 100 );
 
132
  assert( p >= 0 );
 
133
  assert( p <= 100 );
134
134
  
135
135
  s = hist->nsamp * (p / 100.0);
136
136
  
155
155
 
156
156
HISTOGRAM_SET *hsetCreate(int nvars)
157
157
{
158
 
  static const char func[] = "hsetCreate";
 
158
  static const char *func = "hsetCreate";
159
159
  int varID;
160
160
  HISTOGRAM_SET *hset;
161
161
  
185
185
 
186
186
void hsetCreateVarLevels(HISTOGRAM_SET *hset, int varID, int nlevels, int grid)
187
187
{
188
 
  static const char func[] = "hsetCreateVarLevels";
 
188
  static const char *func = "hsetCreateVarLevels";
189
189
  int nvars, nhists, nbins, levelID, histID;
190
190
  HISTOGRAM *hists;
191
191
  
237
237
 
238
238
void hsetDestroy(HISTOGRAM_SET *hset)
239
239
{
240
 
  static const char func[] = "hsetDestroy";
 
240
  static const char *func = "hsetDestroy";
241
241
  int varID, levelID, histID, nhists;
242
242
  
243
243
  if ( hset != NULL )
266
266
 
267
267
void hsetDefVarLevelBounds(HISTOGRAM_SET *hset, int varID, int levelID, const field_t *field1, const field_t *field2)
268
268
{
269
 
  static const char func[] = "hsetDefVarLevelBounds";
 
269
  static const char *func = "hsetDefVarLevelBounds";
270
270
  const double *array1 = field1->ptr;
271
271
  const double *array2 = field2->ptr;
272
272
  
322
322
 
323
323
void hsetAddVarLevelValues(HISTOGRAM_SET *hset, int varID, int levelID, const field_t *field)
324
324
{
325
 
  static const char func[] = "hsetAddVarLevelValues";
 
325
  static const char *func = "hsetAddVarLevelValues";
326
326
  const double *array = field->ptr;
327
327
  int i, grid, nvars, nlevels, nhists, nign = 0;
328
328
  HISTOGRAM *hists;
374
374
}
375
375
 
376
376
 
377
 
void hsetGetVarLevelPercentiles(field_t *field, const HISTOGRAM_SET *hset, int varID, int levelID, int p)
 
377
void hsetGetVarLevelPercentiles(field_t *field, const HISTOGRAM_SET *hset, int varID, int levelID, double p)
378
378
{
379
 
  static const char func[] = "hsetGetVarLevelPercentiles";
 
379
  static const char *func = "hsetGetVarLevelPercentiles";
380
380
  double *array = field->ptr;
381
381
  int i, nvars, nlevels, nhists, grid;
382
382
  HISTOGRAM *hists;