Commit ff3ca441 authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

Merge branch 'develop' of git.mpimet.mpg.de:cdo into develop

parents 707c7f54 cbd069ca
......@@ -3,6 +3,14 @@
* Using CDI library version 1.9.0
* Version 1.9.0 release
2017-06-08 Uwe Schulzweida
* mergetime: wrong time information if first input file does not contain the first time step (bug introduce in 1.8.1) [Bug #7760]
2017-06-04 Uwe Schulzweida
* selgridcell: read indices from mask
2017-06-02 Uwe Schulzweida
* New operator ensrange: Ensemble range (ensmax-ensmin)
......
......@@ -236,6 +236,8 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECCODES_INCLUDE = @ECCODES_INCLUDE@
ECCODES_LIBS = @ECCODES_LIBS@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
......
......@@ -80,17 +80,13 @@ case "${HOSTNAME}" in
;;
hama*)
# CDOLIBS="--with-fftw3 \
# --with-netcdf=/opt/local \
# --with-hdf5=/opt/local \
# --with-szlib=$HOME/local \
# --with-proj=/opt/local \
# --with-cmor=/Users/m214003/work/CMOR \
# --with-magics=$HOME/local/magics-2.25.3 \
# --with-curl=/opt/local"
CDOLIBS="--enable-nearpt3 \
--with-fftw3 \
--with-szlib=$HOME/local \
--with-grib_api=$HOME/local/grib_api-1.21.0 \
--with-eccodes=$HOME/local/eccodes-2.3.0 \
--with-netcdf=$HOME/local/netcdf-c-4.4.1.1 \
--with-hdf5=$HOME/local/hdf5-1.8.18 \
--with-libxml2=/opt/local \
......@@ -119,7 +115,7 @@ case "${HOSTNAME}" in
else
${CONFPATH}configure --prefix=$HOME/local \
--enable-maintainer-mode \
$CDOLIBS \
$CDOLIBS LDFLAGS="-Wl,-rpath,$HOME/local/eccodes-2.3.0/lib" \
CXX=g++ CXXFLAGS="-g -pipe -Wall -W -Wfloat-equal -pedantic -O3 -march=native -Wa,-q -fstack-protector" \
CC=gcc CFLAGS="-g -pipe -Wall -W -Wfloat-equal -pedantic -O3 -march=native -Wa,-q -fstack-protector"
# --with-libxml2=/usr \
......
......@@ -653,6 +653,8 @@ ENABLE_GRIB
ENABLE_GRIBAPI
GRIB_API_LIBS
GRIB_API_INCLUDE
ECCODES_LIBS
ECCODES_INCLUDE
CMOR_LIBS
UDUNITS_INCLUDE
UDUNITS_LDFLAGS
......@@ -828,6 +830,7 @@ with_hdf5
with_netcdf
with_udunits2
with_cmor
with_eccodes
with_grib_api
enable_grib
enable_cgribex
......@@ -1525,6 +1528,9 @@ Optional Packages:
--with-udunits2=<directory>
Specify location of UDUNITS2 library.
--with-cmor=<directory> Specify location of CMOR library.
--with-eccodes=<yes|no|directory> (default=no)
location of ECCODES library (lib and include
subdirs)
--with-grib_api=<yes|no|directory> (default=no)
location of GRIB_API library (lib and include
subdirs)
......@@ -20724,11 +20730,195 @@ $as_echo "suppressed" >&6; }
fi
 
 
# ----------------------------------------------------------------------
# Compile application with ECCODES library (for GRIB2 support)
ECCODES_INCLUDE=''
ECCODES_LIBS=''
ENABLE_GRIBAPI=no
# Check whether --with-eccodes was given.
if test "${with_eccodes+set}" = set; then :
withval=$with_eccodes; case "$with_eccodes" in #(
no) :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ECCODES library" >&5
$as_echo_n "checking for ECCODES library... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
$as_echo "suppressed" >&6; } ;; #(
yes) :
for ac_header in grib_api.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "grib_api.h" "ac_cv_header_grib_api_h" "$ac_includes_default"
if test "x$ac_cv_header_grib_api_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_GRIB_API_H 1
_ACEOF
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing grib_get_message" >&5
$as_echo_n "checking for library containing grib_get_message... " >&6; }
if ${ac_cv_search_grib_get_message+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char grib_get_message ();
int
main ()
{
return grib_get_message ();
;
return 0;
}
_ACEOF
for ac_lib in '' eccodes; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_grib_get_message=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_grib_get_message+:} false; then :
break
fi
done
if ${ac_cv_search_grib_get_message+:} false; then :
else
ac_cv_search_grib_get_message=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_grib_get_message" >&5
$as_echo "$ac_cv_search_grib_get_message" >&6; }
ac_res=$ac_cv_search_grib_get_message
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
$as_echo "#define HAVE_LIBGRIB_API 1" >>confdefs.h
ENABLE_GRIBAPI=yes
else
as_fn_error $? "Could not link to eccodes library" "$LINENO" 5
fi
;; #(
*) :
ECCODES_ROOT=$with_eccodes
if test -d "$ECCODES_ROOT"; then :
LDFLAGS="-L$ECCODES_ROOT/lib $LDFLAGS"
CPPFLAGS="-I$ECCODES_ROOT/include $CPPFLAGS"
for ac_header in grib_api.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "grib_api.h" "ac_cv_header_grib_api_h" "$ac_includes_default"
if test "x$ac_cv_header_grib_api_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_GRIB_API_H 1
_ACEOF
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing grib_get_message" >&5
$as_echo_n "checking for library containing grib_get_message... " >&6; }
if ${ac_cv_search_grib_get_message+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char grib_get_message ();
int
main ()
{
return grib_get_message ();
;
return 0;
}
_ACEOF
for ac_lib in '' eccodes; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_grib_get_message=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_grib_get_message+:} false; then :
break
fi
done
if ${ac_cv_search_grib_get_message+:} false; then :
else
ac_cv_search_grib_get_message=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_grib_get_message" >&5
$as_echo "$ac_cv_search_grib_get_message" >&6; }
ac_res=$ac_cv_search_grib_get_message
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
$as_echo "#define HAVE_LIBGRIB_API 1" >>confdefs.h
ENABLE_GRIBAPI=yes
else
as_fn_error $? "Could not link to eccodes library" "$LINENO" 5
fi
ECCODES_LIBS=" -L$ECCODES_ROOT/lib -leccodes"
ECCODES_INCLUDE=" -I$ECCODES_ROOT/include"
else
as_fn_error $? "$ECCODES_ROOT is not a directory! ECCODES suppressed" "$LINENO" 5
fi ;; #(
*) :
;;
esac
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the ECCODES library" >&5
$as_echo_n "checking for the ECCODES library... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
$as_echo "suppressed" >&6; }
fi
#AC_SUBST([ENABLE_GRIBAPI])
# ----------------------------------------------------------------------
# Compile application with GRIB_API library (for GRIB2 support)
GRIB_API_INCLUDE=''
GRIB_API_LIBS=''
ENABLE_GRIBAPI=no
#ENABLE_GRIBAPI=no
 
# Check whether --with-grib_api was given.
if test "${with_grib_api+set}" = set; then :
......
......@@ -146,6 +146,8 @@ DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECCODES_INCLUDE = @ECCODES_INCLUDE@
ECCODES_LIBS = @ECCODES_LIBS@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
......
......@@ -259,10 +259,44 @@ AC_ARG_WITH([cmor],
AC_MSG_RESULT([suppressed])])
AC_SUBST([CMOR_LIBS])
# ----------------------------------------------------------------------
# Compile application with ECCODES library (for GRIB2 support)
ECCODES_INCLUDE=''
ECCODES_LIBS=''
ENABLE_GRIBAPI=no
AC_ARG_WITH([eccodes],
[AS_HELP_STRING([--with-eccodes=<yes|no|directory> (default=no)],[location of ECCODES library (lib and include subdirs)])],
[AS_CASE(["$with_eccodes"],
[no],[AC_MSG_CHECKING([for ECCODES library])
AC_MSG_RESULT([suppressed])],
[yes],[AC_CHECK_HEADERS([grib_api.h])
AC_SEARCH_LIBS([grib_get_message],
[eccodes],
[AC_DEFINE([HAVE_LIBGRIB_API],[1],[ECCODES library is present if defined to 1])
ENABLE_GRIBAPI=yes],
[AC_MSG_ERROR([Could not link to eccodes library])])],
[*],[ECCODES_ROOT=$with_eccodes
AS_IF([test -d "$ECCODES_ROOT"],
[LDFLAGS="-L$ECCODES_ROOT/lib $LDFLAGS"
CPPFLAGS="-I$ECCODES_ROOT/include $CPPFLAGS"
AC_CHECK_HEADERS([grib_api.h])
AC_SEARCH_LIBS([grib_get_message],
[eccodes],
[AC_DEFINE([HAVE_LIBGRIB_API],[1],[ECCODES library is present if defined to 1])
ENABLE_GRIBAPI=yes],
[AC_MSG_ERROR([Could not link to eccodes library])])
ECCODES_LIBS=" -L$ECCODES_ROOT/lib -leccodes"
ECCODES_INCLUDE=" -I$ECCODES_ROOT/include"],
[AC_MSG_ERROR([$ECCODES_ROOT is not a directory! ECCODES suppressed])])])],
[AC_MSG_CHECKING([for the ECCODES library])
AC_MSG_RESULT([suppressed])])
AC_SUBST([ECCODES_INCLUDE])
AC_SUBST([ECCODES_LIBS])
#AC_SUBST([ENABLE_GRIBAPI])
# ----------------------------------------------------------------------
# Compile application with GRIB_API library (for GRIB2 support)
GRIB_API_INCLUDE=''
GRIB_API_LIBS=''
ENABLE_GRIBAPI=no
#ENABLE_GRIBAPI=no
AC_ARG_WITH([grib_api],
[AS_HELP_STRING([--with-grib_api=<yes|no|directory> (default=no)],[location of GRIB_API library (lib and include subdirs)])],
[AS_CASE(["$with_grib_api"],
......
---
Language: Cpp
# BasedOnStyle: GNU
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: All
AlwaysBreakAfterReturnType: AllDefinitions
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: true
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: true
BreakBeforeBinaryOperators: All
BreakBeforeBraces: GNU
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IndentCaseLabels: false
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: false
SpaceAfterCStyleCast: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...
......@@ -20,6 +20,9 @@
#include "cdo.h"
#include "cdo_int.h"
#include "pstream_write.h"
#define streamOpenWrite pstreamOpenWrite
#define streamDefVlist pstreamDefVlist
#define streamDefTimestep pstreamDefTimestep
#endif
#if defined(AFTERBURNER)
......@@ -2075,7 +2078,7 @@ void after_processing(struct Control *globs, struct Variable *vars)
{
int i;
//#if defined(_PSTREAM_H)
//#if defined(PSTREAM_H)
// globs->istreamID = streamOpenRead(cdoStreamName(0));
//#else
globs->istreamID = streamOpenRead(ifile);
......@@ -2089,7 +2092,7 @@ void after_processing(struct Control *globs, struct Variable *vars)
if ( globs->Mean != 2 )
{
#if defined(_PSTREAM_WRITE_H)
#if defined(PSTREAM_WRITE_H)
globs->ostreamID = streamOpenWrite(cdoStreamName(ofileidx), ofiletype);
#else
globs->ostreamID = streamOpenWrite(ofile, ofiletype);
......@@ -2229,7 +2232,7 @@ void after_processing(struct Control *globs, struct Variable *vars)
after_control(globs, vars);
#if defined(_PSTREAM_WRITE_H)
#if defined(PSTREAM_WRITE_H)
if ( globs->ostreamID != CDI_UNDEFID ) pstreamClose(globs->ostreamID);
#else
if ( globs->ostreamID2 != CDI_UNDEFID ) streamClose(globs->ostreamID2);
......
......@@ -49,6 +49,7 @@ void *Arith(void *argument)
cdoInitialize(argument);
// clang-format off
cdoOperatorAdd("add", func_add, 0, NULL);
cdoOperatorAdd("sub", func_sub, 0, NULL);
cdoOperatorAdd("mul", func_mul, 0, NULL);
......@@ -56,6 +57,7 @@ void *Arith(void *argument)
cdoOperatorAdd("min", func_min, 0, NULL);
cdoOperatorAdd("max", func_max, 0, NULL);
cdoOperatorAdd("atan2", func_atan2, 0, NULL);
// clang-format on
int operatorID = cdoOperatorID();
int operfunc = cdoOperatorF1(operatorID);
......
......@@ -78,11 +78,13 @@ void *Arithc(void *argument)
cdoInitialize(argument);
// clang-format off
cdoOperatorAdd("addc", func_add, 0, "constant value");
cdoOperatorAdd("subc", func_sub, 0, "constant value");
cdoOperatorAdd("mulc", func_mul, 0, "constant value");
cdoOperatorAdd("divc", func_div, 0, "constant value");
cdoOperatorAdd("mod", func_mod, 0, "divisor");
// clang-format on
int operatorID = cdoOperatorID();
int operfunc = cdoOperatorF1(operatorID);
......
......@@ -78,11 +78,13 @@ void *Arithdays(void *argument)
cdoInitialize(argument);
// clang-format off
cdoOperatorAdd("muldpm", func_mul, func_month, NULL);
cdoOperatorAdd("divdpm", func_div, func_month, NULL);
cdoOperatorAdd("muldpy", func_mul, func_year, NULL);
cdoOperatorAdd("divdpy", func_div, func_year, NULL);
int MULDOY = cdoOperatorAdd("muldoy", func_mul, 0, NULL);
// clang-format on
int operatorID = cdoOperatorID();
int operfunc = cdoOperatorF1(operatorID);
......
......@@ -644,7 +644,7 @@ struct mapping
static struct mapping *construct_var_mapping(int streamID)
{
int nvars_max = vlistNvars(streamInqVlist(streamID));
int nvars_max = vlistNvars(pstreamInqVlist(streamID));
struct mapping *vars =
(struct mapping *) Malloc((nvars_max + 1) * sizeof(struct mapping));
vars[0].cdi_varID = CDI_UNDEFID;
......
......@@ -442,7 +442,7 @@ void *CMOR_lite(void *argument)
}
int vlistIDx = vlistCreate();
vlistCopyFlag(vlistIDx, vlistID2);
cdoVlistCopyFlag(vlistIDx, vlistID2);
vlistDestroy(vlistID2);
......
......@@ -58,6 +58,7 @@ void *Change(void *argument)
cdoInitialize(argument);
// clang-format off
int CHCODE = cdoOperatorAdd("chcode", 0, 0, "pairs of old and new code numbers");
int CHTABNUM = cdoOperatorAdd("chtabnum", 0, 0, "pairs of old and new GRIB1 table numbers");
int CHPARAM = cdoOperatorAdd("chparam", 0, 0, "pairs of old and new parameter identifiers");
......@@ -67,6 +68,7 @@ void *Change(void *argument)
int CHLEVELC = cdoOperatorAdd("chlevelc", 0, 0, "code number, old and new level");
int CHLEVELV = cdoOperatorAdd("chlevelv", 0, 0, "variable name, old and new level");
int CHLTYPE = cdoOperatorAdd("chltype", 0, 0, "pairs of old and new type");
// clang-format on
int operatorID = cdoOperatorID();
......
......@@ -410,7 +410,7 @@ void *Collgrid(void *argument)
}
int vlistID2 = vlistCreate();
vlistCopyFlag(vlistID2, vlistID1);
cdoVlistCopyFlag(vlistID2, vlistID1);
/*
if ( cdoVerbose )
{
......
......@@ -161,7 +161,7 @@ void *Comp(void *argument)
vlistDefTaxis(vlistID3, taxisID3);
int streamID3 = pstreamOpenWrite(cdoStreamName(2), cdoFiletype());
streamDefVlist(streamID3, vlistID3);
pstreamDefVlist(streamID3, vlistID3);
int tsID = 0;
while ( (nrecs = pstreamInqTimestep(streamIDx1, tsID)) )
......
......@@ -44,8 +44,10 @@ void *Cond(void *argument)
cdoInitialize(argument);
// clang-format off
int IFTHEN = cdoOperatorAdd("ifthen", 0, 0, NULL);
int IFNOTTHEN = cdoOperatorAdd("ifnotthen", 0, 0, NULL);
// clang-format on
int operatorID = cdoOperatorID();
......
......@@ -39,8 +39,10 @@ void *Condc(void *argument)
cdoInitialize(argument);
// clang-format off
int IFTHENC = cdoOperatorAdd("ifthenc", 0, 0, NULL);
int IFNOTTHENC = cdoOperatorAdd("ifnotthenc", 0, 0, NULL);
// clang-format on
int operatorID = cdoOperatorID();
......
......@@ -53,9 +53,11 @@ void *Copy(void *argument)
bool lcopy = UNCHANGED_RECORD;
// clang-format off
cdoOperatorAdd("copy", 0, 0, NULL);
int SELALL = cdoOperatorAdd("selall", 0, 0, NULL);
int SZIP = cdoOperatorAdd("szip", 0, 0, NULL);
// clang-format on
#ifdef HIRLAM_EXTENSIONS
// KEEP in mind the difference between copy and selall with respect to unpacking and repacking the GRIB information!
......
......@@ -39,8 +39,10 @@ void *Deltime(void *argument)
bool lcopy = UNCHANGED_RECORD;
// clang-format off
int DELDAY = cdoOperatorAdd("delday", 0, 0, NULL);
int DEL29FEB = cdoOperatorAdd("del29feb", 0, 0, NULL);
// clang-format on
UNUSED(DELDAY);
......
Markdown is supported
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