Commit 9cc6d743 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

expr: cleanup

parent 61c1b2a5
......@@ -196,8 +196,22 @@ case "${HOSTNAME}" in
--with-netcdf=$HOME/PROJ \
CC=vcc CFLAGS="-O -Wv,-m3 -K4"
;;
# x86_64-unknown-linux-gnu (rhel55)
lizard*)
LDFLAGS="-Wl,-rpath=/sw/rhel55-x64/jasper-1.900.1/lib:/sw/rhel55-x64/hdf5-1.8.5-threadsafe/lib:/sw/rhel55-x64/szip-2.1/lib:/sw/rhel55-x64/netcdf-4.1.1/lib -lpng"
export LDFLAGS
${CONFPATH}configure --prefix=$HOME/local/rhel55-x64 \
--with-jasper=/sw/rhel55-x64/jasper-1.900.1 \
--with-grib_api=/sw/rhel55-x64/grib_api-1.9.0 \
--with-netcdf=/sw/rhel55-x64/netcdf-4.1.1 \
--with-hdf5=/sw/rhel55-x64/hdf5-1.8.5-threadsafe \
--with-szlib=/sw/rhel55-x64/szip-2.1 \
--with-zlib=/usr \
CC=gcc CFLAGS="-g -D_REENTRANT -Wall -O2"
;;
# powerpc-ibm-aix5.2.0.0
ecga*)
${CONFPATH}configure --prefix=$HOME/local \
--with-netcdf=/usr/local/apps/netCDF/3.6.2/LP64_underscore \
--with-szlib=$HOME/local \
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.64 for cdo 1.4.5.2.
# Generated by GNU Autoconf 2.64 for cdo 1.4.6rc1.
#
# Report bugs to <http://code.zmaw.de/projects/cdo>.
#
......@@ -549,8 +549,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='cdo'
PACKAGE_TARNAME='cdo'
PACKAGE_VERSION='1.4.5.2'
PACKAGE_STRING='cdo 1.4.5.2'
PACKAGE_VERSION='1.4.6rc1'
PACKAGE_STRING='cdo 1.4.6rc1'
PACKAGE_BUGREPORT='http://code.zmaw.de/projects/cdo'
PACKAGE_URL=''
......@@ -1316,7 +1316,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures cdo 1.4.5.2 to adapt to many kinds of systems.
\`configure' configures cdo 1.4.6rc1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1386,7 +1386,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of cdo 1.4.5.2:";;
short | recursive ) echo "Configuration of cdo 1.4.6rc1:";;
esac
cat <<\_ACEOF
......@@ -1578,7 +1578,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
cdo configure 1.4.5.2
cdo configure 1.4.6rc1
generated by GNU Autoconf 2.64
Copyright (C) 2009 Free Software Foundation, Inc.
......@@ -2006,7 +2006,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by cdo $as_me 1.4.5.2, which was
It was created by cdo $as_me 1.4.6rc1, which was
generated by GNU Autoconf 2.64. Invocation command line was
$ $0 $@
......@@ -2890,7 +2890,7 @@ fi
# Define the identity of the package.
PACKAGE='cdo'
VERSION='1.4.5.2'
VERSION='1.4.6rc1'
cat >>confdefs.h <<_ACEOF
......@@ -9312,7 +9312,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by cdo $as_me 1.4.5.2, which was
This file was extended by cdo $as_me 1.4.6rc1, which was
generated by GNU Autoconf 2.64. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -9376,7 +9376,7 @@ Report bugs to <http://code.zmaw.de/projects/cdo>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
cdo config.status 1.4.5.2
cdo config.status 1.4.6rc1
configured by $0, generated by GNU Autoconf 2.64,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
......
# Process this file with autoconf to produce a configure script.
AC_INIT([cdo], [1.4.5.2], [http://code.zmaw.de/projects/cdo])
AC_INIT([cdo], [1.4.6rc1], [http://code.zmaw.de/projects/cdo])
CONFIG_ABORT=yes
......
......@@ -92,7 +92,7 @@ int genGrid(int nfiles, ens_file_t *ef, int **gridindex, int igrid)
gridID = vlistGrid(ef[fileID].vlistID, igrid);
gridtype = gridInqType(gridID);
if ( !(gridtype == GRID_LONLAT || gridtype == GRID_GAUSSIAN ||
(gridtype == GRID_GENERIC && gridInqXsize(gridID) > 0 && gridInqYsize(gridID) > 0)) )
(gridtype == GRID_GENERIC && gridInqXsize(gridID) > 0 && gridInqYsize(gridID) > 0)) )
cdoAbort("Unsupported grid type: %s!", gridNamePtr(gridtype));
if ( xsize == 0 ) xsize = gridInqXsize(gridID);
......@@ -111,20 +111,20 @@ int genGrid(int nfiles, ens_file_t *ef, int **gridindex, int igrid)
xyinfo[fileID].y = yvals[fileID][0];
xyinfo[fileID].id = fileID;
}
/*
for ( fileID = 0; fileID < nfiles; fileID++ )
printf("1 %d %g %g \n", xyinfo[fileID].id, xyinfo[fileID].x, xyinfo[fileID].y);
*/
qsort(xyinfo, nfiles, sizeof(xyinfo_t), cmpx);
/*
for ( fileID = 0; fileID < nfiles; fileID++ )
printf("2 %d %g %g \n", xyinfo[fileID].id, xyinfo[fileID].x, xyinfo[fileID].y);
*/
qsort(xyinfo, nfiles, sizeof(xyinfo_t), cmpxy);
/*
for ( fileID = 0; fileID < nfiles; fileID++ )
printf("3 %d %g %g \n", xyinfo[fileID].id, xyinfo[fileID].x, xyinfo[fileID].y);
*/
nx = 1;
for ( fileID = 1; fileID < nfiles; fileID++ )
{
......
......@@ -12,16 +12,14 @@
#include "expr_yacc.h"
#define UMISS(func, oper) fprintf(stderr, "Internal problem in %s: missing value support not implemented for operation '%c'!\n", func, oper);
typedef struct {
int type;
char *name; /* function name */
double (*func)(double); /* pointer to function */
}
FUNC;
func_t;
static FUNC fun_sym_tbl[] =
static func_t fun_sym_tbl[] =
{
/* scalar functions */
{0, "sqrt", sqrt},
......@@ -76,8 +74,8 @@ nodeType *expr_con_var(int oper, nodeType *p1, nodeType *p2)
{
static char func[] = "expr_con_var";
nodeType *p;
int ngp, i;
int nlev, k;
long ngp, i;
long nlev;
int nmiss;
int gridID, zaxisID;
double missval1, missval2;
......@@ -107,64 +105,55 @@ nodeType *expr_con_var(int oper, nodeType *p1, nodeType *p2)
case '+':
if ( nmiss > 0 )
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = ADD(p1->u.con.value, p2->data[i+k*ngp]);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = ADD(p1->u.con.value, p2->data[i]);
}
else
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = p1->u.con.value + p2->data[i+k*ngp];
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = p1->u.con.value + p2->data[i];
}
break;
case '-':
if ( nmiss > 0 )
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = SUB(p1->u.con.value, p2->data[i+k*ngp]);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = SUB(p1->u.con.value, p2->data[i]);
}
else
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = p1->u.con.value - p2->data[i+k*ngp];
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = p1->u.con.value - p2->data[i];
}
break;
case '*':
if ( nmiss > 0 )
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = MUL(p1->u.con.value, p2->data[i+k*ngp]);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = MUL(p1->u.con.value, p2->data[i]);
}
else
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = p1->u.con.value * p2->data[i+k*ngp];
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = p1->u.con.value * p2->data[i];
}
break;
case '/':
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = DIV(p1->u.con.value, p2->data[i+k*ngp]);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = DIV(p1->u.con.value, p2->data[i]);
}
break;
case '^':
if ( nmiss > 0 )
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = POW(p1->u.con.value, p2->data[i+k*ngp]);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = POW(p1->u.con.value, p2->data[i]);
}
else
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = pow(p1->u.con.value, p2->data[i+k*ngp]);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = pow(p1->u.con.value, p2->data[i]);
}
break;
default:
......@@ -172,9 +161,8 @@ nodeType *expr_con_var(int oper, nodeType *p1, nodeType *p2)
}
nmiss = 0;
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
if ( DBL_IS_EQUAL(p->data[i+k*ngp], missval1) ) nmiss++;
for ( i = 0; i < ngp*nlev; i++ )
if ( DBL_IS_EQUAL(p->data[i], missval1) ) nmiss++;
p->nmiss = nmiss;
......@@ -188,8 +176,8 @@ nodeType *expr_var_con(int oper, nodeType *p1, nodeType *p2)
{
static char func[] = "expr_var_con";
nodeType *p;
int ngp, i;
int nlev, k;
long ngp, i;
long nlev;
int nmiss;
int gridID, zaxisID;
double missval1, missval2;
......@@ -219,71 +207,61 @@ nodeType *expr_var_con(int oper, nodeType *p1, nodeType *p2)
case '+':
if ( nmiss > 0 )
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = ADD(p1->data[i+k*ngp], p2->u.con.value);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = ADD(p1->data[i], p2->u.con.value);
}
else
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = p1->data[i+k*ngp] + p2->u.con.value;
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = p1->data[i] + p2->u.con.value;
}
break;
case '-':
if ( nmiss > 0 )
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = SUB(p1->data[i+k*ngp], p2->u.con.value);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = SUB(p1->data[i], p2->u.con.value);
}
else
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = p1->data[i+k*ngp] - p2->u.con.value;
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = p1->data[i] - p2->u.con.value;
}
break;
case '*':
if ( nmiss > 0 )
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = MUL(p1->data[i+k*ngp], p2->u.con.value);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = MUL(p1->data[i], p2->u.con.value);
}
else
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = p1->data[i+k*ngp] * p2->u.con.value;
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = p1->data[i] * p2->u.con.value;
}
break;
case '/':
if ( nmiss > 0 || IS_EQUAL(p2->u.con.value, 0) )
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = DIV(p1->data[i+k*ngp], p2->u.con.value);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = DIV(p1->data[i], p2->u.con.value);
}
else
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = p1->data[i+k*ngp] / p2->u.con.value;
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = p1->data[i] / p2->u.con.value;
}
break;
case '^':
if ( nmiss > 0 )
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = POW(p1->data[i+k*ngp], p2->u.con.value);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = POW(p1->data[i], p2->u.con.value);
}
else
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = pow(p1->data[i+k*ngp], p2->u.con.value);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = pow(p1->data[i], p2->u.con.value);
}
break;
default:
......@@ -291,9 +269,8 @@ nodeType *expr_var_con(int oper, nodeType *p1, nodeType *p2)
}
nmiss = 0;
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
if ( DBL_IS_EQUAL(p->data[i+k*ngp], missval1) ) nmiss++;
for ( i = 0; i < ngp*nlev; i++ )
if ( DBL_IS_EQUAL(p->data[i], missval1) ) nmiss++;
p->nmiss = nmiss;
......@@ -307,9 +284,9 @@ nodeType *expr_var_var(int oper, nodeType *p1, nodeType *p2)
{
static char func[] = "expr_var_var";
nodeType *p;
int ngp, ngp1, ngp2, i;
int nlev, nlev1, nlev2, k;
int loff1, loff2;
long ngp, ngp1, ngp2, i;
long nlev, nlev1, nlev2, k;
long loff1, loff2;
int nmiss, nmiss1, nmiss2;
double missval1, missval2;
......@@ -437,9 +414,8 @@ nodeType *expr_var_var(int oper, nodeType *p1, nodeType *p2)
}
nmiss = 0;
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
if ( DBL_IS_EQUAL(p->data[i+k*ngp], missval1) ) nmiss++;
for ( i = 0; i < ngp*nlev; i++ )
if ( DBL_IS_EQUAL(p->data[i], missval1) ) nmiss++;
p->nmiss = nmiss;
......@@ -452,8 +428,8 @@ nodeType *expr_var_var(int oper, nodeType *p1, nodeType *p2)
static
void ex_copy(nodeType *p2, nodeType *p1)
{
int ngp, ngp1, ngp2, i;
int nlev, k;
long ngp, ngp1, ngp2, i;
long nlev;
if ( cdoVerbose )
printf("\tcopy %s\n", p1->u.var.nm);
......@@ -464,9 +440,8 @@ void ex_copy(nodeType *p2, nodeType *p1)
ngp = ngp2;
nlev = zaxisInqSize(p2->zaxisID);
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p2->data[i+k*ngp] = p1->data[i+k*ngp];
for ( i = 0; i < ngp*nlev; i++ )
p2->data[i] = p1->data[i];
p2->missval = p1->missval;
p2->nmiss = p1->nmiss;
......@@ -540,8 +515,8 @@ nodeType *ex_fun_var(char *fun, nodeType *p1)
{
static char func[] = "ex_fun_var";
nodeType *p;
int ngp, i;
int nlev, k;
long ngp, i;
long nlev;
int gridID, zaxisID;
int funcID = -1;
int nmiss;
......@@ -578,29 +553,26 @@ nodeType *ex_fun_var(char *fun, nodeType *p1)
if ( nmiss > 0 )
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
{
errno = -1;
p->data[i+k*ngp] = DBL_IS_EQUAL(p1->data[i+k*ngp], missval) ? missval : fun_sym_tbl[funcID].func(p1->data[i+k*ngp]);
if ( errno == EDOM || errno == ERANGE ) p->data[i+k*ngp] = missval;
}
for ( i = 0; i < ngp*nlev; i++ )
{
errno = -1;
p->data[i] = DBL_IS_EQUAL(p1->data[i], missval) ? missval : fun_sym_tbl[funcID].func(p1->data[i]);
if ( errno == EDOM || errno == ERANGE ) p->data[i] = missval;
}
}
else
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
{
errno = -1;
p->data[i+k*ngp] = fun_sym_tbl[funcID].func(p1->data[i+k*ngp]);
if ( errno == EDOM || errno == ERANGE ) p->data[i+k*ngp] = missval;
}
for ( i = 0; i < ngp*nlev; i++ )
{
errno = -1;
p->data[i] = fun_sym_tbl[funcID].func(p1->data[i]);
if ( errno == EDOM || errno == ERANGE ) p->data[i] = missval;
}
}
nmiss = 0;
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
if ( DBL_IS_EQUAL(p->data[i+k*ngp], missval) ) nmiss++;
for ( i = 0; i < ngp*nlev; i++ )
if ( DBL_IS_EQUAL(p->data[i], missval) ) nmiss++;
p->nmiss = nmiss;
......@@ -635,8 +607,8 @@ nodeType *ex_uminus_var(nodeType *p1)
{
static char func[] = "ex_uminus_var";
nodeType *p;
int ngp, i;
int nlev, k;
long ngp, i;
long nlev;
int nmiss;
int gridID, zaxisID;
double missval;
......@@ -662,15 +634,13 @@ nodeType *ex_uminus_var(nodeType *p1)
if ( nmiss > 0 )
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = DBL_IS_EQUAL(p1->data[i+k*ngp], missval) ? missval : -(p1->data[i+k*ngp]);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = DBL_IS_EQUAL(p1->data[i], missval) ? missval : -(p1->data[i]);
}
else
{
for ( k = 0; k < nlev; k++ )
for ( i = 0; i < ngp; i++ )
p->data[i+k*ngp] = -(p1->data[i+k*ngp]);
for ( i = 0; i < ngp*nlev; i++ )
p->data[i] = -(p1->data[i]);
}
p->nmiss = nmiss;
......
......@@ -68,7 +68,7 @@ char *getOperator(const char *argument)
char *operatorAlias(char *operatorName);
char *getOperatorName(char *operatorArg)
char *getOperatorName(const char *operatorArg)
{
static char func[] = "getOperatorName";
char *commapos;
......@@ -146,6 +146,7 @@ char *getFileArg(char *argument)
return (fileArg);
}
void input_int(char *arg, int intarr[], int maxint, int *nintfound)
{
int nint = 0;
......
......@@ -20,7 +20,7 @@
char *getProgname(char *string);
char *getOperator(const char *argument);
char *getOperatorName(char *xoperator);
char *getOperatorName(const char *xoperator);
char *makeArgument(int argc, char *argv[]);
char *getFileArg(char *argument);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment