Commit cff1cbc3 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

add cdologs

parent a93f0487
......@@ -190,6 +190,7 @@ src/Intntime.c -text
src/Inttime.c -text
src/Intyear.c -text
src/Invert.c -text
src/Log.c -text
src/Makefile.am -text
src/Makefile.in -text
src/Maskbox.c -text
......
......@@ -106,7 +106,7 @@ static int flt2ibm(float x, unsigned char *ibm) {
int sign, exp, i;
double mant;
if ( DBL_IS_EQUAL(x, 0) ) {
if ( !(fabs((double)x) > 0) ) {
ibm[0] = ibm[1] = ibm[2] = ibm[3] = 0;
return 0;
}
......@@ -276,7 +276,7 @@ void *Gradsdes(void *argument)
cdoInitialize(argument);
GRADSDES1 = cdoOperatorAdd("gradsdes1", 0, 0, NULL);
GRADSDES1 = cdoOperatorAdd("gradsdes1", 0, 0, NULL);
GRADSDES2 = cdoOperatorAdd("gradsdes2", 0, 0, NULL);
DUMPMAP = cdoOperatorAdd("dumpmap", 0, 0, NULL);
......
/*
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C) 2003-2006 Uwe Schulzweida, schulzweida@dkrz.de
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.
*/
#include "cdo.h"
#include "cdo_int.h"
void dumplogs(const char *logfilename);
void *Log(void *argument)
{
int DUMPLOGS;
int operatorID;
cdoInitialize(argument);
DUMPLOGS = cdoOperatorAdd("dumplogs", 0, 0, NULL);
operatorID = cdoOperatorID();
if ( cdoStreamName(0)[0] == '-' )
cdoAbort("This operator does not work with pipes!");
if ( operatorID == DUMPLOGS )
{
dumplogs(cdoStreamName(0));
}
cdoFinish();
return (0);
}
......@@ -34,6 +34,7 @@ cdo_SOURCES = Arith.c \
Intntime.c \
Intyear.c \
Invert.c \
Log.c \
Maskbox.c \
Mastrfu.c \
Math.c \
......
......@@ -114,6 +114,7 @@ cdo_SOURCES = Arith.c \
Intntime.c \
Intyear.c \
Invert.c \
Log.c \
Maskbox.c \
Mastrfu.c \
Math.c \
......@@ -285,46 +286,46 @@ am_cdo_OBJECTS = Arith.$(OBJEXT) Arithc.$(OBJEXT) Arithdays.$(OBJEXT) \
Histogram.$(OBJEXT) Info.$(OBJEXT) Input.$(OBJEXT) \
Intgrid.$(OBJEXT) Intgridtraj.$(OBJEXT) Inttime.$(OBJEXT) \
Intntime.$(OBJEXT) Intyear.$(OBJEXT) Invert.$(OBJEXT) \
Maskbox.$(OBJEXT) Mastrfu.$(OBJEXT) Math.$(OBJEXT) \
Merge.$(OBJEXT) Mergegrid.$(OBJEXT) Mergetime.$(OBJEXT) \
Merstat.$(OBJEXT) Mrotuv.$(OBJEXT) Ninfo.$(OBJEXT) \
Nmltest.$(OBJEXT) Output.$(OBJEXT) Outputgmt.$(OBJEXT) \
Pinfo.$(OBJEXT) Remap.$(OBJEXT) Replace.$(OBJEXT) \
Rotuv.$(OBJEXT) Runpctl.$(OBJEXT) Runstat.$(OBJEXT) \
Seaspctl.$(OBJEXT) Seasstat.$(OBJEXT) Selbox.$(OBJEXT) \
Select.$(OBJEXT) Seloperator.$(OBJEXT) Selrec.$(OBJEXT) \
Selpctl.$(OBJEXT) Selstat.$(OBJEXT) Seltime.$(OBJEXT) \
Set.$(OBJEXT) Setbox.$(OBJEXT) Setgatt.$(OBJEXT) \
Setgrid.$(OBJEXT) Sethalo.$(OBJEXT) Setmiss.$(OBJEXT) \
Setrcaname.$(OBJEXT) Settime.$(OBJEXT) Setzaxis.$(OBJEXT) \
Showinfo.$(OBJEXT) Sinfo.$(OBJEXT) Sort.$(OBJEXT) \
Specinfo.$(OBJEXT) Spectral.$(OBJEXT) Split.$(OBJEXT) \
Splitrec.$(OBJEXT) Splittime.$(OBJEXT) Splityear.$(OBJEXT) \
Subtrend.$(OBJEXT) Templates.$(OBJEXT) Test.$(OBJEXT) \
Timpctl.$(OBJEXT) Timsort.$(OBJEXT) Timstat.$(OBJEXT) \
Trend.$(OBJEXT) Trms.$(OBJEXT) Vardup.$(OBJEXT) \
Vargen.$(OBJEXT) Varrms.$(OBJEXT) Vertint.$(OBJEXT) \
Vertstat.$(OBJEXT) Wind.$(OBJEXT) Writegrid.$(OBJEXT) \
Writerandom.$(OBJEXT) Ydaypctl.$(OBJEXT) Ydaystat.$(OBJEXT) \
Ydrunpctl.$(OBJEXT) Ydrunstat.$(OBJEXT) Ymonarith.$(OBJEXT) \
Ymonpctl.$(OBJEXT) Ymonstat.$(OBJEXT) Yseaspctl.$(OBJEXT) \
Yseasstat.$(OBJEXT) Zonstat.$(OBJEXT) cdilib.$(OBJEXT) \
commandline.$(OBJEXT) exception.$(OBJEXT) expr_yacc.$(OBJEXT) \
expr_lex.$(OBJEXT) expr.$(OBJEXT) cdo.$(OBJEXT) \
cdo_pthread.$(OBJEXT) cdo_vlist.$(OBJEXT) field.$(OBJEXT) \
fieldc.$(OBJEXT) field2.$(OBJEXT) fieldmer.$(OBJEXT) \
fieldzon.$(OBJEXT) grid.$(OBJEXT) history.$(OBJEXT) \
institution.$(OBJEXT) interpol.$(OBJEXT) job.$(OBJEXT) \
modules.$(OBJEXT) namelist.$(OBJEXT) normal.$(OBJEXT) \
pipe.$(OBJEXT) process.$(OBJEXT) remaplib.$(OBJEXT) \
timer.$(OBJEXT) realtime.$(OBJEXT) pstream.$(OBJEXT) \
table.$(OBJEXT) userlog.$(OBJEXT) util.$(OBJEXT) \
legendre.$(OBJEXT) fourier.$(OBJEXT) specspace.$(OBJEXT) \
readline.$(OBJEXT) julian.$(OBJEXT) vinterp.$(OBJEXT) \
zaxis.$(OBJEXT) pthread_debug.$(OBJEXT) color.$(OBJEXT) \
list.$(OBJEXT) percentiles.$(OBJEXT) nth_element.$(OBJEXT) \
eca.$(OBJEXT) ecautil.$(OBJEXT) EcaOperators.$(OBJEXT) \
Hi.$(OBJEXT) Tchill.$(OBJEXT)
Log.$(OBJEXT) Maskbox.$(OBJEXT) Mastrfu.$(OBJEXT) \
Math.$(OBJEXT) Merge.$(OBJEXT) Mergegrid.$(OBJEXT) \
Mergetime.$(OBJEXT) Merstat.$(OBJEXT) Mrotuv.$(OBJEXT) \
Ninfo.$(OBJEXT) Nmltest.$(OBJEXT) Output.$(OBJEXT) \
Outputgmt.$(OBJEXT) Pinfo.$(OBJEXT) Remap.$(OBJEXT) \
Replace.$(OBJEXT) Rotuv.$(OBJEXT) Runpctl.$(OBJEXT) \
Runstat.$(OBJEXT) Seaspctl.$(OBJEXT) Seasstat.$(OBJEXT) \
Selbox.$(OBJEXT) Select.$(OBJEXT) Seloperator.$(OBJEXT) \
Selrec.$(OBJEXT) Selpctl.$(OBJEXT) Selstat.$(OBJEXT) \
Seltime.$(OBJEXT) Set.$(OBJEXT) Setbox.$(OBJEXT) \
Setgatt.$(OBJEXT) Setgrid.$(OBJEXT) Sethalo.$(OBJEXT) \
Setmiss.$(OBJEXT) Setrcaname.$(OBJEXT) Settime.$(OBJEXT) \
Setzaxis.$(OBJEXT) Showinfo.$(OBJEXT) Sinfo.$(OBJEXT) \
Sort.$(OBJEXT) Specinfo.$(OBJEXT) Spectral.$(OBJEXT) \
Split.$(OBJEXT) Splitrec.$(OBJEXT) Splittime.$(OBJEXT) \
Splityear.$(OBJEXT) Subtrend.$(OBJEXT) Templates.$(OBJEXT) \
Test.$(OBJEXT) Timpctl.$(OBJEXT) Timsort.$(OBJEXT) \
Timstat.$(OBJEXT) Trend.$(OBJEXT) Trms.$(OBJEXT) \
Vardup.$(OBJEXT) Vargen.$(OBJEXT) Varrms.$(OBJEXT) \
Vertint.$(OBJEXT) Vertstat.$(OBJEXT) Wind.$(OBJEXT) \
Writegrid.$(OBJEXT) Writerandom.$(OBJEXT) Ydaypctl.$(OBJEXT) \
Ydaystat.$(OBJEXT) Ydrunpctl.$(OBJEXT) Ydrunstat.$(OBJEXT) \
Ymonarith.$(OBJEXT) Ymonpctl.$(OBJEXT) Ymonstat.$(OBJEXT) \
Yseaspctl.$(OBJEXT) Yseasstat.$(OBJEXT) Zonstat.$(OBJEXT) \
cdilib.$(OBJEXT) commandline.$(OBJEXT) exception.$(OBJEXT) \
expr_yacc.$(OBJEXT) expr_lex.$(OBJEXT) expr.$(OBJEXT) \
cdo.$(OBJEXT) cdo_pthread.$(OBJEXT) cdo_vlist.$(OBJEXT) \
field.$(OBJEXT) fieldc.$(OBJEXT) field2.$(OBJEXT) \
fieldmer.$(OBJEXT) fieldzon.$(OBJEXT) grid.$(OBJEXT) \
history.$(OBJEXT) institution.$(OBJEXT) interpol.$(OBJEXT) \
job.$(OBJEXT) modules.$(OBJEXT) namelist.$(OBJEXT) \
normal.$(OBJEXT) pipe.$(OBJEXT) process.$(OBJEXT) \
remaplib.$(OBJEXT) timer.$(OBJEXT) realtime.$(OBJEXT) \
pstream.$(OBJEXT) table.$(OBJEXT) userlog.$(OBJEXT) \
util.$(OBJEXT) legendre.$(OBJEXT) fourier.$(OBJEXT) \
specspace.$(OBJEXT) readline.$(OBJEXT) julian.$(OBJEXT) \
vinterp.$(OBJEXT) zaxis.$(OBJEXT) pthread_debug.$(OBJEXT) \
color.$(OBJEXT) list.$(OBJEXT) percentiles.$(OBJEXT) \
nth_element.$(OBJEXT) eca.$(OBJEXT) ecautil.$(OBJEXT) \
EcaOperators.$(OBJEXT) Hi.$(OBJEXT) Tchill.$(OBJEXT)
cdo_OBJECTS = $(am_cdo_OBJECTS)
cdo_DEPENDENCIES =
cdo_LDFLAGS =
......@@ -352,57 +353,58 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/Intgrid.Po ./$(DEPDIR)/Intgridtraj.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Intntime.Po ./$(DEPDIR)/Inttime.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Intyear.Po ./$(DEPDIR)/Invert.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Maskbox.Po ./$(DEPDIR)/Mastrfu.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Math.Po ./$(DEPDIR)/Merge.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Mergegrid.Po ./$(DEPDIR)/Mergetime.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Merstat.Po ./$(DEPDIR)/Mrotuv.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Ninfo.Po ./$(DEPDIR)/Nmltest.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Output.Po ./$(DEPDIR)/Outputgmt.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Pinfo.Po ./$(DEPDIR)/Remap.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Replace.Po ./$(DEPDIR)/Rotuv.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Runpctl.Po ./$(DEPDIR)/Runstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Seaspctl.Po ./$(DEPDIR)/Seasstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Selbox.Po ./$(DEPDIR)/Select.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Seloperator.Po ./$(DEPDIR)/Selpctl.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Selrec.Po ./$(DEPDIR)/Selstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Seltime.Po ./$(DEPDIR)/Set.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Setbox.Po ./$(DEPDIR)/Setgatt.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Setgrid.Po ./$(DEPDIR)/Sethalo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Setmiss.Po ./$(DEPDIR)/Setrcaname.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Settime.Po ./$(DEPDIR)/Setzaxis.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Showinfo.Po ./$(DEPDIR)/Sinfo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Sort.Po ./$(DEPDIR)/Specinfo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Spectral.Po ./$(DEPDIR)/Split.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Splitrec.Po ./$(DEPDIR)/Splittime.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Splityear.Po ./$(DEPDIR)/Subtrend.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Tchill.Po ./$(DEPDIR)/Templates.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Test.Po ./$(DEPDIR)/Timpctl.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Timsort.Po ./$(DEPDIR)/Timstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Trend.Po ./$(DEPDIR)/Trms.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Vardup.Po ./$(DEPDIR)/Vargen.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Varrms.Po ./$(DEPDIR)/Vertint.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Vertstat.Po ./$(DEPDIR)/Wind.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Writegrid.Po ./$(DEPDIR)/Writerandom.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Ydaypctl.Po ./$(DEPDIR)/Ydaystat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Ydrunpctl.Po ./$(DEPDIR)/Ydrunstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Ymonarith.Po ./$(DEPDIR)/Ymonpctl.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Ymonstat.Po ./$(DEPDIR)/Yseaspctl.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Yseasstat.Po ./$(DEPDIR)/Zonstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/cdilib.Po ./$(DEPDIR)/cdo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/cdo_pthread.Po ./$(DEPDIR)/cdo_vlist.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/color.Po ./$(DEPDIR)/commandline.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/eca.Po ./$(DEPDIR)/ecautil.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/exception.Po ./$(DEPDIR)/expr.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/expr_lex.Po ./$(DEPDIR)/expr_yacc.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/field.Po ./$(DEPDIR)/field2.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/fieldc.Po ./$(DEPDIR)/fieldmer.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/fieldzon.Po ./$(DEPDIR)/fourier.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/grid.Po ./$(DEPDIR)/history.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/institution.Po ./$(DEPDIR)/interpol.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/job.Po ./$(DEPDIR)/julian.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/legendre.Po ./$(DEPDIR)/list.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/modules.Po ./$(DEPDIR)/namelist.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/normal.Po ./$(DEPDIR)/nth_element.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Log.Po ./$(DEPDIR)/Maskbox.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Mastrfu.Po ./$(DEPDIR)/Math.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Merge.Po ./$(DEPDIR)/Mergegrid.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Mergetime.Po ./$(DEPDIR)/Merstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Mrotuv.Po ./$(DEPDIR)/Ninfo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Nmltest.Po ./$(DEPDIR)/Output.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Outputgmt.Po ./$(DEPDIR)/Pinfo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Remap.Po ./$(DEPDIR)/Replace.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Rotuv.Po ./$(DEPDIR)/Runpctl.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Runstat.Po ./$(DEPDIR)/Seaspctl.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Seasstat.Po ./$(DEPDIR)/Selbox.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Select.Po ./$(DEPDIR)/Seloperator.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Selpctl.Po ./$(DEPDIR)/Selrec.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Selstat.Po ./$(DEPDIR)/Seltime.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Set.Po ./$(DEPDIR)/Setbox.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Setgatt.Po ./$(DEPDIR)/Setgrid.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Sethalo.Po ./$(DEPDIR)/Setmiss.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Setrcaname.Po ./$(DEPDIR)/Settime.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Setzaxis.Po ./$(DEPDIR)/Showinfo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Sinfo.Po ./$(DEPDIR)/Sort.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Specinfo.Po ./$(DEPDIR)/Spectral.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Split.Po ./$(DEPDIR)/Splitrec.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Splittime.Po ./$(DEPDIR)/Splityear.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Subtrend.Po ./$(DEPDIR)/Tchill.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Templates.Po ./$(DEPDIR)/Test.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Timpctl.Po ./$(DEPDIR)/Timsort.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Timstat.Po ./$(DEPDIR)/Trend.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Trms.Po ./$(DEPDIR)/Vardup.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Vargen.Po ./$(DEPDIR)/Varrms.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Vertint.Po ./$(DEPDIR)/Vertstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Wind.Po ./$(DEPDIR)/Writegrid.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Writerandom.Po ./$(DEPDIR)/Ydaypctl.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Ydaystat.Po ./$(DEPDIR)/Ydrunpctl.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Ydrunstat.Po ./$(DEPDIR)/Ymonarith.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Ymonpctl.Po ./$(DEPDIR)/Ymonstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Yseaspctl.Po ./$(DEPDIR)/Yseasstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Zonstat.Po ./$(DEPDIR)/cdilib.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/cdo.Po ./$(DEPDIR)/cdo_pthread.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/cdo_vlist.Po ./$(DEPDIR)/color.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/commandline.Po ./$(DEPDIR)/eca.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ecautil.Po ./$(DEPDIR)/exception.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/expr.Po ./$(DEPDIR)/expr_lex.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/expr_yacc.Po ./$(DEPDIR)/field.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/field2.Po ./$(DEPDIR)/fieldc.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/fieldmer.Po ./$(DEPDIR)/fieldzon.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/fourier.Po ./$(DEPDIR)/grid.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/history.Po ./$(DEPDIR)/institution.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/interpol.Po ./$(DEPDIR)/job.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/julian.Po ./$(DEPDIR)/legendre.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/list.Po ./$(DEPDIR)/modules.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/namelist.Po ./$(DEPDIR)/normal.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/nth_element.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/percentiles.Po ./$(DEPDIR)/pipe.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/process.Po ./$(DEPDIR)/pstream.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/pthread_debug.Po \
......@@ -515,6 +517,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Inttime.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Intyear.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Invert.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Log.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Maskbox.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mastrfu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Math.Po@am__quote@
......
......@@ -113,7 +113,8 @@ void defineGrid(const char *gridarg);
void defineInstitution(char *instarg);
int defineTable(char *tablearg);
void userlog(const char *prompt, double cputime);
void cdolog(const char *prompt, double cputime);
void cdologs(int noper, double cputime, off_t nvals);
void nospec(int vlistID);
void gridWrite(FILE *fp, int gridID);
......
......@@ -68,6 +68,7 @@ void *Inttime(void *argument);
void *Intntime(void *argument);
void *Intyear(void *argument);
void *Invert(void *argument);
void *Log(void *argument);
void *Maskbox(void *argument);
void *Mastrfu(void *argument);
void *Math(void *argument);
......@@ -236,6 +237,7 @@ void *Tchill(void *argument);
#define IntyearOperators {"intyear"}
#define InvertOperators {"invertlat", "invertlon", "invertlatdes", "invertlondes", \
"invertlatdata", "invertlondata"}
#define LogOperators {"dumplogs"}
#define MaskboxOperators {"masklonlatbox", "maskindexbox"}
#define MastrfuOperators {"mastrfu"}
#define MathOperators {"abs", "int", "nint", "sqr", "sqrt", "exp", "ln", "log10", "sin", "cos", "tan", "asin", "acos", "atan"}
......@@ -423,6 +425,7 @@ static MODULES Modules[] =
{ Intntime, InttimeHelp, IntntimeOperators, 1, 1 },
{ Intyear, IntyearHelp, IntyearOperators, 2, 1 },
{ Invert, InvertHelp, InvertOperators, 1, 1 },
{ Log, NULL, LogOperators, 1, 0 },
{ Maskbox, MaskboxHelp, MaskboxOperators, 1, 1 },
{ Mastrfu, MastrfuHelp, MastrfuOperators, 1, 1 },
{ Math, MathHelp, MathOperators, 1, 1 },
......
......@@ -77,9 +77,11 @@ PROCESS;
static PROCESS Process[MAX_PROCESS];
static int NumProcess = 0;
static off_t ProcessNvals = 0;
#if defined (HAVE_LIBPTHREAD)
pthread_mutex_t processMutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t processNvalsMutex = PTHREAD_MUTEX_INITIALIZER;
#endif
......@@ -148,6 +150,60 @@ int processSelf(void)
}
int processNums(void)
{
static char func[] = "processNums";
int pnums = 0;
#if defined (HAVE_LIBPTHREAD)
pthread_mutex_lock(&processMutex);
#endif
pnums = NumProcess;
#if defined (HAVE_LIBPTHREAD)
pthread_mutex_unlock(&processMutex);
#endif
return (pnums);
}
void processAddNvals(off_t nvals)
{
static char func[] = "processAddNvals";
#if defined (HAVE_LIBPTHREAD)
pthread_mutex_lock(&processNvalsMutex);
#endif
ProcessNvals += nvals;
#if defined (HAVE_LIBPTHREAD)
pthread_mutex_unlock(&processNvalsMutex);
#endif
}
off_t processInqNvals(void)
{
static char func[] = "processInqNvals";
off_t nvals = 0;
#if defined (HAVE_LIBPTHREAD)
pthread_mutex_lock(&processNvalsMutex);
#endif
nvals = ProcessNvals;
#if defined (HAVE_LIBPTHREAD)
pthread_mutex_unlock(&processNvalsMutex);
#endif
return (nvals);
}
void processAddStream(int streamID)
{
static char func[] = "processAddStream";
......
......@@ -34,6 +34,10 @@ void processStartTime(double *utime, double *stime);
void processEndTime(double *utime, double *stime);
void processAccuTime(double utime, double stime);
void processAddNvals(off_t nvals);
off_t processInqNvals(void);
int processNums(void);
int processInqChildNum(void);
const char *processOperatorArg(void);
......
......@@ -729,6 +729,9 @@ void pstreamClose(int pstreamID)
if ( PSTREAM_Debug )
Message(func, "%s fileID %d\n", pstreamptr->name, pstreamptr->fileID);
if ( pstreamptr->mode == 'r' )
processAddNvals(streamNvals(pstreamptr->fileID));
streamClose(pstreamptr->fileID);
if ( cdoExpMode == CDO_EXP_REMOTE )
......@@ -739,11 +742,6 @@ void pstreamClose(int pstreamID)
FILE *fp = fopen(cdojobfiles, "a");
fprintf(fp, "%s\n", pstreamptr->name);
fclose(fp);
/*
fprintf(stderr, "start data transfer of %s\n", pstreamptr->name);
fprintf(stderr, "finish data transfer of %s\n", pstreamptr->name);
fprintf(stderr, "remove remote file %s\n", pstreamptr->name);
*/
}
}
......@@ -1132,7 +1130,8 @@ void cdoFinish(void)
processEndTime(&p_usertime, &p_systime);
p_cputime = p_usertime + p_systime;
userlog(processInqPrompt(), p_cputime);
cdologs(processNums(), p_cputime, processInqNvals());
cdolog(processInqPrompt(), p_cputime);
}
if ( cdoBenchmark )
......
......@@ -13,6 +13,7 @@
#include <errno.h>
#include "cdo.h"
#include "dtypes.h"
#if ! defined (VERSION)
# define VERSION "0.0.1"
......@@ -20,13 +21,13 @@
#define MAX_LEN 65536
void userlog(const char *prompt, double cputime)
void cdolog(const char *prompt, double cputime)
{
#if defined (LOGPATH)
#define XSTRING(x) #x
#define STRING(x) XSTRING(x)
char logfilename[] = STRING(LOGPATH) "/cdo.log";
int logfileno;
int logfileno;
char *username;
char timestr[30];
time_t date_and_time_in_sec;
......@@ -46,7 +47,7 @@ void userlog(const char *prompt, double cputime)
if ( date_and_time_in_sec != -1 )
{
date_and_time = localtime(&date_and_time_in_sec);
(void) strftime(timestr, 30, "%d/%m/%Y %H:%M", date_and_time);
(void) strftime(timestr, sizeof(timestr), "%d/%m/%Y %H:%M", date_and_time);
}
username = getenv("LOGNAME");
......@@ -114,3 +115,321 @@ void userlog(const char *prompt, double cputime)
#endif
}
#include <math.h>
/*
* convert an IMB float to single precision number v1.0
*
* Wesley Ebisuzaki
*/
static float ibm2flt(unsigned char *ibm) {
int positive, power;
unsigned int abspower;
long int mant;
double value, exp;
positive = (ibm[0] & 0x80) == 0;
mant = (ibm[1] << 16) + (ibm[2] << 8) + ibm[3];
power = (int) (ibm[0] & 0x7f) - 64;
abspower = power > 0 ? power : -power;
/* calc exp */
exp = 16.0;
value = 1.0;
while (abspower) {
if (abspower & 1) {
value *= exp;
}
exp = exp * exp;
abspower >>= 1;
}
if (power < 0) value = 1.0 / value;
value = value * mant / 16777216.0;
if (positive == 0) value = -value;
return (float)value;
}
/*
* convert a float to an IBM single precision number v1.0
*
* Wesley Ebisuzaki
*
* doesn't handle subnormal numbers
*/
static int flt2ibm(float x, unsigned char *ibm) {
int sign, exp, i;
double mant;
if ( !(fabs((double)x) > 0) ) {
ibm[0] = ibm[1] = ibm[2] = ibm[3] = 0;
return 0;
}
/* sign bit */
if (x < 0.0) {
sign = 128;
x = -x;
}
else sign = 0;
mant = frexp((double) x, &exp);
/* round up by adding 2**-24 */
/* mant = mant + 1.0/16777216.0; */
if (mant >= 1.0) {
mant = 0.5;
exp++;
}
while (exp & 3) {
mant *= 0.5;
exp++;
}
exp = exp/4 + 64;
if (exp < 0) {
fprintf(stderr,"underflow in flt2ibm\n");
ibm[0] = ibm[1] = ibm[2] = ibm[3] = 0;
return 0;
}
if (exp > 127) {
fprintf(stderr,"overflow in flt2ibm\n");
ibm[0] = sign | 127;
ibm[1] = ibm[2] = ibm[3] = 255;
return -1;
}
/* normal number */
ibm[0] = sign | exp;
mant = mant * 256.0;
i = (int) floor(mant);
mant = mant - i;
ibm[1] = i;
mant = mant * 256.0;
i = (int) floor(mant);
mant = mant - i;
ibm[2] = i;
ibm[3] = (int) floor(mant*256.0);
return 0;
}
#define GET_UINT4(xb) ((int) (((int)xb[0]<<24) + \
((int)xb[1]<<16) + \
((int)xb[2]<<8) + \
((int)xb[3])))
#define GET_UINT8(xb) ((INT64) (((INT64)xb[0]<<56) + \
((INT64)xb[1]<<48) + \
((INT64)xb[2]<<40) + \
((INT64)xb[3]<<32) + \
((INT64)xb[4]<<24) + \
((INT64)xb[5]<<16) + \
((INT64)xb[6]<<8) + \
((INT64)xb[7])))
#define PUT_UINT4(xb, iv) ((*(xb) = (iv) >> 24), \
(*(xb+1) = (iv) >> 16), \
(*(xb+2) = (iv) >> 8), \
(*(xb+3) = (iv)))
#define PUT_UINT8(xb, iv) ((*(xb) = (iv) >> 56), \
(*(xb+1) = (iv) >> 48), \
(*(xb+2) = (iv) >> 40), \
(*(xb+3) = (iv) >> 32), \
(*(xb+4) = (iv) >> 24), \
(*(xb+5) = (iv) >> 16), \
(*(xb+6) = (iv) >> 8), \
(*(xb+7) = (iv)))
void cdologs(int noper, double cputime, off_t nvals)
{
#if defined (LOGPATH)
#define LOGSIZE 32
#define XSTRING(x) #x
#define STRING(x) XSTRING(x)
char logfilename[] = STRING(LOGPATH) "/cdo.logs";
int logfileno;