Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
2c0607d1
Commit
2c0607d1
authored
Nov 06, 2017
by
Oliver Heidmann
Browse files
merged Expr.test.in
parents
8979dd9e
5a6908a8
Changes
113
Expand all
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
2c0607d1
2017-11-23 Uwe Schulzweida
* Using CDI library version 1.9.2
* Version 1.9.2 release
2017-11-02 Uwe Schulzweida
* expr: nesting of ?: operator lost in cdo-1.9.1 [Bug #7992]
2017-10-26 Uwe Schulzweida
* select with start=end range aborts with 'Invalid character' [Bug #7976]
2017-10-25 Uwe Schulzweida
* Expr: convert constant parameter to float for 32-bit float data (bug fix)
* Condc: convert constant parameter to float for 32-bit float data (bug fix)
* Cond: convert data to float for 32-bit float data (bug fix)
2017-10-23 Uwe Schulzweida
* Added operator uv2vr_cfd: U and V wind to relative vorticity (interface to NCL)
* Added operator uv2dv_cfd: U and V wind to divergence (interface to NCL)
* gengrid: bug fix
2017-10-20 Uwe Schulzweida
* Ydaystat: don't adjust the output year if the last input year is incomplete (bug fix)
...
...
Makefile.in
View file @
2c0607d1
...
...
@@ -248,12 +248,14 @@ ENABLE_CDI_LIB = @ENABLE_CDI_LIB@
ENABLE_CGRIBEX
=
@ENABLE_CGRIBEX@
ENABLE_DATA
=
@ENABLE_DATA@
ENABLE_EXTRA
=
@ENABLE_EXTRA@
ENABLE_FORTRAN
=
@ENABLE_FORTRAN@
ENABLE_GRIB
=
@ENABLE_GRIB@
ENABLE_GRIBAPI
=
@ENABLE_GRIBAPI@
ENABLE_IEG
=
@ENABLE_IEG@
ENABLE_NC2
=
@ENABLE_NC2@
ENABLE_NC4
=
@ENABLE_NC4@
ENABLE_NC4HDF5
=
@ENABLE_NC4HDF5@
ENABLE_NEARPT3
=
@ENABLE_NEARPT3@
ENABLE_NETCDF
=
@ENABLE_NETCDF@
ENABLE_SERVICE
=
@ENABLE_SERVICE@
ENABLE_THREADS
=
@ENABLE_THREADS@
...
...
@@ -261,6 +263,7 @@ EXEEXT = @EXEEXT@
F77
=
@F77@
FFLAGS
=
@FFLAGS@
FGREP
=
@FGREP@
FORTRAN_WORKS
=
@FORTRAN_WORKS@
GREP
=
@GREP@
GRIB_API_INCLUDE
=
@GRIB_API_INCLUDE@
GRIB_API_LIBS
=
@GRIB_API_LIBS@
...
...
NEWS
View file @
2c0607d1
CDO NEWS
--------
Version 1.9.2 (23 November 2017):
Fixed bugs:
* sign of grid size increment changes [Bug #7974]
* compilation fails on OpenBSD [Bug #7961]
* expr: nesting of ?: operator lost in cdo-1.9.1 [Bug #7992]
* select with start=end range aborts with 'Invalid character' [Bug #7976]
Version 1.9.1 (27 September 2017):
New features:
...
...
OPERATORS
View file @
2c0607d1
...
...
@@ -582,6 +582,11 @@ Operator catalog:
Strgal strgal Strong gale days index per time period
Hurr hurr Hurricane days index per time period
CMORlite cmorlite CMOR lite
-------------------------------------------------------------
NCL
-------------------------------------------------------------
NCL_wind uv2vr_cfd U and V wind to relative vorticity
NCL_wind uv2dv_cfd U and V wind to divergence
-------------------------------------------------------------
CMOR
-------------------------------------------------------------
...
...
cdo.settings.in
View file @
2c0607d1
{
"CXX" : "@CXX@",
"CC" : "@CC@",
"CPP" : "@CPP@",
"CPPFLAGS" : "@CPPFLAGS@",
"CXXFLAGS" : "@CXXFLAGS@",
"CFLAGS" : "@CFLAGS@",
"F77" : "@F77@",
"FFLAGS" : "@FFLAGS@",
"LDFLAGS" : "@LDFLAGS@",
"LIBS" : "@LIBS@",
"FCFLAGS" : "@FCFLAGS@",
"INCLUDES" : "@INCLUDES@",
"LD" : "@LD@",
"NM" : "@NM@",
"AR" : "@AR@",
"AS" : "@AS@",
"DLLTOOL" : "@DLLTOOL@",
"OBJDUMP" : "@OBJDUMP@",
"STRIP" : "@STRIP@",
"RANLIB" : "@RANLIB@",
"INSTALL" : "@INSTALL@",
"cdi" : {
"enable_cdi_lib" : @ENABLE_CDI_LIB@
},
"threads" : {
"lib" : "@THREADS_LIBS@",
"include" : "@THREADS_INCLUDE@"
"szlib" : {
"lib" : "@SZLIB_LIBS@",
"include" : "@SZLIB_INCLUDE@"
"build" : {
"tools" : {
"CXX" : "@CXX@",
"CC" : "@CC@",
"CPP" : "@CPP@",
"CPPFLAGS" : "@CPPFLAGS@",
"CXXFLAGS" : "@CXXFLAGS@",
"CFLAGS" : "@CFLAGS@",
"F77" : "@F77@",
"FFLAGS" : "@FFLAGS@",
"LDFLAGS" : "@LDFLAGS@",
"LIBS" : "@LIBS@",
"FCFLAGS" : "@FCFLAGS@",
"INCLUDES" : "@INCLUDES@",
"LD" : "@LD@",
"NM" : "@NM@",
"AR" : "@AR@",
"AS" : "@AS@",
"DLLTOOL" : "@DLLTOOL@",
"OBJDUMP" : "@OBJDUMP@",
"STRIP" : "@STRIP@",
"RANLIB" : "@RANLIB@",
"INSTALL" : "@INSTALL@",
},
"libraries" : {
"threads" : {
"lib" : "@THREADS_LIBS@",
"include" : "@THREADS_INCLUDE@"
},
"szlib" : {
"lib" : "@SZLIB_LIBS@",
"include" : "@SZLIB_INCLUDE@"
},
"hdf5" : {
"lib" : "@HDF5_LIBS@",
"include" : "@HDF5_INCLUDE@"
},
"netcdf" : {
"lib" : "@NETCDF_LIBS@",
"include" : "@NETCDF_INCLUDE@"
},
"udunits2" : {
"lib" : "@UDUNITS_LDFLAGS@",
"include" : "@UDUNITS_INCLUDE@"
},
"proj" : {
"lib" : "@PROJ_LDFLAGS@",
"include" : "@PROJ_INCLUDE@"
},
"magics" : {
"lib" : "@MAGICS_LIBS@",
"include" : "@MAGICS_INCLUDE@"
}
},
"platform" : {
"USER_NAME" : "@USER_NAME@",
"HOST_NAME" : "@HOST_NAME@",
"SYSTEM_TYPE" : "@SYSTEM_TYPE@"
},
},
"hdf5" : {
"lib" : "@HDF5_LIBS@",
"include" : "@HDF5_INCLUDE@"
},
"netcdf" : {
"lib" : "@NETCDF_LIBS@",
"include" : "@NETCDF_INCLUDE@"
},
"udunits2" : {
"lib" : "@UDUNITS_LDFLAGS@",
"include" : "@UDUNITS_INCLUDE@"
},
"proj" : {
"lib" : "@PROJ_LDFLAGS@",
"include" : "@PROJ_INCLUDE@"
},
"magics" : {
"lib" : "@MAGICS_LIBS@",
"include" : "@MAGICS_INCLUDE@"
},
"USER_NAME" : "@USER_NAME@",
"HOST_NAME" : "@HOST_NAME@",
"SYSTEM_TYPE" : "@SYSTEM_TYPE@"
"features" : {
"enable_cdi_lib" : @ENABLE_CDI_LIB@,
"enable_data" : @ENABLE_DATA@,
"enable_fortran" : @ENABLE_FORTRAN@,
"fortran_works" : "@FORTRAN_WORKS@",
}
}
configure
View file @
2c0607d1
This diff is collapsed.
Click to expand it.
configure.ac
View file @
2c0607d1
...
...
@@ -149,32 +149,6 @@ AC_CHECK_FUNCS(sqrtl)
AC_CHECK_FUNCS(feenableexcept)
#
AC_CHECK_MEMBERS([fenv_t.__control, fenv_t.__mxcsr],,,[[#include <fenv.h>]])
# ----------------------------------------------------------------------
# Enable NEARPT3 support
# AC_MSG_CHECKING([for nearpt3 support])
# AC_ARG_ENABLE([nearpt3], AS_HELP_STRING([--enable-nearpt3],[nearpt3 support [default=no]]))
# AS_IF([test "x$enable_nearpt3" = "xyes"], [
# AC_DEFINE(ENABLE_NEARPT3, [1], [Define to 1 for nearpt3 support])
# ])
# AC_MSG_RESULT([$enable_nearpt3])
# AC_SUBST([ENABLE_NEARPT3],[$enable_nearpt3])
# AM_CONDITIONAL([ENABLE_NEARPT3],[test x$enable_nearpt3 = 'xyes'])
# ----------------------------------------------------------------------
# Enable DATA support
AC_MSG_CHECKING([for DATA support])
AC_ARG_ENABLE([data], AS_HELP_STRING([--enable-data],[DATA support [default=yes]]))
AS_IF([test "x$enable_data" != 'xno'], [
AC_DEFINE(ENABLE_DATA, [1], [Define to 1 for DATA support])
])
AC_MSG_RESULT([$enable_data])
AC_SUBST([ENABLE_DATA],[$enable_data])
# ----------------------------------------------------------------------
CFLAGS="$CFLAGS ${OPENMP_CFLAGS}"
CXXFLAGS="$CXXFLAGS ${OPENMP_CFLAGS}"
# ----------------------------------------------------------------------
# Add configure options
ACX_OPTIONS
# ----------------------------------------------------------------------
# Create the Interface to Fortran77 routines via cfortran.h
...
...
@@ -203,9 +177,38 @@ AS_IF([test -n "$F77" -a X"$F77" != Xno],
AC_MSG_NOTICE([Disabling cfortran.h bindings generation])
acx_cv_cfortran_works=no])])
])
AS_IF([test x$enable_fortran = 'xno'],[AC_SUBST([ENABLE_FORTRAN],[false])],[AC_SUBST([ENABLE_FORTRAN],[true])])
#
AM_CONDITIONAL([USE_F77],[test -n "$F77" -a X"$F77" != Xno -a x"$acx_cv_cfortran_works" = xyes])
AS_IF([test x$acx_cv_cfortran_works = 'xno'],[AC_SUBST([FORTRAN_WORKS],[no])],[AC_SUBST([FORTRAN_WORKS],[yes])])
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Enable NEARPT3 support
AC_MSG_CHECKING([for nearpt3 support])
AC_ARG_ENABLE([nearpt3], AS_HELP_STRING([--enable-nearpt3],[nearpt3 support [default=no]]))
AS_IF([test "x$enable_nearpt3" = "xyes"], [
AC_DEFINE(ENABLE_NEARPT3, [1], [Define to 1 for nearpt3 support])
])
AC_MSG_RESULT([$enable_nearpt3])
AC_SUBST([ENABLE_NEARPT3],[$enable_nearpt3])
AM_CONDITIONAL([ENABLE_NEARPT3],[test x$enable_nearpt3 = 'xyes'])
# ----------------------------------------------------------------------
# Enable DATA support
AC_MSG_CHECKING([for DATA support])
AC_ARG_ENABLE([data], AS_HELP_STRING([--enable-data],[DATA support [default=yes]]))
AS_IF([test "x$enable_data" != 'xno'], [
AC_DEFINE(ENABLE_DATA, [1], [Define to 1 for DATA support])
])
AC_MSG_RESULT([$enable_data])
AS_IF([test x$enable_data = 'xno'],[AC_SUBST([ENABLE_DATA],[false])],[AC_SUBST([ENABLE_DATA],[true])])
# ----------------------------------------------------------------------
CFLAGS="$CFLAGS ${OPENMP_CFLAGS}"
CXXFLAGS="$CXXFLAGS ${OPENMP_CFLAGS}"
# ----------------------------------------------------------------------
# Add configure options
ACX_OPTIONS
# configure code from valgrind
...
...
contrib/Makefile.in
View file @
2c0607d1
...
...
@@ -158,12 +158,14 @@ ENABLE_CDI_LIB = @ENABLE_CDI_LIB@
ENABLE_CGRIBEX
=
@ENABLE_CGRIBEX@
ENABLE_DATA
=
@ENABLE_DATA@
ENABLE_EXTRA
=
@ENABLE_EXTRA@
ENABLE_FORTRAN
=
@ENABLE_FORTRAN@
ENABLE_GRIB
=
@ENABLE_GRIB@
ENABLE_GRIBAPI
=
@ENABLE_GRIBAPI@
ENABLE_IEG
=
@ENABLE_IEG@
ENABLE_NC2
=
@ENABLE_NC2@
ENABLE_NC4
=
@ENABLE_NC4@
ENABLE_NC4HDF5
=
@ENABLE_NC4HDF5@
ENABLE_NEARPT3
=
@ENABLE_NEARPT3@
ENABLE_NETCDF
=
@ENABLE_NETCDF@
ENABLE_SERVICE
=
@ENABLE_SERVICE@
ENABLE_THREADS
=
@ENABLE_THREADS@
...
...
@@ -171,6 +173,7 @@ EXEEXT = @EXEEXT@
F77
=
@F77@
FFLAGS
=
@FFLAGS@
FGREP
=
@FGREP@
FORTRAN_WORKS
=
@FORTRAN_WORKS@
GREP
=
@GREP@
GRIB_API_INCLUDE
=
@GRIB_API_INCLUDE@
GRIB_API_LIBS
=
@GRIB_API_LIBS@
...
...
doc/tex/Modules
View file @
2c0607d1
...
...
@@ -148,6 +148,7 @@ Strbre Miscellaneous
Strgal Miscellaneous
Hurr Miscellaneous
CMORlite Miscellaneous
NCL_wind NCL
CMOR CMOR
Magplot Magics
Magvector Magics
...
...
doc/tex/makedoc
View file @
2c0607d1
...
...
@@ -476,9 +476,15 @@ while (<MOFILE>) {
if
(
index
(
$tag
,
"
[
")
==
0
)
{
$nopt
++
;
$x1
=
1
;
$len
=
$len
-
2
;
$len
=
$len
-
1
;
$oparameter
=
"
$oparameter
\
[
";
}
if
(
$x1
==
1
&&
index
(
$tag
,
"
]
")
==
$len
)
{
$len
=
$len
-
1
;
}
if
(
$x1
==
0
&&
index
(
$tag
,
"
]
")
==
$len
-
1
)
{
$len
=
$len
-
1
;
}
$otag
=
substr
$tag
,
$x1
,
$len
;
$oparameter
=
"
$oparameter
,
$otag
";
}
...
...
doc/tex/mod/CMOR
View file @
2c0607d1
...
...
@@ -35,7 +35,7 @@ If questions remain, do not hesitate to ask and send an email to wachsmannATdkrz
@BeginOperator_cmor
@Title = Climate Model Output Rewriting
@Parameter = MIPtable [cmor_name=VarList
,
[key=value
,
...]
]
@Parameter = MIPtable [cmor_name=VarList
]
[key=value
] [
...]
@EndOperator
...
...
doc/tex/mod/Exprf
View file @
2c0607d1
...
...
@@ -55,6 +55,8 @@ Absolute value of x
Round to largest integral value not greater than x
@Item = ceil(x)
Round to smallest integral value not less than x
@Item = float(x)
32-bit float value of x
@Item = int(x)
Integer value of x
@Item = nint(x)
...
...
doc/tex/mod/MapReduce
View file @
2c0607d1
...
...
@@ -20,7 +20,7 @@ coordinates a completely suppressed.
@Name = reducegrid
@Title = Reduce input file variables to locations, where mask is non-zero.
Horizontal grids of @file{mask} and @file{infile} must be identical
@Parameter = mask[
,
limitCoordsOutput]
@Parameter = mask
[limitCoordsOutput]
@EndOperator
@BeginParameter
...
...
doc/tex/mod/NCL_wind
0 → 100644
View file @
2c0607d1
@BeginModule
@NewPage
@Name = NCL_wind
@Title = Wind transformation
@Section = NCL
@Class = NCL
@Arguments = infile outfile
@Operators = uv2vr_cfd uv2dv_cfd
@BeginDescription
This module contains CDO operators with an interface to NCL functions.
The corresponding NCL functions have the same name. A more detailed description
of those NCL function can be found on the NCL homepage https://www.ncl.ucar.edu.
@EndDescription
@EndModule
@BeginOperator_uv2vr_cfd
@Title = U and V wind to relative vorticity
@Parameter = [u v boundOpt outMode]
@BeginDescription
Computes relative vorticity for a latitude-longitude grid using centered finite differences.
The grid need not be global and missing values are allowed.
@EndDescription
@EndOperator
@BeginOperator_uv2dv_cfd
@Title = U and V wind to divergence
@Parameter = [u v boundOpt outMode]
@BeginDescription
Computes divergence for a latitude-longitude grid using centered finite differences.
The grid need not be global and missing values are allowed.
@EndDescription
@EndOperator
@BeginParameter boundOpt
@Item = u
STRING Name of variable u (default: u)
@Item = v
STRING Name of variable v (default: v)
@Item = boundOpt
INTEGER Boundary condition option (0-3) (default: 0/1 for cyclic grids)
@Item = outMode
STRING Output mode new/append (default: new)
@EndParameter
src/CMOR.cc
View file @
2c0607d1
...
...
@@ -1257,7 +1257,7 @@ static int check_mem(list_t *kvl, char *project_id)
char workchar[CMOR_MAX_STRING];
int realization, initialization_method, physics_version, forcing;
int ipos=0, ppos=0;
*/
/* Test for the right member, else abort or warn */
/*
...
...
@@ -1287,6 +1287,7 @@ static int check_mem(list_t *kvl, char *project_id)
for ( int i = 0; i < 3; i++ )
kv_insert_a_val(kvl, ripchar[i], (char *)"-1", 1);
}
*/
/* Now abort or warn */
/*
if (strcmp(project_id, "CMIP5") == 0 || strcmp(project_id, "CORDEX") == 0)
...
...
@@ -1834,7 +1835,7 @@ static void setup_dataset(list_t *kvl, int streamID, int *calendar)
#elif ( CMOR_VERSION_MAJOR == 3 )
{
/***/
/* Could not give CMOR all attributes separately because some are required to be in a json file (outpath,...). /
/* Could not give CMOR all attributes separately because some are required to be in a json file (outpath,...).
*
/
/* Better collect them in this file. */
/* todo this **/
/* If a Json file is denoted, read this file and check attributes */
...
...
@@ -4367,7 +4368,7 @@ static void read_maptab(list_t *kvl, int streamID, char *miptabfreq, struct mapp
/***/
/* However, if the mapping table contains a keyvalue pair for name or code with more than one value, */
/* the corresponding variable has a character coordinate and requires special treatment */
/* This is tested once before mapping. If the special variable equals the variable which is to map,
/* This is tested once before mapping. If the special variable equals the variable which is to map,
*/
/* the special treatment begins with fct addcharvar */
/***/
/* Different CMOR variables are built with one model variable. */
...
...
src/Change_e5slm.cc
View file @
2c0607d1
...
...
@@ -60,7 +60,7 @@ void *Change_e5slm(void *argument)
int
vlistIDslm
=
pstreamInqVlist
(
streamIDslm
);
long
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDslm
,
0
));
size_t
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDslm
,
0
));
double
*
array
=
(
double
*
)
Malloc
(
gridsize
*
sizeof
(
double
));
double
*
cland
=
(
double
*
)
Malloc
(
gridsize
*
sizeof
(
double
));
...
...
@@ -80,7 +80,7 @@ void *Change_e5slm(void *argument)
pstreamClose
(
streamIDslm
);
for
(
long
i
=
0
;
i
<
gridsize
;
++
i
)
lsea
[
i
]
=
!
(
cland
[
i
]
>
0
);
for
(
size_t
i
=
0
;
i
<
gridsize
;
++
i
)
lsea
[
i
]
=
!
(
cland
[
i
]
>
0
);
int
nvars
=
vlistNvars
(
vlistID1
);
...
...
src/Collgrid.cc
View file @
2c0607d1
...
...
@@ -451,7 +451,7 @@ void *Collgrid(void *argument)
int
taxisID2
=
taxisDuplicate
(
taxisID1
);
vlistDefTaxis
(
vlistID2
,
taxisID2
);
in
t
gridsize2
=
0
;
size_
t
gridsize2
=
0
;
for
(
int
i
=
0
;
i
<
ngrids2
;
++
i
)
{
if
(
gridIDs
[
i
]
!=
-
1
)
...
...
@@ -514,7 +514,7 @@ void *Collgrid(void *argument)
if
(
cdoVerbose
&&
tsID
==
0
)
printf
(
"varID %d %d levelID %d %d
\n
"
,
varID
,
varID2
,
levelID
,
levelID2
);
double
missval
=
vlistInqVarMissval
(
vlistID2
,
varID2
);
for
(
in
t
i
=
0
;
i
<
gridsize2
;
i
++
)
array2
[
i
]
=
missval
;
for
(
size_
t
i
=
0
;
i
<
gridsize2
;
i
++
)
array2
[
i
]
=
missval
;
#if defined(_OPENMP)
#pragma omp parallel for default(shared)
...
...
@@ -525,8 +525,8 @@ void *Collgrid(void *argument)
if
(
vars
[
varID2
]
)
{
in
t
gridsize
=
ef
[
fileID
].
gridsize
;
for
(
in
t
i
=
0
;
i
<
gridsize
;
++
i
)
size_
t
gridsize
=
ef
[
fileID
].
gridsize
;
for
(
size_
t
i
=
0
;
i
<
gridsize
;
++
i
)
array2
[
ef
[
fileID
].
gridindex
[
i
]]
=
ef
[
fileID
].
array
[
i
];
}
}
...
...
@@ -536,7 +536,7 @@ void *Collgrid(void *argument)
if
(
vars
[
varID2
]
)
{
size_t
nmiss
=
0
;
for
(
in
t
i
=
0
;
i
<
gridsize2
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
gridsize2
;
i
++
)
if
(
DBL_IS_EQUAL
(
array2
[
i
],
missval
)
)
nmiss
++
;
pstreamWriteRecord
(
streamID2
,
array2
,
nmiss
);
...
...
src/Comp.cc
View file @
2c0607d1
...
...
@@ -103,11 +103,11 @@ void *Comp(void *argument)
nospec
(
vlistID1
);
nospec
(
vlistID2
);
in
t
gridsize
=
vlistGridsizeMax
(
vlistIDx1
);
size_
t
gridsize
max
=
vlistGridsizeMax
(
vlistIDx1
);
double
*
array1
=
(
double
*
)
Malloc
(
gridsize
*
sizeof
(
double
));
double
*
array2
=
(
double
*
)
Malloc
(
gridsize
*
sizeof
(
double
));
double
*
array3
=
(
double
*
)
Malloc
(
gridsize
*
sizeof
(
double
));
double
*
array1
=
(
double
*
)
Malloc
(
gridsize
max
*
sizeof
(
double
));
double
*
array2
=
(
double
*
)
Malloc
(
gridsize
max
*
sizeof
(
double
));
double
*
array3
=
(
double
*
)
Malloc
(
gridsize
max
*
sizeof
(
double
));
double
*
arrayx1
=
array1
;
double
*
arrayx2
=
array2
;
...
...
@@ -140,7 +140,7 @@ void *Comp(void *argument)
vardata
=
(
double
**
)
Malloc
(
nvars
*
sizeof
(
double
*
));
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx2
,
varID
));
size_t
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx2
,
varID
));
nlev
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistIDx2
,
varID
));
vardata
[
varID
]
=
(
double
*
)
Malloc
(
nlev
*
gridsize
*
sizeof
(
double
));
}
...
...
@@ -194,70 +194,88 @@ void *Comp(void *argument)
if
(
filltype
==
FILL_TS
)
{
in
t
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx2
,
varID
));
in
t
offset
=
gridsize
*
levelID
;
size_
t
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx2
,
varID
));
size_
t
offset
=
gridsize
*
levelID
;
memcpy
(
vardata
[
varID
]
+
offset
,
arrayx2
,
gridsize
*
sizeof
(
double
));
}
}
else
if
(
filltype
==
FILL_TS
)
{
in
t
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx2
,
varID
));
in
t
offset
=
gridsize
*
levelID
;
size_
t
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx2
,
varID
));
size_
t
offset
=
gridsize
*
levelID
;
memcpy
(
arrayx2
,
vardata
[
varID
]
+
offset
,
gridsize
*
sizeof
(
double
));
}
int
datatype1
=
vlistInqVarDatatype
(
vlistIDx1
,
varID
);
int
datatype2
=
CDI_UNDEFID
;
gridsize1
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx1
,
varID
));
*
missvalx1
=
vlistInqVarMissval
(
vlistIDx1
,
varID
);
if
(
filltype
==
FILL_REC
)
{
gridsize2
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx2
,
0
));
datatype2
=
vlistInqVarDatatype
(
vlistIDx2
,
0
);
gridsize2
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx2
,
0
));
*
missvalx2
=
vlistInqVarMissval
(
vlistIDx2
,
0
);
}
else
{
datatype2
=
vlistInqVarDatatype
(
vlistIDx2
,
varID
);
gridsize2
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx2
,
varID
));
*
missvalx2
=
vlistInqVarMissval
(
vlistIDx2
,
varID
);
}
if
(
gridsize1
!=
gridsize2
)
cdoAbort
(
"Streams have different gridsize (gridsize1 = %
d
; gridsize2 = %
d
!"
,
if
(
gridsize1
!=
gridsize2
)
cdoAbort
(
"Streams have different gridsize (gridsize1 = %
zu
; gridsize2 = %
zu
!"
,
gridsize1
,
gridsize2
);
gridsize
=
gridsize1
;
size_t
gridsize
=
gridsize1
;
if
(
datatype1
!=
datatype2
)
{
if
(
datatype1
==
CDI_DATATYPE_FLT32
&&
datatype2
==
CDI_DATATYPE_FLT64
)
{
missval2
=
(
float
)
missval2
;
for
(
size_t
i
=
0
;
i
<
gridsize
;
i
++
)
array2
[
i
]
=
(
float
)
array2
[
i
];
}
else
if
(
datatype1
==
CDI_DATATYPE_FLT64
&&
datatype2
==
CDI_DATATYPE_FLT32
)
{
missval1
=
(
float
)
missval1
;
for
(
size_t
i
=
0
;
i
<
gridsize
;
i
++
)
array1
[
i
]
=
(
float
)
array1
[
i
];
}
}
if
(
operatorID
==
EQ
)
{
for
(
in
t
i
=
0
;
i
<
gridsize
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
gridsize
;
i
++
)
array3
[
i
]
=
(
DBL_IS_EQUAL
(
array1
[
i
],
missval1
)
||
DBL_IS_EQUAL
(
array2
[
i
],
missval2
)
?
missval1
:
DBL_
IS_EQUAL
(
array1
[
i
],
array2
[
i
]));
missval1
:
IS_EQUAL
(
array1
[
i
],
array2
[
i
]));
}
else
if
(
operatorID
==
NE
)
{
for
(
in
t
i
=
0
;
i
<
gridsize
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
gridsize
;
i
++
)
array3
[
i
]
=
(
DBL_IS_EQUAL
(
array1
[
i
],
missval1
)
||
DBL_IS_EQUAL
(
array2
[
i
],
missval2
)
?
missval1
:
!
DBL_IS
_EQUAL
(
array1
[
i
],
array2
[
i
]));
missval1
:
IS_NOT
_EQUAL
(
array1
[
i
],
array2
[
i
]));
}
else
if
(
operatorID
==
LE
)
{
for
(
in
t
i
=
0
;
i
<
gridsize
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
gridsize
;
i
++
)
array3
[
i
]
=
(
DBL_IS_EQUAL
(
array1
[
i
],
missval1
)
||
DBL_IS_EQUAL
(
array2
[
i
],
missval2
)
?
missval1
:
array1
[
i
]
<=
array2
[
i
]);
}
else
if
(
operatorID
==
LT
)
{
for
(
in
t
i
=
0
;
i
<
gridsize
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
gridsize
;
i
++
)
array3
[
i
]
=
(
DBL_IS_EQUAL
(
array1
[
i
],
missval1
)
||
DBL_IS_EQUAL
(
array2
[
i
],
missval2
)
?
missval1
:
array1
[
i
]
<
array2
[
i
]);
}
else
if
(
operatorID
==
GE
)
{
for
(
in
t
i
=
0
;
i
<
gridsize
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
gridsize
;
i
++
)
array3
[
i
]
=
(
DBL_IS_EQUAL
(
array1
[
i
],
missval1
)
||
DBL_IS_EQUAL
(
array2
[
i
],
missval2
)
?
missval1
:
array1
[
i
]
>=
array2
[
i
]);
}
else
if
(
operatorID
==
GT
)
{
for
(
in
t
i
=
0
;
i
<
gridsize
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
gridsize
;
i
++
)
array3
[
i
]
=
(
DBL_IS_EQUAL
(
array1
[
i
],
missval1
)
||
DBL_IS_EQUAL
(
array2
[
i
],
missval2
)
?
missval1
:
array1
[
i
]
>
array2
[
i
]);
}
...
...
@@ -267,7 +285,7 @@ void *Comp(void *argument)
}
size_t
nmiss3
=
0
;
for
(
in
t
i
=
0
;
i
<
gridsize
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
gridsize
;
i
++
)
if
(
DBL_IS_EQUAL
(
array3
[
i
],
missval1
)
)
nmiss3
++
;
pstreamDefRecord
(
streamID3
,
varID
,
levelID
);
...
...
src/Compc.cc
View file @
2c0607d1
...
...
@@ -37,10 +37,7 @@ void *Compc(void *argument)
{