cdo.h 3.75 KB
Newer Older
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1
2
3
4
/*
  This file is part of CDO. CDO is a collection of Operators to
  manipulate and analyse Climate model Data.

Uwe Schulzweida's avatar
Uwe Schulzweida committed
5
  Copyright (C) 2003-2012 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
Uwe Schulzweida's avatar
Uwe Schulzweida committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  See COPYING file for copying and redistribution conditions.

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; version 2 of the License.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
*/

#ifndef _CDO_H
#define _CDO_H

#include <stdio.h>
#include "dmemory.h"

#undef   TRUE
#define  TRUE   1
#undef   FALSE
#define  FALSE  0

#undef   MIN
#define  MIN(a,b)  ((a) < (b) ? (a) : (b))
#undef   MAX
#define  MAX(a,b)  ((a) > (b) ? (a) : (b))
#undef   NINT
#define  NINT(x)   ((x) < 0 ? (int)((x)-0.5) : (int)((x)+0.5))

36
#define  UNCHANGED_RECORD  (processSelf() == 0 && *cdoStreamName(0) != '-' && cdoRegulargrid == FALSE && cdoDefaultDataType == -1 && cdoDefaultByteorder == -1 )
Uwe Schulzweida's avatar
Uwe Schulzweida committed
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53


typedef struct {
  int      argc;
  char   **argv;
}
ARGUMENT;


extern int ompNumThreads;

extern int cdoDefaultFileType;
extern int cdoDefaultDataType;
extern int cdoDefaultByteorder;
extern int cdoDefaultTableID;
extern int cdoDefaultInstID;

54
55
extern int cdoCheckDatarange;

56
extern int cdoSilentMode;
57
extern int cdoOverwriteMode;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
58
59
60
61
62
extern int cdoRegulargrid;
extern int cdoBenchmark;
extern int cdoTimer;
extern int cdoVerbose;
extern int cdoDebug;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
63
extern int cdoCompress;
64
extern int cdoInteractive;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
65
extern int cdoParIO;
Uwe Schulzweida's avatar
Uwe Schulzweida committed
66

Uwe Schulzweida's avatar
Uwe Schulzweida committed
67
68
extern int cdoCompType;
extern int cdoCompLevel;
69

Uwe Schulzweida's avatar
Uwe Schulzweida committed
70
71
extern int cdoExpMode;

Uwe Schulzweida's avatar
Uwe Schulzweida committed
72
extern int cdoDiag;
73

Uwe Schulzweida's avatar
Uwe Schulzweida committed
74
75
76
77
78
void    cdiError(int cdiErrno, const char *fmt, ...);
void    cdoAbort(const char *fmt, ...);
void    cdoWarning(const char *fmt, ...);
void    cdoPrint(const char *fmt, ...);

Uwe Schulzweida's avatar
Uwe Schulzweida committed
79
int  timer_new(const char *text);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
80
81
82
void timer_report(void);
void timer_start(int it);
void timer_stop(int it);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
83
double timer_val(int it);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
84
85
86
87
88
89
90
91
92
93
94

void    operatorInputArg(const char *enter);
int     operatorArgc(void);
char  **operatorArgv(void);
void    operatorCheckArgc(int numargs);

const char *cdoStreamName(int cnt);

void    cdoInitialize(void *argument);
void    cdoFinish(void);

Uwe Schulzweida's avatar
Uwe Schulzweida committed
95
int     cdoStreamNumber(void);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
96
97
98
int     cdoStreamCnt(void);
int     cdoOperatorAdd(const char *name, int func, int intval, const char *enter);
int     cdoOperatorID(void);
99
100
int     cdoOperatorF1(int operID);
int     cdoOperatorF2(int operID);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
101
102
103
104
105
106
107
108
109
110
111
const char *cdoOperatorName(int operID);
const char *cdoOperatorEnter(int operID);

int     cdoFiletype(void);

void    cdoInqHistory(int fileID);
void    cdoDefHistory(int fileID, char *histstring);

int     cdoDefineGrid(const char *gridfile);
int     cdoDefineZaxis(const char *zaxisfile);

112
int     vlistIsSzipped(int vlistID);
113
void cdoGenFileSuffix(char *filesuffix, size_t maxlen, int filetype, int vlistID);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
114

115
int  gridWeights(int gridID, double *weights);
116
int  gridGenArea(int gridID, double *area);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
117
void gaussaw(double pa[], double pw[], int nlat);
118
119
120
121
void genXbounds(long xsize, long ysize, const double * restrict grid_center_lon, 
		double * restrict grid_corner_lon, double dlon);
void genYbounds(long xsize, long ysize, const double * restrict grid_center_lat,
		double * restrict grid_corner_lat);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
122
123
124
125
126
127
128
void writeNCgrid(const char *gridfile, int gridID, int *imask);
void defineZaxis(const char *zaxisarg);
void cdiDefTableID(int tableID);
void gridGenXvals(int xsize, double xfirst, double xlast, double xinc, double *xvals);
void gridGenYvals(int gridtype, int ysize, double yfirst, double ylast, double yinc, double *yvals);

int gridFromName(const char *gridname);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
129
int zaxisFromName(const char *zaxisname);
Uwe Schulzweida's avatar
Uwe Schulzweida committed
130
131

#endif  /* _CDO_H */