[cdo] 77/84: Upstream 1.6.7
Alastair McKinstry
mckinstry at moszumanska.debian.org
Sat Jun 13 16:48:44 UTC 2015
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to branch master
in repository cdo.
commit fd09245a80ccd6e920ce823b04841d269d448494
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Tue Dec 16 19:02:40 2014 +0000
Upstream 1.6.7
---
AUTHORS | 10 +-
ChangeLog | 13 +
Makefile.in | 3 +
NEWS | 5 +
README | 2 +-
cdo.spec | 16 +-
cdo.spec.in | 14 +-
config/default | 2 +-
configure | 57 +-
configure.ac | 4 +-
contrib/Makefile.in | 3 +
contrib/cdoCompletion.bash | 1 +
contrib/cdoCompletion.tcsh | 1 +
contrib/cdoCompletion.zsh | 1 +
libcdi/ChangeLog | 21 +
libcdi/Makefile.in | 1 +
libcdi/NEWS | 5 +
libcdi/aclocal.m4 | 1 +
libcdi/app/Makefile.in | 1 +
libcdi/configure | 172 ++-
libcdi/configure.ac | 5 +-
libcdi/examples/Makefile.in | 1 +
libcdi/examples/cdi_copy.c | 31 +-
libcdi/examples/cdi_read.c | 24 +-
libcdi/examples/cdi_write.c | 43 +-
libcdi/examples/cdi_write_ens.c | 2 +-
libcdi/examples/pio/Makefile.in | 1 +
libcdi/examples/pio/compareResourcesArray.c | 1 -
libcdi/interfaces/Makefile.in | 1 +
libcdi/interfaces/f2003/bindGen.rb | 19 +-
libcdi/m4/acx_execinfo.m4 | 67 ++
libcdi/m4/acx_options.m4 | 11 +-
libcdi/src/Makefile.am | 2 +-
libcdi/src/Makefile.in | 3 +-
libcdi/src/cdf.c | 2 +-
libcdi/src/cdf_int.c | 2 -
libcdi/src/cdi.h | 3 +-
libcdi/src/cdi.inc | 4 +-
libcdi/src/cdi_cksum.c | 2 +-
libcdi/src/cdi_cksum.h | 2 +-
libcdi/src/cdi_error.c | 14 +-
libcdi/src/cdi_int.h | 54 +-
libcdi/src/cdilib.c | 1581 +++++++++++----------------
libcdi/src/cdipio.h | 4 +-
libcdi/src/cgribexlib.c | 17 +-
libcdi/src/config.h.in | 6 +
libcdi/src/dmemory.c | 10 +-
libcdi/src/gribapi.h | 4 +-
libcdi/src/grid.c | 87 +-
libcdi/src/mo_cdi.f90 | 100 +-
libcdi/src/namespace.c | 52 +-
libcdi/src/pio.c | 24 +-
libcdi/src/pio_comm.c | 6 +-
libcdi/src/pio_impl.h | 17 +-
libcdi/src/pio_interface.c | 11 +-
libcdi/src/pio_mpinonb.c | 115 +-
libcdi/src/pio_posixasynch.c | 51 +-
libcdi/src/pio_posixfpguardsendrecv.c | 49 +-
libcdi/src/pio_posixnonb.c | 31 +-
libcdi/src/pio_record_send.c | 53 +-
libcdi/src/pio_serialize.c | 3 +-
libcdi/src/pio_server.c | 30 +-
libcdi/src/resource_handle.c | 35 +-
libcdi/src/resource_unpack.c | 32 +-
libcdi/src/resource_unpack.h | 1 -
libcdi/src/serialize.c | 27 +-
libcdi/src/serialize.h | 84 +-
libcdi/src/stream.c | 100 +-
libcdi/src/stream_cdf.c | 300 +++--
libcdi/src/stream_cgribex.c | 175 ++-
libcdi/src/stream_ext.c | 2 +-
libcdi/src/stream_grb.c | 5 +-
libcdi/src/stream_gribapi.c | 28 +-
libcdi/src/stream_ieg.c | 25 +-
libcdi/src/stream_record.c | 6 -
libcdi/src/stream_srv.c | 2 +-
libcdi/src/taxis.c | 91 +-
libcdi/src/varscan.c | 5 +-
libcdi/src/vlist.c | 153 +--
libcdi/src/vlist.h | 8 +-
libcdi/src/vlist_att.c | 7 +-
libcdi/src/vlist_var.c | 102 +-
libcdi/src/zaxis.c | 167 +--
libcdi/tests/Makefile.in | 1 +
libcdi/tests/deco2d_model.c | 54 +-
libcdi/tests/simple_model.c | 32 +-
libcdi/tests/simple_model_helper.h | 10 +
libcdi/tests/test_cdf_read.c | 112 +-
libcdi/tests/test_cdf_transformation.in | 5 +
libcdi/tests/test_cdf_write.c | 7 +-
libcdi/tests/test_resource_copy.c | 2 -
m4/._ax_pthread.m4 | Bin 197 -> 0 bytes
m4/acx_options.m4 | 22 +-
src/Adisit.c | 2 +-
src/Arith.c | 2 +-
src/Arithc.c | 2 +-
src/Arithdays.c | 2 +-
src/Arithlat.c | 2 +-
src/CDIread.c | 2 +-
src/CDItest.c | 2 +-
src/CDIwrite.c | 40 +-
src/Cat.c | 2 +-
src/Change.c | 2 +-
src/Change_e5slm.c | 2 +-
src/Cloudlayer.c | 2 +-
src/Collgrid.c | 2 +-
src/Command.c | 2 +-
src/Comp.c | 2 +-
src/Compc.c | 2 +-
src/Complextorect.c | 2 +-
src/Cond.c | 2 +-
src/Cond2.c | 2 +-
src/Condc.c | 2 +-
src/Consecstat.c | 2 +-
src/Copy.c | 2 +-
src/Deltime.c | 2 +-
src/Derivepar.c | 2 +-
src/Detrend.c | 2 +-
src/Diff.c | 2 +-
src/Distgrid.c | 2 +-
src/Duplicate.c | 2 +-
src/EOFs.c | 2 +-
src/Echam5ini.c | 2 +-
src/Enlarge.c | 2 +-
src/Enlargegrid.c | 2 +-
src/Ensstat.c | 2 +-
src/Ensstat3.c | 2 +-
src/Ensval.c | 2 +-
src/Eof3d.c | 2 +-
src/Eofcoeff.c | 2 +-
src/Eofcoeff3d.c | 2 +-
src/Exprf.c | 2 +-
src/FC.c | 2 +-
src/Filedes.c | 2 +-
src/Fillmiss.c | 2 +-
src/Filter.c | 2 +-
src/Fldrms.c | 2 +-
src/Fldstat.c | 2 +-
src/Fldstat2.c | 2 +-
src/Fourier.c | 2 +-
src/Gengrid.c | 2 +-
src/Gradsdes.c | 143 +--
src/Gridboxstat.c | 2 +-
src/Gridcell.c | 2 +-
src/Gridsearch.c | 2 +-
src/Harmonic.c | 2 +-
src/Hi.c | 0
src/Histogram.c | 2 +-
src/Importamsr.c | 2 +-
src/Importbinary.c | 2 +-
src/Importcmsaf.c | 23 +-
src/Importobs.c | 2 +-
src/Info.c | 2 +-
src/Input.c | 2 +-
src/Intgrid.c | 2 +-
src/Intgridtraj.c | 2 +-
src/Intlevel.c | 2 +-
src/Intlevel3d.c | 18 +-
src/Intntime.c | 7 +-
src/Inttime.c | 2 +-
src/Intyear.c | 2 +-
src/Invert.c | 2 +-
src/Invertlev.c | 2 +-
src/Isosurface.c | 2 +-
src/Kvl.c | 2 +-
src/Log.c | 2 +-
src/Makefile.in | 3 +
src/Maskbox.c | 2 +-
src/Mastrfu.c | 2 +-
src/Math.c | 2 +-
src/Merge.c | 2 +-
src/Mergegrid.c | 2 +-
src/Mergetime.c | 2 +-
src/Merstat.c | 2 +-
src/Monarith.c | 2 +-
src/Mrotuv.c | 2 +-
src/Mrotuvb.c | 2 +-
src/Ninfo.c | 2 +-
src/Nmltest.c | 2 +-
src/Output.c | 2 +-
src/Outputgmt.c | 84 +-
src/Pack.c | 2 +-
src/Pinfo.c | 2 +-
src/Pressure.c | 2 +-
src/Regres.c | 2 +-
src/Remap.c | 2 +-
src/Remapeta.c | 2 +-
src/Replace.c | 2 +-
src/Replacevalues.c | 2 +-
src/Rhopot.c | 2 +-
src/Rotuv.c | 2 +-
src/Runstat.c | 6 +-
src/SSOpar.c | 2 +-
src/Seasstat.c | 2 +-
src/Selbox.c | 2 +-
src/Select.c | 2 +-
src/Seloperator.c | 2 +-
src/Selrec.c | 2 +-
src/Seltime.c | 2 +-
src/Selvar.c | 2 +-
src/Set.c | 2 +-
src/Setbox.c | 2 +-
src/Setgatt.c | 2 +-
src/Setgrid.c | 7 +-
src/Sethalo.c | 2 +-
src/Setmiss.c | 2 +-
src/Setpartab.c | 2 +-
src/Setrcaname.c | 2 +-
src/Settime.c | 2 +-
src/Setzaxis.c | 2 +-
src/Showinfo.c | 2 +-
src/Sinfo.c | 2 +-
src/Smooth9.c | 2 +-
src/Sort.c | 2 +-
src/Sorttimestamp.c | 2 +-
src/Specinfo.c | 11 +-
src/Spectral.c | 2 +-
src/Spectrum.c | 2 +-
src/Split.c | 2 +-
src/Splitrec.c | 2 +-
src/Splitsel.c | 2 +-
src/Splittime.c | 2 +-
src/Splityear.c | 2 +-
src/Subtrend.c | 2 +-
src/Tee.c | 2 +-
src/Templates.c | 2 +-
src/Test.c | 2 +-
src/Tests.c | 2 +-
src/Timselstat.c | 2 +-
src/Timsort.c | 2 +-
src/Timstat.c | 2 +-
src/Timstat2.c | 2 +-
src/Timstat3.c | 2 +-
src/Tinfo.c | 2 +-
src/Tocomplex.c | 2 +-
src/Transpose.c | 2 +-
src/Trend.c | 2 +-
src/Trms.c | 2 +-
src/Tstepcount.c | 2 +-
src/Vardup.c | 2 +-
src/Vargen.c | 2 +-
src/Varrms.c | 2 +-
src/Vertint.c | 2 +-
src/Vertstat.c | 2 +-
src/Vertwind.c | 2 +-
src/Wct.c | 0
src/Wind.c | 2 +-
src/Writegrid.c | 2 +-
src/Writerandom.c | 2 +-
src/YAR.c | 2 +-
src/Ydayarith.c | 2 +-
src/Ydaystat.c | 2 +-
src/Yearmonstat.c | 2 +-
src/Yhourarith.c | 2 +-
src/Yhourstat.c | 2 +-
src/Ymonarith.c | 2 +-
src/Ymonstat.c | 2 +-
src/Yseasstat.c | 2 +-
src/Zonstat.c | 2 +-
src/cdo.c | 10 +-
src/cdo.h | 52 +-
src/cdo_getopt.c | 2 +-
src/cdo_getopt.h | 2 +-
src/cdo_int.h | 2 +-
src/cdo_pthread.c | 2 +-
src/cdo_vlist.c | 2 +-
src/clipping/area.c | 58 +-
src/clipping/area.h | 16 +-
src/clipping/clipping.c | 39 +-
src/clipping/grid.h | 2 +-
src/clipping/intersection.c | 16 +-
src/commandline.c | 2 +-
src/const.h | 2 +-
src/ecacore.c | 0
src/ecautil.c | 0
src/exception.c | 37 +-
src/field.c | 2 +-
src/field.h | 2 +-
src/field2.c | 2 +-
src/fieldc.c | 2 +-
src/fieldmer.c | 2 +-
src/fieldzon.c | 2 +-
src/grid.c | 2 +-
src/grid_area.c | 2 +-
src/griddes.c | 31 +-
src/gridreference.c | 2 +-
src/history.c | 2 +-
src/institution.c | 2 +-
src/kvlist.c | 2 +-
src/kvlist.h | 2 +-
src/list.c | 2 +-
src/list.h | 2 +-
src/modules.c | 2 +-
src/modules.h | 2 +-
src/namelist.c | 2 +-
src/namelist.h | 2 +-
src/operator_help.h | 2 +-
src/pipe.c | 2 +-
src/pipe.h | 2 +-
src/process.c | 2 +-
src/process.h | 2 +-
src/pstream.c | 2 +-
src/pstream.h | 2 +-
src/pstream_int.h | 2 +-
src/readline.c | 2 +-
src/remap_conserv.c | 38 +-
src/remaplib.c | 2 +-
src/table.c | 2 +-
src/timer.c | 2 +-
src/util.c | 61 +-
src/util.h | 60 +-
src/zaxis.c | 2 +-
test/File.test.in | 97 ++
test/Makefile.am | 4 +-
test/Makefile.in | 32 +-
test/data/._netcdf_testfile01.nc | Bin 197 -> 0 bytes
test/data/Makefile.am | 3 +-
test/data/Makefile.in | 6 +-
test/data/file_F32_srv_ref | Bin 0 -> 71280 bytes
test/data/netcdf_testfile01_infon_ref | 24 +-
test/data/netcdf_testfile01_sinfon_ref | 6 +-
321 files changed, 2818 insertions(+), 2980 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index de45e83..5f7e5f2 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,6 +1,6 @@
-Uwe Schulzweida, Uwe.Schulzweida at zmaw.de, is the main author.
-Ralf Mueller, Ralf.Mueller at zmaw.de
-Luis Kornblueh, Luis.Kornblueh at zmaw.de
-Cedrick Ansorge, Cedrick.Ansorge at zmaw.de
-Ralf Quast, Ralf.Quast at brockmann-consult.de
+Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>, is the main author.
+Ralf Mueller, <ralf.mueller AT mpimet.mpg.de>
+Luis Kornblueh, <luis.kornblueh AT mpimet.mpg.de>
+Cedrick Ansorge, <cedrick.ansorge AT mpimet.mpg.de>
+Ralf Quast, <ralf.quast AT brockmann-consult.de>
diff --git a/ChangeLog b/ChangeLog
index a47cdf7..68d8a6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2014-12-11 Uwe Schulzweida
+
+ * using CDI library version 1.6.7
+ * Version 1.6.7 released
+
+2014-12-03 Uwe Schulzweida
+
+ * added File.test.in to test all file formats
+
+2014-12-02 Uwe Schulzweida
+
+ * GRIB_API: segfaults when writing grib2 files [Bug #5351]
+
2014-11-27 Uwe Schulzweida
* using CDI library version 1.6.6
diff --git a/Makefile.in b/Makefile.in
index b284a24..f788090 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -240,7 +240,10 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
ENABLE_DATA = @ENABLE_DATA@
ENABLE_EXTRA = @ENABLE_EXTRA@
ENABLE_GRIB = @ENABLE_GRIB@
+ENABLE_GRIBAPI = @ENABLE_GRIBAPI@
ENABLE_IEG = @ENABLE_IEG@
+ENABLE_NC2 = @ENABLE_NC2@
+ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NETCDF = @ENABLE_NETCDF@
ENABLE_SERVICE = @ENABLE_SERVICE@
EXEEXT = @EXEEXT@
diff --git a/NEWS b/NEWS
index 102e7d5..0776c46 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,11 @@
CDO NEWS
--------
+Version 1.6.7 (11 December 2014):
+
+ Fixed bugs:
+ * GRIB_API: segfaults when writing grib2 files [Bug #5351]
+
Version 1.6.6 (27 November 2014):
New operators:
diff --git a/README b/README
index 28a6912..e10a6dd 100644
--- a/README
+++ b/README
@@ -70,4 +70,4 @@ Porting:
Contact:
- Send questions, comments and bug reports to <http://code.zmaw.de/projects/cdo>
+ Send questions, comments and bug reports to <https://code.zmaw.de/projects/cdo>
diff --git a/cdo.spec b/cdo.spec
index 0ab3285..a6f0d96 100644
--- a/cdo.spec
+++ b/cdo.spec
@@ -4,14 +4,14 @@
Name: cdo
#BuildRequires:
-Version: 1.6.6
+Version: 1.6.7
Release: 1
Summary: Climate Data Operators
License: GNU GENERAL PUBLIC LICENSE Version 2, June 1991
Group: Productivity/Graphics/Visualization/Other
Requires: netcdf
Autoreqprov: on
-URL: http://code.zmaw.de/projects/cdo
+URL: https://code.zmaw.de/projects/cdo
Source0: cdo-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -24,12 +24,12 @@ operators available. The following table provides a brief overview of the main c
Authors:
--------
This program was developed at the Max-Planck-Institute for Meteorology.
- Uwe Schulzweida, Uwe.Schulzweida at zmaw.de, is the main author.
- Ralf Mueller, Ralf.Mueller at zmaw.de
- Luis Kornblueh, Luis.Kornblueh at zmaw.de
- Cedrick Ansorge, Cedrick.Ansorge at zmaw.de
- Ralf Quast, Ralf.Quast at brockmann-consult.de
- Send questions, comments and bug reports to <http://code.zmaw.de/projects/cdo>
+ Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>, is the main author.
+ Ralf Mueller, <ralf.mueller AT mpimet.mpg.de>
+ Luis Kornblueh, <luis.kornblueh AT mpimet.mpg.de>
+ Cedrick Ansorge, <cedrick.ansorge AT mpimet.mpg.de>
+ Ralf Quast, <ralf.quast AT brockmann-consult.de>
+ Send questions, comments and bug reports to <https://code.zmaw.de/projects/cdo>
%prep
diff --git a/cdo.spec.in b/cdo.spec.in
index 78bf9eb..057833d 100644
--- a/cdo.spec.in
+++ b/cdo.spec.in
@@ -11,7 +11,7 @@ License: GNU GENERAL PUBLIC LICENSE Version 2, June 1991
Group: Productivity/Graphics/Visualization/Other
Requires: netcdf
Autoreqprov: on
-URL: http://code.zmaw.de/projects/cdo
+URL: https://code.zmaw.de/projects/cdo
Source0: cdo-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -24,12 +24,12 @@ operators available. The following table provides a brief overview of the main c
Authors:
--------
This program was developed at the Max-Planck-Institute for Meteorology.
- Uwe Schulzweida, Uwe.Schulzweida at zmaw.de, is the main author.
- Ralf Mueller, Ralf.Mueller at zmaw.de
- Luis Kornblueh, Luis.Kornblueh at zmaw.de
- Cedrick Ansorge, Cedrick.Ansorge at zmaw.de
- Ralf Quast, Ralf.Quast at brockmann-consult.de
- Send questions, comments and bug reports to <http://code.zmaw.de/projects/cdo>
+ Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>, is the main author.
+ Ralf Mueller, <ralf.mueller AT mpimet.mpg.de>
+ Luis Kornblueh, <luis.kornblueh AT mpimet.mpg.de>
+ Cedrick Ansorge, <cedrick.ansorge AT mpimet.mpg.de>
+ Ralf Quast, <ralf.quast AT brockmann-consult.de>
+ Send questions, comments and bug reports to <https://code.zmaw.de/projects/cdo>
%prep
diff --git a/config/default b/config/default
index 057fe8c..7de3ed3 100755
--- a/config/default
+++ b/config/default
@@ -31,7 +31,7 @@ case "${HOSTNAME}" in
bailung*|d133*|d134*)
CDOLIBS="--with-fftw3 \
--with-jasper=$HOME/local \
- --with-grib_api=$HOME/local/gribapi-1.13.0 \
+ --with-grib_api=$HOME/local/gribapi-1.12.3 \
--with-netcdf=$HOME/local \
--with-hdf5=$HOME/local \
--with-szlib=$HOME/local \
diff --git a/configure b/configure
index 08acc19..eec326f 100755
--- a/configure
+++ b/configure
@@ -1,8 +1,8 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for cdo 1.6.6.
+# Generated by GNU Autoconf 2.68 for cdo 1.6.7.
#
-# Report bugs to <http://code.zmaw.de/projects/cdo>.
+# Report bugs to <https://code.zmaw.de/projects/cdo>.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -247,7 +247,7 @@ fi
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$0: Please tell bug-autoconf at gnu.org and
-$0: http://code.zmaw.de/projects/cdo about your system,
+$0: https://code.zmaw.de/projects/cdo about your system,
$0: including any error possibly output before this
$0: message. Then install a modern shell, or manually run
$0: the script under such a shell if you do have one."
@@ -570,9 +570,9 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='cdo'
PACKAGE_TARNAME='cdo'
-PACKAGE_VERSION='1.6.6'
-PACKAGE_STRING='cdo 1.6.6'
-PACKAGE_BUGREPORT='http://code.zmaw.de/projects/cdo'
+PACKAGE_VERSION='1.6.7'
+PACKAGE_STRING='cdo 1.6.7'
+PACKAGE_BUGREPORT='https://code.zmaw.de/projects/cdo'
PACKAGE_URL=''
# Factoring default headers for most tests.
@@ -650,12 +650,15 @@ ENABLE_EXTRA
ENABLE_SERVICE
ENABLE_CGRIBEX
ENABLE_GRIB
+ENABLE_GRIBAPI
GRIB_API_LIBS
GRIB_API_INCLUDE
JASPER_LIBS
NETCDF_LIBS
NETCDF_INCLUDE
NETCDF_ROOT
+ENABLE_NC4
+ENABLE_NC2
ENABLE_NETCDF
NC_CONFIG
HDF5_LIBS
@@ -1391,7 +1394,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.6.6 to adapt to many kinds of systems.
+\`configure' configures cdo 1.6.7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1461,7 +1464,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of cdo 1.6.6:";;
+ short | recursive ) echo "Configuration of cdo 1.6.7:";;
esac
cat <<\_ACEOF
@@ -1552,7 +1555,7 @@ Some influential environment variables:
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
-Report bugs to <http://code.zmaw.de/projects/cdo>.
+Report bugs to <https://code.zmaw.de/projects/cdo>.
_ACEOF
ac_status=$?
fi
@@ -1615,7 +1618,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-cdo configure 1.6.6
+cdo configure 1.6.7
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2138,9 +2141,9 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## ----------------------------------------------- ##
-## Report this to http://code.zmaw.de/projects/cdo ##
-## ----------------------------------------------- ##"
+( $as_echo "## ------------------------------------------------ ##
+## Report this to https://code.zmaw.de/projects/cdo ##
+## ------------------------------------------------ ##"
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
@@ -2208,7 +2211,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.6.6, which was
+It was created by cdo $as_me 1.6.7, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -3151,7 +3154,7 @@ fi
# Define the identity of the package.
PACKAGE='cdo'
- VERSION='1.6.6'
+ VERSION='1.6.7'
cat >>confdefs.h <<_ACEOF
@@ -18643,10 +18646,12 @@ fi
# ----------------------------------------------------------------------
# Compile application with netcdf
-ENABLE_NETCDF=no
NETCDF_ROOT=''
NETCDF_INCLUDE=''
NETCDF_LIBS=''
+ENABLE_NETCDF=no
+ENABLE_NC2=no
+ENABLE_NC4=no
# Check whether --with-netcdf was given.
if test "${with_netcdf+set}" = set; then :
@@ -18775,6 +18780,7 @@ $as_echo_n "checking netcdf's nc2 support... " >&6; }
$as_echo "#define HAVE_NETCDF2 1" >>confdefs.h
+ ENABLE_NC2=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
@@ -18787,6 +18793,7 @@ $as_echo_n "checking netcdf's nc4 support... " >&6; }
$as_echo "#define HAVE_NETCDF4 1" >>confdefs.h
+ ENABLE_NC4=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
@@ -18935,6 +18942,7 @@ $as_echo_n "checking netcdf's nc2 support... " >&6; }
$as_echo "#define HAVE_NETCDF2 1" >>confdefs.h
+ ENABLE_NC2=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
@@ -18947,6 +18955,7 @@ $as_echo_n "checking netcdf's nc4 support... " >&6; }
$as_echo "#define HAVE_NETCDF4 1" >>confdefs.h
+ ENABLE_NC4=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
@@ -18975,6 +18984,8 @@ fi
+
+
# ----------------------------------------------------------------------
# Link application with JASPER library (needed for GRIB2 compression)
JASPER_LIBS=''
@@ -19146,6 +19157,7 @@ fi
# Compile application with GRIB_API library (for GRIB2 support)
GRIB_API_INCLUDE=''
GRIB_API_LIBS=''
+ENABLE_GRIBAPI=no
# Check whether --with-grib_api was given.
if test "${with_grib_api+set}" = set; then :
@@ -19224,6 +19236,7 @@ if test "$ac_res" != no; then :
$as_echo "#define HAVE_LIBGRIB_API 1" >>confdefs.h
+ ENABLE_GRIBAPI=yes
else
as_fn_error $? "Could not link to grib_api library" "$LINENO" 5
fi
@@ -19301,6 +19314,7 @@ if test "$ac_res" != no; then :
$as_echo "#define HAVE_LIBGRIB_API 1" >>confdefs.h
+ ENABLE_GRIBAPI=yes
else
as_fn_error $? "Could not link to grib_api library" "$LINENO" 5
fi
@@ -19322,6 +19336,7 @@ fi
+
# ----------------------------------------------------------------------
# Enable GRIB support
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GRIB support" >&5
@@ -20765,7 +20780,7 @@ fi
done
-ac_config_files="$ac_config_files test/Read_grib.test test/Read_netcdf.test test/Copy_netcdf.test"
+ac_config_files="$ac_config_files test/File.test test/Read_grib.test test/Read_netcdf.test test/Copy_netcdf.test"
ac_config_files="$ac_config_files test/Cat.test test/Gridarea.test test/Genweights.test test/Remap.test"
@@ -21349,7 +21364,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.6.6, which was
+This file was extended by cdo $as_me 1.6.7, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21409,13 +21424,13 @@ $config_headers
Configuration commands:
$config_commands
-Report bugs to <http://code.zmaw.de/projects/cdo>."
+Report bugs to <https://code.zmaw.de/projects/cdo>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-cdo config.status 1.6.6
+cdo config.status 1.6.7
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
@@ -21922,6 +21937,7 @@ do
"src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+ "test/File.test") CONFIG_FILES="$CONFIG_FILES test/File.test" ;;
"test/Read_grib.test") CONFIG_FILES="$CONFIG_FILES test/Read_grib.test" ;;
"test/Read_netcdf.test") CONFIG_FILES="$CONFIG_FILES test/Read_netcdf.test" ;;
"test/Copy_netcdf.test") CONFIG_FILES="$CONFIG_FILES test/Copy_netcdf.test" ;;
@@ -23427,6 +23443,7 @@ compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
_LT_EOF
;;
+ "test/File.test":F) chmod a+x "$ac_file" ;;
"test/Read_grib.test":F) chmod a+x "$ac_file" ;;
"test/Read_netcdf.test":F) chmod a+x "$ac_file" ;;
"test/Copy_netcdf.test":F) chmod a+x "$ac_file" ;;
diff --git a/configure.ac b/configure.ac
index 135647b..ae80214 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@
# autoconf 2.68
# libtool 2.4.2
-AC_INIT([cdo], [1.6.6], [http://code.zmaw.de/projects/cdo])
+AC_INIT([cdo], [1.6.7], [https://code.zmaw.de/projects/cdo])
CONFIG_ABORT=yes
AC_CONFIG_AUX_DIR(config)
@@ -214,7 +214,7 @@ AC_DEFINE_UNQUOTED(COMPILER, ["$COMPILER"], [Compiler])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AC_PROG_AWK
-AC_CONFIG_FILES([test/Read_grib.test test/Read_netcdf.test test/Copy_netcdf.test],[chmod a+x "$ac_file"])
+AC_CONFIG_FILES([test/File.test test/Read_grib.test test/Read_netcdf.test test/Copy_netcdf.test],[chmod a+x "$ac_file"])
AC_CONFIG_FILES([test/Cat.test test/Gridarea.test test/Genweights.test test/Remap.test],[chmod a+x "$ac_file"])
AC_CONFIG_FILES([test/Select.test test/Spectral.test test/Timstat.test test/Vertint.test],[chmod a+x "$ac_file"])
AC_CONFIG_FILES([test/Detrend.test test/Arith.test],[chmod a+x "$ac_file"])
diff --git a/contrib/Makefile.in b/contrib/Makefile.in
index 58c7759..68f1539 100644
--- a/contrib/Makefile.in
+++ b/contrib/Makefile.in
@@ -152,7 +152,10 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
ENABLE_DATA = @ENABLE_DATA@
ENABLE_EXTRA = @ENABLE_EXTRA@
ENABLE_GRIB = @ENABLE_GRIB@
+ENABLE_GRIBAPI = @ENABLE_GRIBAPI@
ENABLE_IEG = @ENABLE_IEG@
+ENABLE_NC2 = @ENABLE_NC2@
+ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NETCDF = @ENABLE_NETCDF@
ENABLE_SERVICE = @ENABLE_SERVICE@
EXEEXT = @EXEEXT@
diff --git a/contrib/cdoCompletion.bash b/contrib/cdoCompletion.bash
index 83b100c..4be65ed 100644
--- a/contrib/cdoCompletion.bash
+++ b/contrib/cdoCompletion.bash
@@ -1,6 +1,7 @@
complete -W "
-- \
-- \
+-- \
-L \
-M \
-O \
diff --git a/contrib/cdoCompletion.tcsh b/contrib/cdoCompletion.tcsh
index 6ec31a3..86932e0 100644
--- a/contrib/cdoCompletion.tcsh
+++ b/contrib/cdoCompletion.tcsh
@@ -1,6 +1,7 @@
set cdoCmpl = (\
- \
- \
+- \
L \
M \
O \
diff --git a/contrib/cdoCompletion.zsh b/contrib/cdoCompletion.zsh
index 7f46403..8154886 100644
--- a/contrib/cdoCompletion.zsh
+++ b/contrib/cdoCompletion.zsh
@@ -1,6 +1,7 @@
compctl -k "(
-- \
-- \
+-- \
-L \
-M \
-O \
diff --git a/libcdi/ChangeLog b/libcdi/ChangeLog
index 7474812..ddae508 100644
--- a/libcdi/ChangeLog
+++ b/libcdi/ChangeLog
@@ -1,3 +1,24 @@
+2014-12-11 Uwe Schulzweida
+
+ * Version 1.6.7 released
+
+2014-12-10 Uwe Schulzweida
+
+ * vlistDefAttXXX: limit length of attribute name to CDI_MAX_NAME
+
+2014-12-05 Uwe Schulzweida
+
+ * netCDF absolute time axis with units month: change day from 00 to 01
+ * netCDF absolute time axis with units year: change month/day from 0000 to 0101
+
+2014-12-03 Uwe Schulzweida
+
+ * gribapi: time dependent metadata [Feature #4720]
+
+2014-12-01 Uwe Schulzweida
+
+ * GRIB_API output does not work (bug fix)
+
2014-11-27 Uwe Schulzweida
* Version 1.6.6 released
diff --git a/libcdi/Makefile.in b/libcdi/Makefile.in
index 705f5ce..c65dca1 100644
--- a/libcdi/Makefile.in
+++ b/libcdi/Makefile.in
@@ -97,6 +97,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
$(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \
$(top_srcdir)/m4/acx_check_strptr_convert.m4 \
+ $(top_srcdir)/m4/acx_execinfo.m4 \
$(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \
$(top_srcdir)/m4/acx_options.m4 \
$(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \
diff --git a/libcdi/NEWS b/libcdi/NEWS
index 9a15890..17fc3c3 100644
--- a/libcdi/NEWS
+++ b/libcdi/NEWS
@@ -1,6 +1,11 @@
CDI NEWS
--------
+Version 1.6.7 (5 December 2014):
+
+ Fixed bugs:
+ * GRIB2 output does not work
+
Version 1.6.6 (27 November 2014):
New features:
diff --git a/libcdi/aclocal.m4 b/libcdi/aclocal.m4
index a8d0bc4..31d3d16 100644
--- a/libcdi/aclocal.m4
+++ b/libcdi/aclocal.m4
@@ -1185,6 +1185,7 @@ AC_SUBST([am__untar])
m4_include([m4/acx_assert_lang_is_fortran_variant.m4])
m4_include([m4/acx_check_strptr_convert.m4])
+m4_include([m4/acx_execinfo.m4])
m4_include([m4/acx_lang_other_suffix_conftest.m4])
m4_include([m4/acx_options.m4])
m4_include([m4/acx_sl_fc_mod_path_flag.m4])
diff --git a/libcdi/app/Makefile.in b/libcdi/app/Makefile.in
index 1bfdd48..dab9325 100644
--- a/libcdi/app/Makefile.in
+++ b/libcdi/app/Makefile.in
@@ -90,6 +90,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
$(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \
$(top_srcdir)/m4/acx_check_strptr_convert.m4 \
+ $(top_srcdir)/m4/acx_execinfo.m4 \
$(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \
$(top_srcdir)/m4/acx_options.m4 \
$(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \
diff --git a/libcdi/configure b/libcdi/configure
index 726aef4..1467627 100755
--- a/libcdi/configure
+++ b/libcdi/configure
@@ -1,8 +1,8 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for cdi 1.6.6.
+# Generated by GNU Autoconf 2.68 for cdi 1.6.7.
#
-# Report bugs to <http://code.zmaw.de/projects/cdi>.
+# Report bugs to <https://code.zmaw.de/projects/cdi>.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -247,7 +247,7 @@ fi
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$0: Please tell bug-autoconf at gnu.org and
-$0: http://code.zmaw.de/projects/cdi about your system,
+$0: https://code.zmaw.de/projects/cdi about your system,
$0: including any error possibly output before this
$0: message. Then install a modern shell, or manually run
$0: the script under such a shell if you do have one."
@@ -570,9 +570,9 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='cdi'
PACKAGE_TARNAME='cdi'
-PACKAGE_VERSION='1.6.6'
-PACKAGE_STRING='cdi 1.6.6'
-PACKAGE_BUGREPORT='http://code.zmaw.de/projects/cdi'
+PACKAGE_VERSION='1.6.7'
+PACKAGE_STRING='cdi 1.6.7'
+PACKAGE_BUGREPORT='https://code.zmaw.de/projects/cdi'
PACKAGE_URL=''
# Factoring default headers for most tests.
@@ -1448,7 +1448,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 cdi 1.6.6 to adapt to many kinds of systems.
+\`configure' configures cdi 1.6.7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1518,7 +1518,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of cdi 1.6.6:";;
+ short | recursive ) echo "Configuration of cdi 1.6.7:";;
esac
cat <<\_ACEOF
@@ -1642,7 +1642,7 @@ Some influential environment variables:
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
-Report bugs to <http://code.zmaw.de/projects/cdi>.
+Report bugs to <https://code.zmaw.de/projects/cdi>.
_ACEOF
ac_status=$?
fi
@@ -1705,7 +1705,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-cdi configure 1.6.6
+cdi configure 1.6.7
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2396,9 +2396,9 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## ----------------------------------------------- ##
-## Report this to http://code.zmaw.de/projects/cdi ##
-## ----------------------------------------------- ##"
+( $as_echo "## ------------------------------------------------ ##
+## Report this to https://code.zmaw.de/projects/cdi ##
+## ------------------------------------------------ ##"
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
@@ -2466,7 +2466,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 cdi $as_me 1.6.6, which was
+It was created by cdi $as_me 1.6.7, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -3411,7 +3411,7 @@ fi
# Define the identity of the package.
PACKAGE='cdi'
- VERSION='1.6.6'
+ VERSION='1.6.7'
cat >>confdefs.h <<_ACEOF
@@ -24326,7 +24326,7 @@ fi
# ----------------------------------------------------------------------
# Checks for header files
-for ac_header in malloc.h execinfo.h uuid.h uuid/uuid.h
+for ac_header in malloc.h uuid.h uuid/uuid.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -24339,6 +24339,134 @@ fi
done
+for ac_header in execinfo.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default"
+if test "x$ac_cv_header_execinfo_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_EXECINFO_H 1
+_ACEOF
+
+fi
+
+done
+
+ if test x"$ac_cv_header_execinfo_h" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking size parameter type for backtrace()" >&5
+$as_echo_n "checking size parameter type for backtrace()... " >&6; }
+if ${ax_cv_proto_backtrace_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ for ax_cv_proto_backtrace_type in size_t int none; do
+ if test "${ax_cv_proto_backtrace_type}" = none; then :
+ ax_cv_proto_backtrace_type= ; break
+fi
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <execinfo.h>
+extern
+${ax_cv_proto_backtrace_type} backtrace(void **addrlist, ${ax_cv_proto_backtrace_type} len);
+char **backtrace_symbols(void *const *buffer, ${ax_cv_proto_backtrace_type} size);
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_proto_backtrace_type" >&5
+$as_echo "$ax_cv_proto_backtrace_type" >&6; }
+fi
+ if test x${ax_cv_proto_backtrace_type} != x; then :
+
+cat >>confdefs.h <<_ACEOF
+#define backtrace_size_t $ax_cv_proto_backtrace_type
+_ACEOF
+
+fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing backtrace" >&5
+$as_echo_n "checking for library containing backtrace... " >&6; }
+if ${ac_cv_search_backtrace+:} 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 backtrace ();
+int
+main ()
+{
+return backtrace ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' execinfo; 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_backtrace=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_backtrace+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_backtrace+:} false; then :
+
+else
+ ac_cv_search_backtrace=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_backtrace" >&5
+$as_echo "$ac_cv_search_backtrace" >&6; }
+ac_res=$ac_cv_search_backtrace
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+ if test x"${ax_cv_proto_backtrace_type}" != x -a x"$ac_cv_header_execinfo_h" = xyes -a x"$ac_cv_search_backtrace" != xno; then :
+
+$as_echo "#define HAVE_BACKTRACE 1" >>confdefs.h
+
+
+fi
# ----------------------------------------------------------------------
# Checks for the availability of functions
for ac_func in mallinfo
@@ -25992,9 +26120,9 @@ $as_echo_n "checking netcdf's nc2 support... " >&6; }
$as_echo "#define HAVE_NETCDF2 1" >>confdefs.h
+ ENABLE_NC2=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- ENABLE_NC2=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
@@ -26005,8 +26133,8 @@ $as_echo_n "checking netcdf's nc4 support... " >&6; }
$as_echo "#define HAVE_NETCDF4 1" >>confdefs.h
- ENABLE_NC4=yes
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ ENABLE_NC4=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -28681,7 +28809,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 cdi $as_me 1.6.6, which was
+This file was extended by cdi $as_me 1.6.7, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -28741,13 +28869,13 @@ $config_headers
Configuration commands:
$config_commands
-Report bugs to <http://code.zmaw.de/projects/cdi>."
+Report bugs to <https://code.zmaw.de/projects/cdi>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-cdi config.status 1.6.6
+cdi config.status 1.6.7
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
diff --git a/libcdi/configure.ac b/libcdi/configure.ac
index 27f0311..094cc38 100644
--- a/libcdi/configure.ac
+++ b/libcdi/configure.ac
@@ -4,7 +4,7 @@
# autoconf 2.68
# libtool 2.4.2
-AC_INIT([cdi], [1.6.6], [http://code.zmaw.de/projects/cdi])
+AC_INIT([cdi], [1.6.7], [https://code.zmaw.de/projects/cdi])
echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}"
@@ -64,7 +64,8 @@ AC_CHECK_LIB(malloc, malloc)
AC_CHECK_MEMBERS([struct stat.st_blksize])
# ----------------------------------------------------------------------
# Checks for header files
-AC_CHECK_HEADERS([malloc.h execinfo.h uuid.h uuid/uuid.h])
+AC_CHECK_HEADERS([malloc.h uuid.h uuid/uuid.h])
+AX_EXECINFO
# ----------------------------------------------------------------------
# Checks for the availability of functions
AC_CHECK_FUNCS([mallinfo])
diff --git a/libcdi/examples/Makefile.in b/libcdi/examples/Makefile.in
index 40f33e0..33c054c 100644
--- a/libcdi/examples/Makefile.in
+++ b/libcdi/examples/Makefile.in
@@ -90,6 +90,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
$(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \
$(top_srcdir)/m4/acx_check_strptr_convert.m4 \
+ $(top_srcdir)/m4/acx_execinfo.m4 \
$(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \
$(top_srcdir)/m4/acx_options.m4 \
$(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \
diff --git a/libcdi/examples/cdi_copy.c b/libcdi/examples/cdi_copy.c
index a5729cb..fa98702 100644
--- a/libcdi/examples/cdi_copy.c
+++ b/libcdi/examples/cdi_copy.c
@@ -1,51 +1,46 @@
#include <stdio.h>
#include "cdi.h"
-int nlon = 12; // Number of longitudes
-int nlat = 6; // Number of latitudes
-int nlev = 5; // Number of levels
-int nts = 3; // Number of time steps
-
int main(void)
{
- int taxisID, vlistID1, vlistID2, varID1, varID2, streamID1, streamID2, tsID;
+ const int nlon = 12; // Number of longitudes
+ const int nlat = 6; // Number of latitudes
+ const int nlev = 5; // Number of levels
+ const int nts = 3; // Number of time steps
int nmiss;
double var1[nlon*nlat];
double var2[nlon*nlat*nlev];
// Open the input dataset
- streamID1 = streamOpenRead("example.nc");
+ int streamID1 = streamOpenRead("example.nc");
if ( streamID1 < 0 )
{
fprintf(stderr, "%s\n", cdiStringError(streamID1));
- return(1);
+ return 1;
}
// Get the variable list of the dataset
- vlistID1 = streamInqVlist(streamID1);
+ int vlistID1 = streamInqVlist(streamID1);
// Set the variable IDs
- varID1 = 0;
- varID2 = 1;
-
- // Get the Time axis from the variable list
- taxisID = vlistInqTaxis(vlistID1);
+ int varID1 = 0;
+ int varID2 = 1;
// Open the output dataset (GRIB format)
- streamID2 = streamOpenWrite("example.grb", FILETYPE_GRB);
+ int streamID2 = streamOpenWrite("example.grb", FILETYPE_GRB);
if ( streamID2 < 0 )
{
fprintf(stderr, "%s\n", cdiStringError(streamID2));
- return(1);
+ return 1;
}
- vlistID2 = vlistDuplicate(vlistID1);
+ int vlistID2 = vlistDuplicate(vlistID1);
streamDefVlist(streamID2, vlistID2);
// Loop over the number of time steps
- for ( tsID = 0; tsID < nts; tsID++ )
+ for ( int tsID = 0; tsID < nts; tsID++ )
{
// Inquire the input time step
streamInqTimestep(streamID1, tsID);
diff --git a/libcdi/examples/cdi_read.c b/libcdi/examples/cdi_read.c
index cc89486..9c1d238 100644
--- a/libcdi/examples/cdi_read.c
+++ b/libcdi/examples/cdi_read.c
@@ -1,39 +1,37 @@
#include <stdio.h>
#include "cdi.h"
-int nlon = 12; // Number of longitudes
-int nlat = 6; // Number of latitudes
-int nlev = 5; // Number of levels
-int nts = 3; // Number of time steps
-
int main(void)
{
- int taxisID, vlistID, varID1, varID2, streamID, tsID;
+ const int nlon = 12; // Number of longitudes
+ const int nlat = 6; // Number of latitudes
+ const int nlev = 5; // Number of levels
+ const int nts = 3; // Number of time steps
int nmiss, vdate, vtime;
double var1[nlon*nlat];
double var2[nlon*nlat*nlev];
// Open the dataset
- streamID = streamOpenRead("example.nc");
+ int streamID = streamOpenRead("example.nc");
if ( streamID < 0 )
{
fprintf(stderr, "%s\n", cdiStringError(streamID));
- return(1);
+ return 1;
}
// Get the variable list of the dataset
- vlistID = streamInqVlist(streamID);
+ int vlistID = streamInqVlist(streamID);
// Set the variable IDs
- varID1 = 0;
- varID2 = 1;
+ int varID1 = 0;
+ int varID2 = 1;
// Get the Time axis from the variable list
- taxisID = vlistInqTaxis(vlistID);
+ int taxisID = vlistInqTaxis(vlistID);
// Loop over the number of time steps
- for ( tsID = 0; tsID < nts; tsID++ )
+ for ( int tsID = 0; tsID < nts; tsID++ )
{
// Inquire the time step
streamInqTimestep(streamID, tsID);
diff --git a/libcdi/examples/cdi_write.c b/libcdi/examples/cdi_write.c
index da7ae2d..0910c99 100644
--- a/libcdi/examples/cdi_write.c
+++ b/libcdi/examples/cdi_write.c
@@ -1,67 +1,64 @@
#include <stdio.h>
#include "cdi.h"
-#define nlon 12 // Number of longitudes
-#define nlat 6 // Number of latitudes
-#define nlev 5 // Number of levels
-#define nts 3 // Number of time steps
-
int main(void)
{
- int gridID, zaxisID1, zaxisID2, taxisID;
- int vlistID, varID1, varID2, streamID, tsID;
- int i, nmiss = 0;
- double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
- double lats[nlat] = {-75, -45, -15, 15, 45, 75};
- double levs[nlev] = {101300, 92500, 85000, 50000, 20000};
+ const int nlon = 12; // Number of longitudes
+ const int nlat = 6; // Number of latitudes
+ const int nlev = 5; // Number of levels
+ const int nts = 3; // Number of time steps
+ int nmiss = 0;
+ double lons[] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
+ double lats[] = {-75, -45, -15, 15, 45, 75};
+ double levs[] = {101300, 92500, 85000, 50000, 20000};
double var1[nlon*nlat];
double var2[nlon*nlat*nlev];
// Create a regular lon/lat grid
- gridID = gridCreate(GRID_LONLAT, nlon*nlat);
+ int gridID = gridCreate(GRID_LONLAT, nlon*nlat);
gridDefXsize(gridID, nlon);
gridDefYsize(gridID, nlat);
gridDefXvals(gridID, lons);
gridDefYvals(gridID, lats);
// Create a surface level Z-axis
- zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1);
+ int zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1);
// Create a pressure level Z-axis
- zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev);
+ int zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev);
zaxisDefLevels(zaxisID2, levs);
// Create a variable list
- vlistID = vlistCreate();
+ int vlistID = vlistCreate();
// Define the variables
- varID1 = vlistDefVar(vlistID, gridID, zaxisID1, TSTEP_INSTANT);
- varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TSTEP_INSTANT);
+ int varID1 = vlistDefVar(vlistID, gridID, zaxisID1, TSTEP_INSTANT);
+ int varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TSTEP_INSTANT);
// Define the variable names
vlistDefVarName(vlistID, varID1, "varname1");
vlistDefVarName(vlistID, varID2, "varname2");
// Create a Time axis
- taxisID = taxisCreate(TAXIS_ABSOLUTE);
+ int taxisID = taxisCreate(TAXIS_ABSOLUTE);
// Assign the Time axis to the variable list
vlistDefTaxis(vlistID, taxisID);
// Create a dataset in netCDF format
- streamID = streamOpenWrite("example.nc", FILETYPE_NC);
+ int streamID = streamOpenWrite("example.nc", FILETYPE_NC);
if ( streamID < 0 )
{
fprintf(stderr, "%s\n", cdiStringError(streamID));
- return(1);
+ return 1;
}
// Assign the variable list to the dataset
streamDefVlist(streamID, vlistID);
// Loop over the number of time steps
- for ( tsID = 0; tsID < nts; tsID++ )
+ for ( int tsID = 0; tsID < nts; tsID++ )
{
// Set the verification date to 1985-01-01 + tsID
taxisDefVdate(taxisID, 19850101+tsID);
@@ -71,8 +68,8 @@ int main(void)
streamDefTimestep(streamID, tsID);
// Init var1 and var2
- for ( i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1;
- for ( i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2;
+ for ( int i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1;
+ for ( int i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2;
// Write var1 and var2
streamWriteVar(streamID, varID1, var1, nmiss);
diff --git a/libcdi/examples/cdi_write_ens.c b/libcdi/examples/cdi_write_ens.c
index d05b809..6adea9f 100644
--- a/libcdi/examples/cdi_write_ens.c
+++ b/libcdi/examples/cdi_write_ens.c
@@ -4,7 +4,7 @@
#include "cdi.h"
-int main(int argc, char *argv[])
+int main(void)
{
char fname[] = "test_ens.grb2";
int filetype = FILETYPE_GRB2;
diff --git a/libcdi/examples/pio/Makefile.in b/libcdi/examples/pio/Makefile.in
index 4d51a50..ec6029c 100644
--- a/libcdi/examples/pio/Makefile.in
+++ b/libcdi/examples/pio/Makefile.in
@@ -91,6 +91,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
$(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \
$(top_srcdir)/m4/acx_check_strptr_convert.m4 \
+ $(top_srcdir)/m4/acx_execinfo.m4 \
$(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \
$(top_srcdir)/m4/acx_options.m4 \
$(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \
diff --git a/libcdi/examples/pio/compareResourcesArray.c b/libcdi/examples/pio/compareResourcesArray.c
index e97daa9..53dc0f5 100644
--- a/libcdi/examples/pio/compareResourcesArray.c
+++ b/libcdi/examples/pio/compareResourcesArray.c
@@ -15,7 +15,6 @@
#include "resource_unpack.h"
extern int reshListCompare ( int, int );
-extern void arrayDestroy ( void );
enum {
IOMode = PIO_NONE,
diff --git a/libcdi/interfaces/Makefile.in b/libcdi/interfaces/Makefile.in
index 49846b5..40faeee 100644
--- a/libcdi/interfaces/Makefile.in
+++ b/libcdi/interfaces/Makefile.in
@@ -97,6 +97,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
$(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \
$(top_srcdir)/m4/acx_check_strptr_convert.m4 \
+ $(top_srcdir)/m4/acx_execinfo.m4 \
$(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \
$(top_srcdir)/m4/acx_options.m4 \
$(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \
diff --git a/libcdi/interfaces/f2003/bindGen.rb b/libcdi/interfaces/f2003/bindGen.rb
index 68dc32b..6cff430 100755
--- a/libcdi/interfaces/f2003/bindGen.rb
+++ b/libcdi/interfaces/f2003/bindGen.rb
@@ -209,7 +209,7 @@ def printParams(fParams, indent)
value = 'value'
end
- typeinfo = [value,intent,dimension].select {|s| ! s.nil?}.join(',')
+ typeinfo = [value,intent,dimension].select {|s| ! s.nil?}.join(', ')
out << " #{indent}#{ftype}"
out << (paramType == 'c_ptr' ? '' : "(kind=#{paramType})")
out << ", #{typeinfo} :: #{param}\n"
@@ -219,15 +219,15 @@ end
# creates the actual binding within the module for the given c function
# unsupported types of function a ignored, see RESTRICTIONS (top) for details
-def genInterface(cFuncname, returnType, returnPointer, paramList)
+def genInterface(cFuncname, returnType, returnPointer, paramList, debug)
- # do not create interfaces for unsuppoerted function
+ # do not create interfaces for unsupported functions
if isBadFunction( returnType, returnPointer, paramList)
warn "parameterlist of '#{cFuncname}' is not supported -> function ignored."
return ['','']
end
return ['', ''] if (cFuncname[0,1] == '_')
- # the void argument type can be left out: if 'void' occures in the
+ # the void argument type can be left out: if 'void' occurs in the
# parameterlist (which is only the case, if it is the only parameter
# information), it is simply removed and a empty paramter list is left.
paramList = [[],[]] if paramList.flatten == [ 'void' ] or paramList.flatten.empty?
@@ -246,6 +246,15 @@ def genInterface(cFuncname, returnType, returnPointer, paramList)
# collect information for setting the correct fortran type for each parameter
paramsWithTypes = paramList.collect {|paramInfo|
ctype, param = paramInfo[-2,2]
+ integral_type = /^(:?char|int|long|short)$/.match(ctype);
+ if (integral_type)
+ while (/^(:?un)?signed/.match(paramInfo[-3]))
+ ctype = paramInfo[-3] << ' ' << ctype
+ paramInfo.delete_at(-3)
+ paramInfo[-2] = ctype
+ pp [paramInfo] if debug
+ end
+ end
ptr_match = /^\*(\w+)$/.match(param)
if (/^(:?const)? *void$/.match(ctype) and ptr_match)
param = ptr_match[1]
@@ -465,7 +474,7 @@ end.parse!
funcdecls.each {| funcName, returnType, returnPointer, paramList|
pp [funcName, returnType, returnPointer, paramList] if debug
- interface, makepublic, isWrapper = genInterface(funcName,returnType, returnPointer, paramList)
+ interface, makepublic, isWrapper = genInterface(funcName,returnType, returnPointer, paramList, debug)
if isWrapper
subroutines << interface
else
diff --git a/libcdi/m4/acx_execinfo.m4 b/libcdi/m4/acx_execinfo.m4
new file mode 100644
index 0000000..aa2f85a
--- /dev/null
+++ b/libcdi/m4/acx_execinfo.m4
@@ -0,0 +1,67 @@
+#
+# SYNOPSIS
+#
+# AX_EXECINFO([ACTION-IF-EXECINFO-H-IS-FOUND],
+# [ACTION-IF-EXECINFO-H-IS-NOT-FOUND],
+# [ADDITIONAL-TYPES-LIST])
+#
+#
+# DESCRIPTION
+#
+# Checks for execinfo.h header and if the len parameter/return type can
+# be found from a list, also define backtrace_size_t to that type.
+#
+# By default the list of types to try contains int and size_t, but should
+# some yet undiscovered system use e.g. unsigned, the 3rd argument can be
+# used for extensions. I'd like to hear of further suggestions.
+#
+# Executes ACTION-IF-EXECINFO-H-IS-FOUND when present and the execinfo.h
+# header is found or ACTION-IF-EXECINFO-H-IS-NOT-FOUND in case the header
+# seems unavailable.
+#
+# Also adds -lexecinfo to LIBS on BSD if needed.
+#
+# LICENSE
+#
+# Copyright (c) 2014 Thomas Jahns <jahns at dkrz.de>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 1
+
+AC_DEFUN([AX_EXECINFO],
+ [AC_CHECK_HEADERS([execinfo.h])
+ AS_IF([test x"$ac_cv_header_execinfo_h" = xyes],
+ [AC_CACHE_CHECK([size parameter type for backtrace()],
+ [ax_cv_proto_backtrace_type],
+ [AC_LANG_PUSH([C])
+ for ax_cv_proto_backtrace_type in size_t int m4_ifnblank([$3],[$3 ])none; do
+ AS_IF([test "${ax_cv_proto_backtrace_type}" = none],
+ [ax_cv_proto_backtrace_type= ; break])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+#include <execinfo.h>
+extern
+${ax_cv_proto_backtrace_type} backtrace(void **addrlist, ${ax_cv_proto_backtrace_type} len);
+char **backtrace_symbols(void *const *buffer, ${ax_cv_proto_backtrace_type} size);
+])],
+ [break])
+ done
+ AC_LANG_POP([C])])])
+ AS_IF([test x${ax_cv_proto_backtrace_type} != x],
+ [AC_DEFINE_UNQUOTED([backtrace_size_t], [$ax_cv_proto_backtrace_type],
+ [Defined to return type of backtrace().])])
+ AC_SEARCH_LIBS([backtrace],[execinfo])
+ AS_IF([test x"${ax_cv_proto_backtrace_type}" != x -a x"$ac_cv_header_execinfo_h" = xyes -a x"$ac_cv_search_backtrace" != xno],
+ [AC_DEFINE([HAVE_BACKTRACE],[1],
+ [Defined if backtrace() could be fully identified.])
+ ]m4_ifnblank([$1],[$1
+]),m4_ifnblank([$2],[$2
+]))])
+dnl
+dnl Local Variables:
+dnl mode: autoconf
+dnl End:
+dnl
diff --git a/libcdi/m4/acx_options.m4 b/libcdi/m4/acx_options.m4
index 5cea626..91b3eab 100644
--- a/libcdi/m4/acx_options.m4
+++ b/libcdi/m4/acx_options.m4
@@ -158,14 +158,13 @@ AC_ARG_WITH([netcdf],
[AC_MSG_CHECKING([netcdf's nc2 support])
AS_IF([test "x$($NC_CONFIG --has-nc2)" = "xyes"],
[AC_DEFINE([HAVE_NETCDF2],[1],[Define to 1 for NETCDF2 support])
- AC_MSG_RESULT([yes])
- ENABLE_NC2=yes],
- [AC_MSG_RESULT([no])])
+ ENABLE_NC2=yes
+ AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])
AC_MSG_CHECKING([netcdf's nc4 support])
AS_IF([test "x$($NC_CONFIG --has-nc4)" = "xyes"],
- [AC_DEFINE([HAVE_NETCDF4],[1],[Define to 1 for NETCDF4 support])
- ENABLE_NC4=yes
- AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])],
+ [AC_DEFINE([HAVE_NETCDF4],[1],[Define to 1 for NETCDF4 support])
+ ENABLE_NC4=yes
+ AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])],
[AS_ECHO([Could not find nc-config! go on with default configuration])])],
[*],[AS_IF([test -d "$with_netcdf"],
[NETCDF_ROOT=$with_netcdf
diff --git a/libcdi/src/Makefile.am b/libcdi/src/Makefile.am
index 387609c..26fadd0 100644
--- a/libcdi/src/Makefile.am
+++ b/libcdi/src/Makefile.am
@@ -179,7 +179,7 @@ if CREATE_ISOC
LOCALTARGETS += mo_cdi.$(OBJEXT)
endif
#
-mo_cdi.f90: $(top_srcdir)/src/cdi.h
+mo_cdi.f90: $(top_srcdir)/src/cdi.h $(top_srcdir)/interfaces/f2003/bindGen.rb
ruby $(top_srcdir)/interfaces/f2003/bindGen.rb $(top_srcdir)/src/cdi.h $@
#
mo_cdi.$(OBJEXT): mo_cdi.f90
diff --git a/libcdi/src/Makefile.in b/libcdi/src/Makefile.in
index cc58a8e..68ad6c2 100644
--- a/libcdi/src/Makefile.in
+++ b/libcdi/src/Makefile.in
@@ -99,6 +99,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
$(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \
$(top_srcdir)/m4/acx_check_strptr_convert.m4 \
+ $(top_srcdir)/m4/acx_execinfo.m4 \
$(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \
$(top_srcdir)/m4/acx_options.m4 \
$(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \
@@ -1034,7 +1035,7 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
uninstall-libLTLIBRARIES uninstall-local
#
-mo_cdi.f90: $(top_srcdir)/src/cdi.h
+mo_cdi.f90: $(top_srcdir)/src/cdi.h $(top_srcdir)/interfaces/f2003/bindGen.rb
ruby $(top_srcdir)/interfaces/f2003/bindGen.rb $(top_srcdir)/src/cdi.h $@
#
mo_cdi.$(OBJEXT): mo_cdi.f90
diff --git a/libcdi/src/cdf.c b/libcdi/src/cdf.c
index 29e32c9..edf6763 100644
--- a/libcdi/src/cdf.c
+++ b/libcdi/src/cdf.c
@@ -79,7 +79,7 @@ void cdfComment(int ncid)
strcat(comment, "??");
else
strncat(comment, libvers, size);
- strcat(comment, " (http://code.zmaw.de/projects/cdi)");
+ strcat(comment, " (https://code.zmaw.de/projects/cdi)");
}
cdf_put_att_text(ncid, NC_GLOBAL, "CDI", strlen(comment), comment);
diff --git a/libcdi/src/cdf_int.c b/libcdi/src/cdf_int.c
index 742ad27..714c95e 100644
--- a/libcdi/src/cdf_int.c
+++ b/libcdi/src/cdf_int.c
@@ -12,8 +12,6 @@
#include "cdf_int.h"
#include "namespace.h"
-extern int CDF_Fatal;
-extern int CDF_Verbose;
extern int CDF_Debug;
#if defined (HAVE_LIBNETCDF)
diff --git a/libcdi/src/cdi.h b/libcdi/src/cdi.h
index 61085eb..5e64a05 100644
--- a/libcdi/src/cdi.h
+++ b/libcdi/src/cdi.h
@@ -113,6 +113,7 @@ extern "C" {
#define DATATYPE_TXT 253
#define DATATYPE_CPX 254
#define DATATYPE_UCHAR 255
+#define DATATYPE_LONG 256
/* Chunks */
@@ -225,7 +226,7 @@ extern "C" {
void cdiReset(void);
-char *cdiStringError(int cdiErrno);
+const char *cdiStringError(int cdiErrno);
void cdiDebug(int debug);
diff --git a/libcdi/src/cdi.inc b/libcdi/src/cdi.inc
index 022964b..884181c 100644
--- a/libcdi/src/cdi.inc
+++ b/libcdi/src/cdi.inc
@@ -1,10 +1,10 @@
! This file was automatically generated, don't edit!
!
-! Fortran interface for CDI library version 1.6.6
+! Fortran interface for CDI library version 1.6.7
!
! Author:
! -------
-! Uwe Schulzweida, MPI-MET, Hamburg, November 2014
+! Uwe Schulzweida, MPI-MET, Hamburg, December 2014
!
INTEGER CDI_MAX_NAME
diff --git a/libcdi/src/cdi_cksum.c b/libcdi/src/cdi_cksum.c
index 58be0a3..04733d6 100644
--- a/libcdi/src/cdi_cksum.c
+++ b/libcdi/src/cdi_cksum.c
@@ -11,7 +11,7 @@
#include "error.h"
#include "serialize.h"
-uint32_t cdiCheckSum(int type, int count, void *buffer)
+uint32_t cdiCheckSum(int type, int count, const void *buffer)
{
uint32_t s = 0U;
xassert(count >= 0);
diff --git a/libcdi/src/cdi_cksum.h b/libcdi/src/cdi_cksum.h
index 85555c7..2a29a34 100644
--- a/libcdi/src/cdi_cksum.h
+++ b/libcdi/src/cdi_cksum.h
@@ -3,6 +3,6 @@
#include <inttypes.h>
-uint32_t cdiCheckSum(int type, int count, void *data);
+uint32_t cdiCheckSum(int type, int count, const void *data);
#endif
diff --git a/libcdi/src/cdi_error.c b/libcdi/src/cdi_error.c
index 0488bd4..8170b77 100644
--- a/libcdi/src/cdi_error.c
+++ b/libcdi/src/cdi_error.c
@@ -7,14 +7,14 @@
#include <errno.h>
#include "cdi.h"
-char *cdiStringError(int cdiErrno)
+const char *cdiStringError(int cdiErrno)
{
- static char UnknownError[] = "Unknown Error";
- static char _EUFTYPE[] = "Unsupported file type";
- static char _ELIBNAVAIL[] = "Unsupported file type (library support not compiled in)";
- static char _EUFSTRUCT[] = "Unsupported file structure";
- static char _EUNC4[] = "Unsupported netCDF4 structure";
- static char _ELIMIT[] = "Internal limits exceeded";
+ static const char UnknownError[] = "Unknown Error";
+ static const char _EUFTYPE[] = "Unsupported file type";
+ static const char _ELIBNAVAIL[] = "Unsupported file type (library support not compiled in)";
+ static const char _EUFSTRUCT[] = "Unsupported file structure";
+ static const char _EUNC4[] = "Unsupported netCDF4 structure";
+ static const char _ELIMIT[] = "Internal limits exceeded";
switch (cdiErrno) {
case CDI_ESYSTEM:
diff --git a/libcdi/src/cdi_int.h b/libcdi/src/cdi_int.h
index ba3bf51..ecc6e05 100644
--- a/libcdi/src/cdi_int.h
+++ b/libcdi/src/cdi_int.h
@@ -67,7 +67,6 @@ char *strdup(const char *s);
#include "cdi.h"
-
#define check_parg(arg) if ( arg == 0 ) Warning("Argument '" #arg "' not allocated!")
#if defined (__xlC__) /* performance problems on IBM */
@@ -108,30 +107,23 @@ char *strdup(const char *s);
typedef struct
{
- void *buffer;
- size_t buffersize;
- off_t position;
- int recsize;
- int size;
- int dataread;
- int param;
- int level;
- int date;
- int time;
- int gridID;
- int zaxisID;
- int used;
- int nrec;
- int varID;
- int levelID;
- int recid;
- int prec;
- int sec0[2];
- int sec1[1024];
- int sec2[4096];
- int sec3[2];
- int sec4[512];
- void *exsep;
+ void *buffer; /* gribapi, cgribex */
+ size_t buffersize; /* gribapi, cgribex */
+ off_t position; /* ieg */
+ int param; /* srv */
+ int level; /* ext, srv */
+ int date; /* ext, srv */
+ int time; /* srv */
+ int gridID; /* ieg, ext */
+ int varID; /* ieg */
+ int levelID; /* ieg */
+ int prec; /* ext, srv */
+ int sec0[2]; /* cgribex */
+ int sec1[1024]; /* cgribex */
+ int sec2[4096]; /* cgribex */
+ int sec3[2]; /* cgribex */
+ int sec4[512]; /* cgribex */
+ void *exsep; /* ieg, ext, srv */
}
Record;
@@ -201,21 +193,17 @@ typedef struct {
int filetype;
int byteorder;
int fileID;
- int dimgroupID;
int filemode;
off_t numvals;
char *filename;
Record *record;
int nrecs; /* number of records */
int nvars; /* number of variables */
- int varlocked; /* variables locked */
svarinfo_t *vars;
int varsAllocated;
- int varinit;
int curTsID; /* current timestep ID */
int rtsteps; /* number of tsteps accessed */
long ntsteps; /* number of tsteps : only set if all records accessed */
- int numTimestep; /* number of tsteps : only set if all records accessed */
tsteps_t *tsteps;
int tstepsTableSize;
int tstepsNextID;
@@ -237,9 +225,6 @@ typedef struct {
int have_missval;
int comptype; // compression type
int complevel; // compression level
- int curfile;
- int nfiles;
- char **fnames;
#if defined (GRIBCONTAINER2D)
void **gribContainers;
#else
@@ -331,9 +316,6 @@ void cdiPrintDatatypes(void);
void cdiDefAccesstype(int streamID, int type);
int cdiInqAccesstype(int streamID);
-void streamDefDimgroupID(int streamID, int dimgroupID);
-int streamInqDimgroupID(int streamID);
-
int getByteswap(int byteorder);
int streamSize ();
@@ -347,7 +329,7 @@ int str2uuid(const char *uuidstr, unsigned char *uuid);
static inline int
cdiUUIDIsNull(const unsigned char uuid[CDI_UUID_SIZE])
{
- static unsigned char uuid_nil[CDI_UUID_SIZE];
+ static const unsigned char uuid_nil[CDI_UUID_SIZE];
return !memcmp(uuid, uuid_nil, CDI_UUID_SIZE);
}
diff --git a/libcdi/src/cdilib.c b/libcdi/src/cdilib.c
index f7a8a36..1c6280b 100644
--- a/libcdi/src/cdilib.c
+++ b/libcdi/src/cdilib.c
@@ -1,7 +1,7 @@
-/* Automatically generated by m214003 at 2014-11-25, do not edit */
+/* Automatically generated by m214003 at 2014-12-10, do not edit */
-/* CDILIB_VERSION="1.6.6" */
+/* CDILIB_VERSION="1.6.7" */
#ifdef _ARCH_PWR6
#pragma options nostrict
@@ -687,6 +687,7 @@ extern "C" {
#define DATATYPE_TXT 253
#define DATATYPE_CPX 254
#define DATATYPE_UCHAR 255
+#define DATATYPE_LONG 256
/* Chunks */
@@ -799,7 +800,7 @@ extern "C" {
void cdiReset(void);
-char *cdiStringError(int cdiErrno);
+const char *cdiStringError(int cdiErrno);
void cdiDebug(int debug);
@@ -1826,7 +1827,7 @@ memcrc(const unsigned char *b, size_t n);
#include <inttypes.h>
-uint32_t cdiCheckSum(int type, int count, void *data);
+uint32_t cdiCheckSum(int type, int count, const void *data);
#endif
#if defined (HAVE_CONFIG_H)
@@ -2111,7 +2112,6 @@ char *strdup(const char *s);
#include "cdi.h"
-
#define check_parg(arg) if ( arg == 0 ) Warning("Argument '" #arg "' not allocated!")
#if defined (__xlC__) /* performance problems on IBM */
@@ -2152,30 +2152,23 @@ char *strdup(const char *s);
typedef struct
{
- void *buffer;
- size_t buffersize;
- off_t position;
- int recsize;
- int size;
- int dataread;
- int param;
- int level;
- int date;
- int time;
- int gridID;
- int zaxisID;
- int used;
- int nrec;
- int varID;
- int levelID;
- int recid;
- int prec;
- int sec0[2];
- int sec1[1024];
- int sec2[4096];
- int sec3[2];
- int sec4[512];
- void *exsep;
+ void *buffer; /* gribapi, cgribex */
+ size_t buffersize; /* gribapi, cgribex */
+ off_t position; /* ieg */
+ int param; /* srv */
+ int level; /* ext, srv */
+ int date; /* ext, srv */
+ int time; /* srv */
+ int gridID; /* ieg, ext */
+ int varID; /* ieg */
+ int levelID; /* ieg */
+ int prec; /* ext, srv */
+ int sec0[2]; /* cgribex */
+ int sec1[1024]; /* cgribex */
+ int sec2[4096]; /* cgribex */
+ int sec3[2]; /* cgribex */
+ int sec4[512]; /* cgribex */
+ void *exsep; /* ieg, ext, srv */
}
Record;
@@ -2245,21 +2238,17 @@ typedef struct {
int filetype;
int byteorder;
int fileID;
- int dimgroupID;
int filemode;
off_t numvals;
char *filename;
Record *record;
int nrecs; /* number of records */
int nvars; /* number of variables */
- int varlocked; /* variables locked */
svarinfo_t *vars;
int varsAllocated;
- int varinit;
int curTsID; /* current timestep ID */
int rtsteps; /* number of tsteps accessed */
long ntsteps; /* number of tsteps : only set if all records accessed */
- int numTimestep; /* number of tsteps : only set if all records accessed */
tsteps_t *tsteps;
int tstepsTableSize;
int tstepsNextID;
@@ -2281,9 +2270,6 @@ typedef struct {
int have_missval;
int comptype; // compression type
int complevel; // compression level
- int curfile;
- int nfiles;
- char **fnames;
#if defined (GRIBCONTAINER2D)
void **gribContainers;
#else
@@ -2375,9 +2361,6 @@ void cdiPrintDatatypes(void);
void cdiDefAccesstype(int streamID, int type);
int cdiInqAccesstype(int streamID);
-void streamDefDimgroupID(int streamID, int dimgroupID);
-int streamInqDimgroupID(int streamID);
-
int getByteswap(int byteorder);
int streamSize ();
@@ -2391,7 +2374,7 @@ int str2uuid(const char *uuidstr, unsigned char *uuid);
static inline int
cdiUUIDIsNull(const unsigned char uuid[CDI_UUID_SIZE])
{
- static unsigned char uuid_nil[CDI_UUID_SIZE];
+ static const unsigned char uuid_nil[CDI_UUID_SIZE];
return !memcmp(uuid, uuid_nil, CDI_UUID_SIZE);
}
@@ -2697,7 +2680,7 @@ double calculate_pfactor(const double* spectralField, long fieldTruncation, long
#ifndef _GRIBAPI_H
#define _GRIBAPI_H
-#ifdef HAVE_LIBGRIBAPI
+#ifdef HAVE_LIBGRIB_API
# include "error.h"
# include <grib_api.h>
#endif
@@ -2746,7 +2729,7 @@ double calculate_pfactor(const double* spectralField, long fieldTruncation, long
const char *gribapiLibraryVersionString(void);
void gribContainersNew(stream_t * streamptr);
void gribContainersDelete(stream_t * streamptr);
-#ifdef HAVE_LIBGRIBAPI
+#ifdef HAVE_LIBGRIB_API
static inline void *gribHandleNew(int editionNumber)
{
void *gh =
@@ -5009,7 +4992,7 @@ typedef struct
int nvars; /* number of variables */
int ngrids;
int nzaxis;
- int ntsteps;
+ long ntsteps;
int taxisID;
int tableID;
int instID;
@@ -5091,6 +5074,12 @@ extern int cdiNAdditionalGRIBKeys;
extern char* cdiAdditionalGRIBKeys[];
#endif
+extern
+#ifndef __cplusplus
+const
+#endif
+resOps vlistOps;
+
#endif /* _VLIST_H */
/*
* Local Variables:
@@ -5219,7 +5208,6 @@ enum
VLIST = 7,
RESH_DELETE,
START = 55555555,
- SEPARATOR = 66666666,
END = 99999999
};
@@ -5234,29 +5222,101 @@ void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
#ifndef SERIALIZE_H
#define SERIALIZE_H
+#include <string.h>
+
+#include "cdi.h"
+#include "cdi_cksum.h"
+#include "error.h"
+
/*
* Generic interfaces for (de-)marshalling
*/
int serializeGetSize(int count, int datatype, void *context);
-void serializePack(void *data, int count, int datatype,
+void serializePack(const void *data, int count, int datatype,
void *buf, int buf_size, int *position, void *context);
-void serializeUnpack(void *buf, int buf_size, int *position,
+void serializeUnpack(const void *buf, int buf_size, int *position,
void *data, int count, int datatype, void *context);
/*
- * top-level de-marshalling function
+ * (de-)marshalling function for common data structures
*/
+static inline int
+serializeStrTabGetPackSize(const char **strTab, int numStr,
+ void *context)
+{
+ xassert(numStr >= 0);
+ int packBuffSize = 0;
+ for (size_t i = 0; i < (size_t)numStr; ++i)
+ {
+ size_t len = strlen(strTab[i]);
+ packBuffSize +=
+ serializeGetSize(1, DATATYPE_INT, context)
+ + serializeGetSize((int)len, DATATYPE_TXT, context);
+ }
+ packBuffSize +=
+ serializeGetSize(1, DATATYPE_UINT32, context);
+ return packBuffSize;
+}
+
+static inline void
+serializeStrTabPack(const char **strTab, int numStr,
+ void *buf, int buf_size, int *position, void *context)
+{
+ uint32_t d = 0;
+ xassert(numStr >= 0);
+ for (size_t i = 0; i < (size_t)numStr; ++i)
+ {
+ size_t len = strlen(strTab[i]);
+ serializePack(&(int){(int)len}, 1, DATATYPE_INT,
+ buf, buf_size, position, context);
+ serializePack(strTab[i], (int)len, DATATYPE_TXT,
+ buf, buf_size, position, context);
+ d ^= cdiCheckSum(DATATYPE_TXT, (int)len, strTab[i]);
+ }
+ serializePack(&d, 1, DATATYPE_UINT32,
+ buf, buf_size, position, context);
+}
+
+static inline void
+serializeStrTabUnpack(const void *buf, int buf_size, int *position,
+ char **strTab, int numStr, void *context)
+{
+ uint32_t d, d2 = 0;
+ xassert(numStr >= 0);
+ for (size_t i = 0; i < (size_t)numStr; ++i)
+ {
+ int len;
+ serializeUnpack(buf, buf_size, position,
+ &len, 1, DATATYPE_INT, context);
+ serializeUnpack(buf, buf_size, position,
+ strTab[i], len, DATATYPE_TXT, context);
+ strTab[i][len] = '\0';
+ d2 ^= cdiCheckSum(DATATYPE_TXT, (size_t)len, strTab[i]);
+ }
+ serializeUnpack(buf, buf_size, position,
+ &d, 1, DATATYPE_UINT32, context);
+ xassert(d == d2);
+}
/*
* Interfaces for marshalling within a single memory domain
*/
int serializeGetSizeInCore(int count, int datatype, void *context);
-void serializePackInCore(void *data, int count, int datatype,
+void serializePackInCore(const void *data, int count, int datatype,
void *buf, int buf_size, int *position, void *context);
-void serializeUnpackInCore(void *buf, int buf_size, int *position,
- void *data, int count, int datatype, void *context);
+void serializeUnpackInCore(const void *buf, int buf_size, int *position,
+ void *data, int count, int datatype, void *context);
#endif
+/*
+ * Local Variables:
+ * c-file-style: "Java"
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * show-trailing-whitespace: t
+ * require-trailing-newline: t
+ * End:
+ */
#ifndef STREAM_FCOMMON_H
#define STREAM_FCOMMON_H
@@ -5807,8 +5867,8 @@ void Free(const char *caller, const char *file, int line, void *ptr)
void *cdiXmalloc(size_t size, const char *filename, const char *functionname,
int line)
{
- void * value = calloc (1, size );
- if ( value == NULL )
+ void *value = malloc(size);
+ if (size == 0 || value != NULL) ; else
cdiAbort(filename, functionname, line, "malloc failed: %s",
strerror(errno));
return value;
@@ -5817,8 +5877,8 @@ void *cdiXmalloc(size_t size, const char *filename, const char *functionname,
void *cdiXcalloc(size_t nmemb, size_t size, const char *filename,
const char *functionname, int line)
{
- void * value = calloc ( nmemb, size );
- if ( value == NULL )
+ void *value = calloc(nmemb, size);
+ if (size == 0 || value != NULL) ; else
cdiAbort(filename, functionname, line, "calloc failed: %s",
strerror(errno) );
return value;
@@ -5828,7 +5888,7 @@ void *cdiXrealloc(void *p, size_t size, const char *functionname,
const char *filename, int line)
{
void *value = realloc(p, size);
- if ( value == NULL )
+ if (size == 0 || value != NULL) ; else
cdiAbort(filename, functionname, line, "realloc failed: %s",
strerror(errno));
return value;
@@ -6140,7 +6200,7 @@ memcrc_finish(uint32_t *state, off_t total_size)
#include <stdlib.h>
-uint32_t cdiCheckSum(int type, int count, void *buffer)
+uint32_t cdiCheckSum(int type, int count, const void *buffer)
{
uint32_t s = 0U;
xassert(count >= 0);
@@ -6356,13 +6416,6 @@ void taxis_copy(taxis_t *taxisptr2, taxis_t *taxisptr1)
}
#endif
-static
-void taxis_check_ptr(const char *caller, taxis_t *taxisptr)
-{
- if ( taxisptr == NULL )
- Errorc("taxis undefined!");
-}
-
/*
@Function taxisCreate
@Title Create a Time axis
@@ -6414,7 +6467,6 @@ int taxisCreate(int taxistype)
void taxisDestroyKernel(taxis_t *taxisptr)
{
- taxis_check_ptr(__func__, taxisptr);
int id = taxisptr->self;
delete_refcount_string(taxisptr->name);
delete_refcount_string(taxisptr->longname);
@@ -6466,8 +6518,6 @@ void taxisDefType(int taxisID, int type)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->type != type)
{
taxisptr->type = type;
@@ -6493,8 +6543,6 @@ void taxisDefVdate(int taxisID, int vdate)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->vdate != vdate)
{
taxisptr->vdate = vdate;
@@ -6520,8 +6568,6 @@ void taxisDefVtime(int taxisID, int vtime)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->vtime != vtime)
{
taxisptr->vtime = vtime;
@@ -6547,8 +6593,6 @@ void taxisDefRdate(int taxisID, int rdate)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->rdate != rdate)
{
taxisptr->rdate = rdate;
@@ -6574,8 +6618,6 @@ void taxisDefRtime(int taxisID, int rtime)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->rtime != rtime)
{
taxisptr->rtime = rtime;
@@ -6601,8 +6643,6 @@ void taxisDefFdate(int taxisID, int fdate)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->fdate != fdate)
{
taxisptr->fdate = fdate;
@@ -6628,8 +6668,6 @@ void taxisDefFtime(int taxisID, int ftime)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->ftime != ftime)
{
taxisptr->ftime = ftime;
@@ -6657,8 +6695,6 @@ void taxisDefCalendar(int taxisID, int calendar)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->calendar != calendar)
{
taxisptr->calendar = calendar;
@@ -6671,8 +6707,6 @@ void taxisDefTunit(int taxisID, int unit)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->unit != unit)
{
taxisptr->unit = unit;
@@ -6685,8 +6719,6 @@ void taxisDefForecastTunit(int taxisID, int unit)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->fc_unit != unit)
{
taxisptr->fc_unit = unit;
@@ -6699,8 +6731,6 @@ void taxisDefForecastPeriod(int taxisID, double fc_period)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->fc_period != fc_period)
{
taxisptr->fc_period = fc_period;
@@ -6713,8 +6743,6 @@ void taxisDefNumavg(int taxisID, int numavg)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->numavg != numavg)
{
taxisptr->numavg = numavg;
@@ -6730,8 +6758,6 @@ int taxisInqType(int taxisID)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->type);
}
@@ -6740,8 +6766,6 @@ int taxisHasBounds(int taxisID)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->has_bounds);
}
@@ -6750,8 +6774,6 @@ void taxisDeleteBounds(int taxisID)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->has_bounds != FALSE)
{
taxisptr->has_bounds = FALSE;
@@ -6765,9 +6787,6 @@ void taxisCopyTimestep(int taxisID2, int taxisID1)
taxis_t *taxisptr1 = (taxis_t *)reshGetVal(taxisID1, &taxisOps),
*taxisptr2 = (taxis_t *)reshGetVal(taxisID2, &taxisOps);
- taxis_check_ptr(__func__, taxisptr1);
- taxis_check_ptr(__func__, taxisptr2);
-
reshLock();
taxisptr2->rdate = taxisptr1->rdate;
@@ -6814,8 +6833,6 @@ int taxisInqVdate(int taxisID)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->vdate);
}
@@ -6824,8 +6841,6 @@ void taxisInqVdateBounds(int taxisID, int *vdate_lb, int *vdate_ub)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
*vdate_lb = taxisptr->vdate_lb;
*vdate_ub = taxisptr->vdate_ub;
}
@@ -6835,8 +6850,6 @@ void taxisDefVdateBounds(int taxisID, int vdate_lb, int vdate_ub)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->vdate_lb != vdate_lb
|| taxisptr->vdate_ub != vdate_ub
|| taxisptr->has_bounds != TRUE)
@@ -6868,8 +6881,6 @@ int taxisInqVtime(int taxisID)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->vtime);
}
@@ -6878,8 +6889,6 @@ void taxisInqVtimeBounds(int taxisID, int *vtime_lb, int *vtime_ub)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
*vtime_lb = taxisptr->vtime_lb;
*vtime_ub = taxisptr->vtime_ub;
}
@@ -6889,8 +6898,6 @@ void taxisDefVtimeBounds(int taxisID, int vtime_lb, int vtime_ub)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->vtime_lb != vtime_lb
|| taxisptr->vtime_ub != vtime_ub
|| taxisptr->has_bounds != TRUE)
@@ -6920,9 +6927,7 @@ The function @func{taxisInqRdate} returns the reference date of a Time axis.
*/
int taxisInqRdate(int taxisID)
{
- taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
-
- taxis_check_ptr(__func__, taxisptr);
+ taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
if ( taxisptr->rdate == -1 )
{
@@ -6952,9 +6957,7 @@ The function @func{taxisInqRtime} returns the reference time of a Time axis.
*/
int taxisInqRtime(int taxisID)
{
- taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
-
- taxis_check_ptr(__func__, taxisptr);
+ taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
if ( taxisptr->rdate == -1 )
{
@@ -6984,9 +6987,7 @@ The function @func{taxisInqFdate} returns the forecast reference date of a Time
*/
int taxisInqFdate(int taxisID)
{
- taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
-
- taxis_check_ptr(__func__, taxisptr);
+ taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
if ( taxisptr->fdate == -1 )
{
@@ -7015,9 +7016,7 @@ The function @func{taxisInqFtime} returns the forecast reference time of a Time
*/
int taxisInqFtime(int taxisID)
{
- taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
-
- taxis_check_ptr(__func__, taxisptr);
+ taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
if ( taxisptr->fdate == -1 )
{
@@ -7051,8 +7050,6 @@ int taxisInqCalendar(int taxisID)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->calendar);
}
@@ -7061,8 +7058,6 @@ int taxisInqTunit(int taxisID)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->unit);
}
@@ -7071,8 +7066,6 @@ int taxisInqForecastTunit(int taxisID)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->fc_unit);
}
@@ -7081,8 +7074,6 @@ double taxisInqForecastPeriod(int taxisID)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->fc_period);
}
@@ -7091,8 +7082,6 @@ int taxisInqNumavg(int taxisID)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->numavg);
}
@@ -7101,8 +7090,6 @@ taxis_t *taxisPtr(int taxisID)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr);
}
@@ -7111,7 +7098,6 @@ ptaxisDefName(taxis_t *taxisptr, const char *name)
{
if (name)
{
- taxis_check_ptr(__func__, taxisptr);
size_t len = strlen(name);
delete_refcount_string(taxisptr->name);
char *taxisname = taxisptr->name = new_refcount_string(len);
@@ -7124,7 +7110,6 @@ ptaxisDefLongname(taxis_t *taxisptr, const char *longname)
{
if (longname)
{
- taxis_check_ptr(__func__, taxisptr);
size_t len = strlen(longname);
delete_refcount_string(taxisptr->longname);
char *taxislongname = taxisptr->longname = new_refcount_string(len);
@@ -7407,6 +7392,7 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
else if ( timeunit == TUNIT_MONTH )
{
vdate = (int) timevalue*100;
+ vdate += 1;
vtime = 0;
}
else if ( timeunit == TUNIT_YEAR )
@@ -7423,6 +7409,7 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
}
vdate = (int) timevalue*10000;
+ vdate += 101;
vtime = 0;
}
else
@@ -7620,8 +7607,6 @@ taxisPrintKernel(taxis_t * taxisptr, FILE * fp)
int vdate_lb, vdate_ub;
int vtime_lb, vtime_ub;
- taxis_check_ptr ( __func__, taxisptr );
-
taxisInqVdateBounds ( taxisptr->self, &vdate_lb, &vdate_ub);
taxisInqVtimeBounds ( taxisptr->self, &vtime_lb, &vtime_ub);
@@ -7808,8 +7793,8 @@ taxisPack(void * voidP, void * packBuffer, int packBufferSize, int * packBufferP
intBuffer[idx++] = taxisP->vtime_lb;
intBuffer[idx++] = taxisP->vdate_ub;
intBuffer[idx++] = taxisP->vtime_ub;
- intBuffer[idx++] = taxisP->name ? strlen(taxisP->name) : 0;
- intBuffer[idx++] = taxisP->longname ? strlen(taxisP->longname) : 0;
+ intBuffer[idx++] = taxisP->name ? (int)strlen(taxisP->name) : 0;
+ intBuffer[idx++] = taxisP->longname ? (int)strlen(taxisP->longname) : 0;
serializePack(intBuffer, taxisNint, DATATYPE_INT,
packBuffer, packBufferSize, packBufferPos, context);
@@ -11102,7 +11087,7 @@ void cdi_generate_vars(stream_t *streamptr)
{
int varID, gridID, zaxisID;
int instID, modelID, tableID;
- int param, zaxistype, ltype1, ltype2, lindex;
+ int param, zaxistype, ltype1, ltype2;
int prec;
int tsteptype;
int timave, timaccu;
@@ -11356,7 +11341,6 @@ void cdi_generate_vars(stream_t *streamptr)
/*
for ( levelID = 0; levelID < nlevels; levelID++ )
{
- lindex = vartable[varid].levelTable[levelID].lindex;
printf("%d %d %d %d %d\n", varID, levelID,
vartable[varid].levelTable[levelID].lindex,
vartable[varid].levelTable[levelID].recID,
@@ -11683,7 +11667,7 @@ void varDefTable(int varID, int tableID)
void varDefEnsembleInfo(int varID, int ens_idx, int ens_count, int forecast_type)
{
if ( vartable[varID].ensdata == NULL )
- vartable[varID].ensdata = (ensinfo_t *) malloc( sizeof( ensinfo_t ) );
+ vartable[varID].ensdata = (ensinfo_t *)xmalloc( sizeof( ensinfo_t ) );
vartable[varID].ensdata->ens_index = ens_idx;
vartable[varID].ensdata->ens_count = ens_count;
@@ -11809,7 +11793,7 @@ static int vlistTxCode ( void );
#if !defined(__cplusplus)
const
#endif
-resOps vlist_ops = {
+resOps vlistOps = {
(valCompareFunc)vlist_compare,
(valDestroyFunc)vlist_delete,
(valPrintFunc)vlistPrintKernel
@@ -11822,7 +11806,7 @@ resOps vlist_ops = {
vlist_t *vlist_to_pointer(int vlistID)
{
VLIST_INIT();
- return (vlist_t*) reshGetVal(vlistID, &vlist_ops );
+ return (vlist_t*) reshGetVal(vlistID, &vlistOps );
}
static
@@ -11850,11 +11834,11 @@ vlist_t *vlist_new_entry(cdiResH resH)
vlist_t *vlistptr = (vlist_t*) xmalloc(sizeof(vlist_t));
vlist_init_entry(vlistptr);
if (resH == CDI_UNDEFID)
- vlistptr->self = reshPut(vlistptr, &vlist_ops);
+ vlistptr->self = reshPut(vlistptr, &vlistOps);
else
{
vlistptr->self = resH;
- reshReplace(resH, vlistptr, &vlist_ops);
+ reshReplace(resH, vlistptr, &vlistOps);
}
return (vlistptr);
}
@@ -11866,7 +11850,7 @@ void vlist_delete_entry(vlist_t *vlistptr)
idx = vlistptr->self;
- reshRemove(idx, &vlist_ops );
+ reshRemove(idx, &vlistOps );
free(vlistptr);
@@ -11895,24 +11879,14 @@ void vlist_copy(vlist_t *vlistptr2, vlist_t *vlistptr1)
vlistptr2->self = vlistID2;
}
-static
-void vlist_check_ptr(const char *caller, vlist_t *vlistptr)
-{
- if ( vlistptr == NULL )
- Errorc("vlist undefined!");
-}
-
-
void vlist_lock(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if ( !vlistptr->locked )
{
vlistptr->locked = 1;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -11921,12 +11895,10 @@ void vlist_unlock(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if ( vlistptr->locked )
{
vlistptr->locked = 0;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -11967,8 +11939,6 @@ int vlistCreate(void)
static void
vlist_delete(vlist_t *vlistptr)
{
- vlist_check_ptr(__func__, vlistptr);
-
int vlistID = vlistptr->self;
vlistDelAtts(vlistID, CDI_GLOBAL);
@@ -12046,9 +12016,6 @@ void vlistCopy(int vlistID2, int vlistID1)
vlistptr1 = vlist_to_pointer(vlistID1);
vlistptr2 = vlist_to_pointer(vlistID2);
- vlist_check_ptr(__func__, vlistptr1);
- vlist_check_ptr(__func__, vlistptr2);
-
var_t *vlist2vars = vlistptr2->vars;
vlist_copy(vlistptr2, vlistptr1);
@@ -12143,15 +12110,8 @@ The function @func{vlistDuplicate} duplicates the variable list from vlistID1.
*/
int vlistDuplicate(int vlistID)
{
- int vlistIDnew;
- vlist_t *vlistptr = vlist_to_pointer(vlistID);
-
- vlist_check_ptr(__func__, vlistptr);
-
- vlistIDnew = vlistCreate();
-
+ int vlistIDnew = vlistCreate();
vlistCopy(vlistIDnew, vlistID);
-
return (vlistIDnew);
}
@@ -12183,9 +12143,6 @@ int vlist_generate_zaxis(int vlistID, int zaxistype, int nlevels, const double *
int zaxisglobdefined = 0;
int has_bounds = FALSE;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
-
- vlist_check_ptr(__func__, vlistptr);
-
int zaxisdefined = 0;
int nzaxis = vlistptr->nzaxis;
@@ -12271,10 +12228,6 @@ void vlistCopyFlag(int vlistID2, int vlistID1)
{
vlist_t *vlistptr1 = vlist_to_pointer(vlistID1),
*vlistptr2 = vlist_to_pointer(vlistID2);
-
- vlist_check_ptr(__func__, vlistptr1);
- vlist_check_ptr(__func__, vlistptr2);
-
vlist_copy(vlistptr2, vlistptr1);
vlistCopyVarAtts(vlistID1, CDI_GLOBAL, vlistID2, CDI_GLOBAL);
@@ -12474,9 +12427,6 @@ void vlistCat(int vlistID2, int vlistID1)
vlist_t *vlistptr1 = vlist_to_pointer(vlistID1),
*vlistptr2 = vlist_to_pointer(vlistID2);
- vlist_check_ptr(__func__, vlistptr1);
- vlist_check_ptr(__func__, vlistptr2);
-
int nvars1 = vlistptr1->nvars;
int nvars2 = vlistptr2->nvars;
int nvars = nvars1 + nvars2;
@@ -12589,9 +12539,6 @@ void vlistMerge(int vlistID2, int vlistID1)
vlist_t *vlistptr1 = vlist_to_pointer(vlistID1),
*vlistptr2 = vlist_to_pointer(vlistID2);
- vlist_check_ptr(__func__, vlistptr1);
- vlist_check_ptr(__func__, vlistptr2);
-
int nvars1 = vlistptr1->nvars;
int nvars2 = vlistptr2->nvars;
@@ -12722,9 +12669,6 @@ The function @func{vlistNvars} returns the number of variables in the variable l
int vlistNvars(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
-
- vlist_check_ptr(__func__, vlistptr);
-
return (vlistptr->nvars);
}
@@ -12734,8 +12678,6 @@ int vlistNrecs(int vlistID)
int nrecs = 0;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
for ( int varID = 0; varID < vlistptr->nvars; varID++ )
nrecs += zaxisInqSize(vlistptr->vars[varID].zaxisID);
@@ -12748,8 +12690,6 @@ int vlistNumber(int vlistID)
int number, number2, datatype;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
datatype = vlistptr->vars[0].datatype;
if ( datatype== DATATYPE_CPX32 || datatype == DATATYPE_CPX64 )
number = CDI_COMP;
@@ -12794,8 +12734,6 @@ int vlistNgrids(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
return (vlistptr->ngrids);
}
@@ -12819,8 +12757,6 @@ int vlistNzaxis(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
return (vlistptr->nzaxis);
}
@@ -12829,12 +12765,10 @@ void vlistDefNtsteps(int vlistID, int nts)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if (vlistptr->ntsteps != nts)
{
vlistptr->ntsteps = nts;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -12843,9 +12777,7 @@ int vlistNtsteps(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
- return (vlistptr->ntsteps);
+ return (int)vlistptr->ntsteps;
}
static void
@@ -12853,8 +12785,6 @@ vlistPrintKernel(vlist_t *vlistptr, FILE * fp )
{
char paramstr[32];
- vlist_check_ptr(__func__, vlistptr);
-
fprintf ( fp, "#\n# vlistID %d\n#\n", vlistptr->self);
int nvars = vlistptr->nvars;
@@ -12939,7 +12869,6 @@ void vlistPrint(int vlistID)
{
if ( vlistID == CDI_UNDEFID ) return;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
vlistPrintKernel(vlistptr, stdout);
}
@@ -12961,12 +12890,10 @@ void vlistDefTaxis(int vlistID, int taxisID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if (vlistptr->taxisID != taxisID)
{
vlistptr->taxisID = taxisID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -12990,8 +12917,6 @@ int vlistInqTaxis(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
return (vlistptr->taxisID);
}
@@ -13000,12 +12925,10 @@ void vlistDefTable(int vlistID, int tableID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if (vlistptr->tableID != tableID)
{
vlistptr->tableID = tableID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -13014,8 +12937,6 @@ int vlistInqTable(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
return (vlistptr->tableID);
}
@@ -13024,12 +12945,10 @@ void vlistDefInstitut(int vlistID, int instID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if (vlistptr->instID != instID)
{
vlistptr->instID = instID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -13038,8 +12957,6 @@ int vlistInqInstitut(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
int instID = vlistptr->instID;
if ( instID == CDI_UNDEFID )
@@ -13063,12 +12980,10 @@ void vlistDefModel(int vlistID, int modelID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if (vlistptr->modelID != modelID)
{
vlistptr->modelID = modelID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -13077,8 +12992,6 @@ int vlistInqModel(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
int modelID = vlistptr->modelID;
if ( modelID == CDI_UNDEFID )
@@ -13104,8 +13017,6 @@ int vlistGridsizeMax(int vlistID)
int gridsizemax = 0;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
for ( int index = 0 ; index < vlistptr->ngrids ; index++ )
{
int gridID = vlistptr->gridIDs[index];
@@ -13122,8 +13033,6 @@ int vlistGrid(int vlistID, int index)
int gridID = CDI_UNDEFID;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if ( index < vlistptr->ngrids && index >= 0 )
gridID = vlistptr->gridIDs[index];
@@ -13136,8 +13045,6 @@ int vlistGridIndex(int vlistID, int gridID)
int index;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
for ( index = 0 ; index < vlistptr->ngrids ; index++ )
if ( gridID == vlistptr->gridIDs[index] ) break;
@@ -13151,8 +13058,6 @@ void vlistChangeGridIndex(int vlistID, int index, int gridID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
int gridIDold = vlistptr->gridIDs[index];
if (gridIDold != gridID)
{
@@ -13162,7 +13067,7 @@ void vlistChangeGridIndex(int vlistID, int index, int gridID)
for ( int varID = 0; varID < nvars; varID++ )
if ( vlistptr->vars[varID].gridID == gridIDold )
vlistptr->vars[varID].gridID = gridID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -13171,8 +13076,6 @@ void vlistChangeGrid(int vlistID, int gridID1, int gridID2)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if (gridID1 != gridID2)
{
int ngrids = vlistptr->ngrids;
@@ -13188,7 +13091,7 @@ void vlistChangeGrid(int vlistID, int gridID1, int gridID2)
for ( int varID = 0; varID < nvars; varID++ )
if ( vlistptr->vars[varID].gridID == gridID1 )
vlistptr->vars[varID].gridID = gridID2;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -13198,8 +13101,6 @@ int vlistZaxis(int vlistID, int index)
int zaxisID = CDI_UNDEFID;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if ( index < vlistptr->nzaxis && index >= 0 )
zaxisID = vlistptr->zaxisIDs[index];
@@ -13210,8 +13111,6 @@ int vlistZaxisIndex(int vlistID, int zaxisID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
int index;
for ( index = 0 ; index < vlistptr->nzaxis ; index++ )
if ( zaxisID == vlistptr->zaxisIDs[index] ) break;
@@ -13226,8 +13125,6 @@ void vlistChangeZaxisIndex(int vlistID, int index, int zaxisID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
int zaxisIDold = vlistptr->zaxisIDs[index];
if (zaxisIDold != zaxisID)
{
@@ -13248,7 +13145,7 @@ void vlistChangeZaxisIndex(int vlistID, int index, int zaxisID)
vlistptr->vars[varID].levinfo[levID] = DEFAULT_LEVINFO(levID);
}
}
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -13258,8 +13155,6 @@ void vlistChangeZaxis(int vlistID, int zaxisID1, int zaxisID2)
int nlevs1 = zaxisInqSize(zaxisID1), nlevs2 = zaxisInqSize(zaxisID2);
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
int nzaxis = vlistptr->nzaxis;
for ( int index = 0; index < nzaxis; index++ )
{
@@ -13286,7 +13181,7 @@ void vlistChangeZaxis(int vlistID, int zaxisID1, int zaxisID2)
vlistptr->vars[varID].levinfo[levID] = DEFAULT_LEVINFO(levID);
}
}
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -13295,8 +13190,6 @@ int vlistHasTime(int vlistID)
int hastime = FALSE;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
for ( int varID = 0; varID < vlistptr->nvars; varID++ )
if ( vlistptr->vars[varID].tsteptype != TSTEP_CONSTANT )
{
@@ -13308,7 +13201,7 @@ int vlistHasTime(int vlistID)
}
enum {
- vlist_nints=7,
+ vlist_nints=6,
};
static int
@@ -13324,6 +13217,7 @@ int vlistGetSizeP ( void * vlistptr, void *context)
int txsize, varID;
vlist_t *p = (vlist_t*) vlistptr;
txsize = serializeGetSize(vlist_nints, DATATYPE_INT, context);
+ txsize += serializeGetSize(1, DATATYPE_LONG, context);
txsize += vlistAttsGetSize(p, CDI_GLOBAL, context);
for ( varID = 0; varID < p->nvars; varID++ )
txsize += vlistVarGetPackSize(p, varID, context);
@@ -13339,12 +13233,13 @@ void vlistPackP ( void * vlistptr, void * buf, int size, int *position,
vlist_t *p = (vlist_t*) vlistptr;
tempbuf[0] = p->self;
tempbuf[1] = p->nvars;
- tempbuf[2] = p->ntsteps;
- tempbuf[3] = p->taxisID;
- tempbuf[4] = p->tableID;
- tempbuf[5] = p->instID;
- tempbuf[6] = p->modelID;
+ tempbuf[2] = p->taxisID;
+ tempbuf[3] = p->tableID;
+ tempbuf[4] = p->instID;
+ tempbuf[5] = p->modelID;
serializePack(tempbuf, vlist_nints, DATATYPE_INT, buf, size, position, context);
+ serializePack(&p->ntsteps, 1, DATATYPE_LONG, buf, size, position, context);
+
vlistAttsPack(p, CDI_GLOBAL, buf, size, position, context);
for ( varID = 0; varID < p->nvars; varID++ )
{
@@ -13357,17 +13252,19 @@ void vlistUnpack(char * buf, int size, int *position, int originNamespace,
{
int tempbuf[vlist_nints];
serializeUnpack(buf, size, position, tempbuf, vlist_nints, DATATYPE_INT, context);
+ int nvars = tempbuf[1];
int targetID = namespaceAdaptKey(tempbuf[0], originNamespace);
vlist_t *p = vlist_new_entry(force_id?targetID:CDI_UNDEFID);
xassert(!force_id || p->self == targetID);
if (!force_id)
targetID = p->self;
- p->taxisID = namespaceAdaptKey(tempbuf[3], originNamespace);
- p->tableID = tempbuf[4];
- p->instID = namespaceAdaptKey(tempbuf[5], originNamespace);
- p->modelID = namespaceAdaptKey(tempbuf[6], originNamespace);
+ p->taxisID = namespaceAdaptKey(tempbuf[2], originNamespace);
+ p->tableID = tempbuf[3];
+ p->instID = namespaceAdaptKey(tempbuf[4], originNamespace);
+ p->modelID = namespaceAdaptKey(tempbuf[5], originNamespace);
+ serializeUnpack(buf, size, position, &p->ntsteps, 1, DATATYPE_LONG, context);
vlistAttsUnpack(targetID, CDI_GLOBAL, buf, size, position, context);
- for (int varID = 0; varID < tempbuf[1]; varID++ )
+ for (int varID = 0; varID < nvars; varID++ )
vlistVarUnpack(targetID, buf, size, position, originNamespace, context);
}
@@ -13430,13 +13327,13 @@ cdi_att_t *find_att(cdi_atts_t *attsp, const char *name)
if ( attsp->nelems == 0 ) return NULL;
size_t slen = strlen(name);
+ if ( slen > CDI_MAX_NAME ) slen = CDI_MAX_NAME;
cdi_att_t *atts = attsp->value;
- for (size_t attid = 0; attid < attsp->nelems; attid++)
+ for ( size_t attid = 0; attid < attsp->nelems; attid++ )
{
cdi_att_t *attp = atts + attid;
- if (attp->namesz == slen
- && memcmp(attp->name, name, slen) == 0)
+ if ( attp->namesz == slen && memcmp(attp->name, name, slen) == 0 )
return (attp); /* Normal return */
}
@@ -13458,6 +13355,7 @@ cdi_att_t *new_att(cdi_atts_t *attsp, const char *name)
attsp->nelems++;
slen = strlen(name);
+ if ( slen > CDI_MAX_NAME ) slen = CDI_MAX_NAME;
attp->name = (char *) malloc(slen+1);
memcpy(attp->name, name, slen+1);
@@ -14015,12 +13913,6 @@ vlistAttsUnpack(int vlistID, int varID,
#include <limits.h>
-extern
-#if !defined(__cplusplus)
-const
-#endif
-resOps vlist_ops;
-
static
void vlistvarInitEntry(int vlistID, int varID)
{
@@ -14209,7 +14101,7 @@ int vlistDefVar(int vlistID, int gridID, int zaxisID, int tsteptype)
vlistAdd2ZaxisIDs(vlistptr, zaxisID);
vlistptr->vars[varID].param = cdiEncodeParam(-(varID + 1), 255, 255);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
return (varID);
}
@@ -14252,7 +14144,7 @@ void vlistDefVarParam(int vlistID, int varID, int param)
if (vlistptr->vars[varID].param != param)
{
vlistptr->vars[varID].param = param;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -14284,7 +14176,7 @@ void vlistDefVarCode(int vlistID, int varID, int code)
if (vlistptr->vars[varID].param != newParam)
{
vlistptr->vars[varID].param = newParam;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -14755,7 +14647,7 @@ void vlistDefVarDatatype(int vlistID, int varID, int datatype)
case DATATYPE_INT32: vlistptr->vars[varID].missval = -INT_MAX; break;
case DATATYPE_UINT32: vlistptr->vars[varID].missval = UINT_MAX; break;
}
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -14766,7 +14658,7 @@ void vlistDefVarInstitut(int vlistID, int varID, int instID)
if (vlistptr->vars[varID].instID != instID)
{
vlistptr->vars[varID].instID = instID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -14784,7 +14676,7 @@ void vlistDefVarModel(int vlistID, int varID, int modelID)
if (vlistptr->vars[varID].modelID != modelID)
{
vlistptr->vars[varID].modelID = modelID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -14810,7 +14702,7 @@ void vlistDefVarTable(int vlistID, int varID, int tableID)
int pnum, pcat, pdis;
cdiDecodeParam(param, &pnum, &pcat, &pdis);
vlistptr->vars[varID].param = cdiEncodeParam(pnum, tablenum, pdis);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -14851,7 +14743,7 @@ void vlistDefVarName(int vlistID, int varID, const char *name)
}
vlistptr->vars[varID].name = strdupx(name);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -14885,7 +14777,7 @@ void vlistDefVarLongname(int vlistID, int varID, const char *longname)
}
vlistptr->vars[varID].longname = strdupx(longname);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -14919,7 +14811,7 @@ void vlistDefVarStdname(int vlistID, int varID, const char *stdname)
}
vlistptr->vars[varID].stdname = strdupx(stdname);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -14953,7 +14845,7 @@ void vlistDefVarUnits(int vlistID, int varID, const char *units)
}
vlistptr->vars[varID].units = strdupx(units);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15038,7 +14930,7 @@ void vlistDefVarExtra(int vlistID, int varID, const char *extra)
}
vlistptr->vars[varID].extra = strdupx(extra);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15103,7 +14995,7 @@ void vlistDefVarValidrange(int vlistID, int varID, const double *validrange)
vlistptr->vars[varID].validrange[0] = validrange[0];
vlistptr->vars[varID].validrange[1] = validrange[1];
vlistptr->vars[varID].lvalidrange = TRUE;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -15136,7 +15028,7 @@ void vlistDefVarScalefactor(int vlistID, int varID, double scalefactor)
if ( IS_NOT_EQUAL(vlistptr->vars[varID].scalefactor, scalefactor) )
{
vlistptr->vars[varID].scalefactor = scalefactor;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15150,7 +15042,7 @@ void vlistDefVarAddoffset(int vlistID, int varID, double addoffset)
if ( IS_NOT_EQUAL(vlistptr->vars[varID].addoffset, addoffset))
{
vlistptr->vars[varID].addoffset = addoffset;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15161,7 +15053,7 @@ void vlistDefVarTsteptype(int vlistID, int varID, int tsteptype)
if (vlistptr->vars[varID].tsteptype != tsteptype)
{
vlistptr->vars[varID].tsteptype = tsteptype;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15179,7 +15071,7 @@ void vlistDefVarTimave(int vlistID, int varID, int timave)
if (vlistptr->vars[varID].timave != timave)
{
vlistptr->vars[varID].timave = timave;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15197,7 +15089,7 @@ void vlistDefVarTimaccu(int vlistID, int varID, int timaccu)
if (vlistptr->vars[varID].timaccu != timaccu)
{
vlistptr->vars[varID].timaccu = timaccu;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15215,7 +15107,7 @@ void vlistDefVarTypeOfGeneratingProcess(int vlistID, int varID, int typeOfGenera
if (vlistptr->vars[varID].typeOfGeneratingProcess != typeOfGeneratingProcess)
{
vlistptr->vars[varID].typeOfGeneratingProcess = typeOfGeneratingProcess;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15234,7 +15126,7 @@ void vlistDefVarProductDefinitionTemplate(int vlistID, int varID, int productDef
if (vlistptr->vars[varID].productDefinitionTemplate != productDefinitionTemplate)
{
vlistptr->vars[varID].productDefinitionTemplate = productDefinitionTemplate;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15254,7 +15146,7 @@ void vlistDestroyVarName(int vlistID, int varID)
{
free(vlistptr->vars[varID].name);
vlistptr->vars[varID].name = NULL;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15267,7 +15159,7 @@ void vlistDestroyVarLongname(int vlistID, int varID)
{
free(vlistptr->vars[varID].longname);
vlistptr->vars[varID].longname = NULL;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15280,7 +15172,7 @@ void vlistDestroyVarStdname(int vlistID, int varID)
{
free(vlistptr->vars[varID].stdname);
vlistptr->vars[varID].stdname = NULL;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15293,7 +15185,7 @@ void vlistDestroyVarUnits(int vlistID, int varID)
{
free(vlistptr->vars[varID].units);
vlistptr->vars[varID].units = NULL;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15331,7 +15223,7 @@ void vlistDefFlag(int vlistID, int varID, int levID, int flag)
}
}
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -15429,7 +15321,7 @@ void vlistDefIndex(int vlistID, int varID, int levelID, int index)
else
return;
vlistptr->vars[varID].levinfo[levelID].index = index;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -15477,7 +15369,7 @@ void vlistChangeVarZaxis(int vlistID, int varID, int zaxisID)
vlistAdd2ZaxisIDs(vlistptr, zaxisID);
vlistptr->vars[varID].zaxisID = zaxisID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -15503,7 +15395,7 @@ void vlistChangeVarGrid(int vlistID, int varID, int gridID)
vlistAdd2GridIDs(vlistptr, gridID);
vlistptr->vars[varID].gridID = gridID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -15516,7 +15408,7 @@ void vlistDefVarCompType(int vlistID, int varID, int comptype)
if (vlistptr->vars[varID].comptype != comptype)
{
vlistptr->vars[varID].comptype = comptype;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15540,7 +15432,7 @@ void vlistDefVarCompLevel(int vlistID, int varID, int complevel)
if (vlistptr->vars[varID].complevel != complevel)
{
vlistptr->vars[varID].complevel = complevel;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15564,7 +15456,7 @@ void vlistDefVarChunkType(int vlistID, int varID, int chunktype)
if (vlistptr->vars[varID].chunktype != chunktype)
{
vlistptr->vars[varID].chunktype = chunktype;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -15630,7 +15522,7 @@ void vlistDefVarXYZ(int vlistID, int varID, int xyz)
assert(xyz == 123 || xyz == 312 || xyz == 231 || xyz == 321 || xyz == 132 || xyz == 213);
vlistptr->vars[varID].xyz = xyz;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -15669,7 +15561,7 @@ void vlistDefVarEnsemble(int vlistID, int varID, int ensID, int ensCount, int fo
vlistptr->vars[varID].ensdata->ens_index = ensID;
vlistptr->vars[varID].ensdata->ens_count = ensCount;
vlistptr->vars[varID].ensdata->forecast_init_type = forecast_type;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -15728,7 +15620,12 @@ void vlistDefVarIntKey(int vlistID, int varID, const char *name, int value)
Error("Internal error, name undefined!");
}
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
+#else
+ (void)vlistID;
+ (void)varID;
+ (void)name;
+ (void)value;
#endif
}
@@ -15764,7 +15661,12 @@ void vlistDefVarDblKey(int vlistID, int varID, const char *name, double value)
Error("Internal error, name undefined!");
}
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
+#else
+ (void)vlistID;
+ (void)varID;
+ (void)name;
+ (void)value;
#endif
}
@@ -15792,6 +15694,8 @@ void cdiDefAdditionalKey(const char *name)
cdiAdditionalGRIBKeys[idx] = strdupx(name);
else
Error("Internal error!");
+#else
+ (void)name;
#endif
}
@@ -15813,6 +15717,10 @@ int vlistHasVarKey(int vlistID, int varID, const char* name)
if ( strcmp(name, vlistptr->vars[varID].opt_grib_int_keyword[i]) == 0 )
return 1;
}
+#else
+ (void)vlistID;
+ (void)varID;
+ (void)name;
#endif
return 0;
}
@@ -15828,6 +15736,10 @@ double vlistInqVarDblKey(int vlistID, int varID, const char* name)
for (int i=0; i<vlistptr->vars[varID].opt_grib_dbl_nentries; i++)
if ( strcmp(name, vlistptr->vars[varID].opt_grib_dbl_keyword[i]) == 0 )
return vlistptr->vars[varID].opt_grib_dbl_val[i];
+#else
+ (void)vlistID;
+ (void)varID;
+ (void)name;
#endif
return value;
}
@@ -15844,6 +15756,10 @@ int vlistInqVarIntKey(int vlistID, int varID, const char* name)
for (int i=0; i<vlistptr->vars[varID].opt_grib_int_nentries; i++)
if ( strcmp(name, vlistptr->vars[varID].opt_grib_int_keyword[i]) == 0 )
return vlistptr->vars[varID].opt_grib_int_val[i];
+#else
+ (void)vlistID;
+ (void)varID;
+ (void)name;
#endif
return (int) value;
}
@@ -15858,7 +15774,7 @@ void vlistDefVarIOrank(int vlistID, int varID, int iorank)
if (vlistptr->vars[varID].iorank != iorank)
{
vlistptr->vars[varID].iorank = iorank;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -18027,7 +17943,11 @@ void grid_init(grid_t *gridptr)
gridptr->ybounds = NULL;
gridptr->rowlon = NULL;
gridptr->nrowlon = 0;
+ gridptr->xfirst = 0.0;
+ gridptr->xlast = 0.0;
gridptr->xinc = 0.0;
+ gridptr->yfirst = 0.0;
+ gridptr->ylast = 0.0;
gridptr->yinc = 0.0;
gridptr->lcc_originLon = 0.0;
gridptr->lcc_originLat = 0.0;
@@ -18169,7 +18089,7 @@ void gridGenXvals(int xsize, double xfirst, double xlast, double xinc, double *x
static
void calc_gaussgrid(double *yvals, int ysize, double yfirst, double ylast)
{
- double *yw = (double *)xmalloc((size_t)ysize * sizeof(double));
+ double *restrict yw = (double *)xmalloc((size_t)ysize * sizeof(double));
gaussaw(yvals, yw, (size_t)ysize);
free(yw);
for (int i = 0; i < ysize; i++ )
@@ -18202,7 +18122,7 @@ void gridGenYvals(int gridtype, int ysize, double yfirst, double ylast, double y
if ( fabs(yvals[0] - yfirst) > deleps || fabs(yvals[ysize-1] - ylast) > deleps )
{
double yinc = fabs(ylast-yfirst)/(ysize-1);
- double *ytmp = NULL;
+ double *restrict ytmp = NULL;
int nstart, lfound = 0;
int ny = (int) (180./yinc + 0.5);
ny -= ny%2;
@@ -18217,8 +18137,8 @@ void gridGenYvals(int gridtype, int ysize, double yfirst, double ylast, double y
nstart = i;
- if ( (nstart+ysize-1) < ny )
- if ( fabs(ytmp[nstart+ysize-1] - ylast) < deleps ) lfound = 1;
+ lfound = (nstart+ysize-1) < ny
+ && fabs(ytmp[nstart+ysize-1] - ylast) < deleps;
}
if ( lfound )
@@ -20149,8 +20069,8 @@ int gridCompareP ( void * gridptr1, void * gridptr2 )
{
grid_t * g1 = ( grid_t * ) gridptr1;
grid_t * g2 = ( grid_t * ) gridptr2;
- int differ = -1;
- int equal = 0;
+ enum { equal = 0,
+ differ = -1 };
int i, size;
xassert ( g1 );
@@ -20293,14 +20213,14 @@ int gridCompareP ( void * gridptr1, void * gridptr2 )
else if ( g2->ybounds )
return differ;
- if ( memcmp ( &g1->xname ,&g2->xname ,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->yname ,&g2->yname ,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->xlongname,&g2->xlongname,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->ylongname,&g2->ylongname,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->xstdname ,&g2->xstdname ,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->ystdname ,&g2->ystdname ,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->xunits ,&g2->xunits ,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->yunits ,&g2->yunits ,CDI_MAX_NAME ) ) return differ;
+ if (strcmp(g1->xname, g2->xname)) return differ;
+ if (strcmp(g1->yname, g2->yname)) return differ;
+ if (strcmp(g1->xlongname, g2->xlongname)) return differ;
+ if (strcmp(g1->ylongname, g2->ylongname)) return differ;
+ if (strcmp(g1->xstdname, g2->xstdname)) return differ;
+ if (strcmp(g1->ystdname, g2->ystdname)) return differ;
+ if (strcmp(g1->xunits, g2->xunits)) return differ;
+ if (strcmp(g1->yunits, g2->yunits)) return differ;
if ( g1->reference )
{
@@ -20723,7 +20643,7 @@ void gridDefArea(int gridID, const double *area)
{
grid_t *gridptr = gridID2Ptr(gridID);
- size_t size = gridptr->size;
+ size_t size = (size_t)gridptr->size;
if ( size == 0 )
Error("size undefined for gridID = %d", gridID);
@@ -21813,7 +21733,6 @@ gridTxCode ()
enum { gridNint = 27,
gridNdouble = 24,
- gridNstrings= 8,
gridHasMaskFlag = 1 << 0,
gridHasGMEMaskFlag = 1 << 1,
gridHasXValsFlag = 1 << 2,
@@ -21843,6 +21762,11 @@ static int gridGetComponentFlags(const grid_t * gridP)
}
+#define GRID_STR_SERIALIZE { gridP->xname, gridP->yname, \
+ gridP->xlongname, gridP->ylongname, \
+ gridP->xstdname, gridP->ystdname, \
+ gridP->xunits, gridP->yunits }
+
static int
gridGetPackSize(void * voidP, void *context)
{
@@ -21917,9 +21841,12 @@ gridGetPackSize(void * voidP, void *context)
+ serializeGetSize(1, DATATYPE_UINT32, context));
}
- packBuffSize +=
- serializeGetSize(gridNstrings * CDI_MAX_NAME , DATATYPE_TXT, context)
- + serializeGetSize(1, DATATYPE_UINT32, context);
+ {
+ const char *strTab[] = GRID_STR_SERIALIZE;
+ int numStr = (int)(sizeof (strTab) / sizeof (strTab[0]));
+ packBuffSize
+ += serializeStrTabGetPackSize(strTab, numStr, context);
+ }
if (gridP->reference)
{
@@ -21950,11 +21877,6 @@ gridGetPackSize(void * voidP, void *context)
return packBuffSize;
}
-#define GRID_STR_SERIALIZE { gridP->xname, gridP->yname, \
- gridP->xlongname, gridP->ylongname, \
- gridP->xstdname, gridP->ystdname, \
- gridP->xunits, gridP->yunits }
-
void
gridUnpack(char * unpackBuffer, int unpackBufferSize,
int * unpackBufferPos, int originNamespace, void *context,
@@ -21963,7 +21885,6 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
grid_t * gridP;
uint32_t d;
int memberMask, size;
- char charBuffer[gridNstrings * CDI_MAX_NAME];
gridInit();
@@ -22117,17 +22038,11 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
xassert(cdiCheckSum(DATATYPE_FLT, size, gridP->ybounds) == d);
}
- serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
- charBuffer, gridNstrings * CDI_MAX_NAME, DATATYPE_TXT, context);
- serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
- &d, 1, DATATYPE_UINT32, context);
-
- xassert(d == cdiCheckSum(DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer));
{
char *strTab[] = GRID_STR_SERIALIZE;
- size_t numStr = sizeof (strTab) / sizeof (strTab[0]);
- for (size_t i = 0; i < numStr; ++i)
- memcpy(strTab[i], charBuffer + CDI_MAX_NAME * i, CDI_MAX_NAME);
+ int numStr = sizeof (strTab) / sizeof (strTab[0]);
+ serializeStrTabUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+ strTab, numStr, context);
}
if (memberMask & gridHasReferenceFlag)
@@ -22180,7 +22095,6 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
int size;
uint32_t d;
int memberMask;
- char charBuffer[gridNstrings * CDI_MAX_NAME];
{
int intBuffer[gridNint];
@@ -22222,7 +22136,8 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
if (memberMask & gridHasRowLonFlag)
{
- xassert((size = gridP->nrowlon));
+ size = gridP->nrowlon;
+ xassert(size > 0);
serializePack(gridP->rowlon, size, DATATYPE_INT,
packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_INT , size, gridP->rowlon);
@@ -22338,18 +22253,12 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
}
{
- char *strTab[] = GRID_STR_SERIALIZE;
- size_t numStr = sizeof (strTab) / sizeof (strTab[0]);
- for (size_t i = 0; i < numStr; ++i)
- memcpy(charBuffer + CDI_MAX_NAME * i, strTab[i], CDI_MAX_NAME);
+ const char *strTab[] = GRID_STR_SERIALIZE;
+ int numStr = sizeof (strTab) / sizeof (strTab[0]);
+ serializeStrTabPack(strTab, numStr,
+ packBuffer, packBufferSize, packBufferPos, context);
}
- serializePack( charBuffer, gridNstrings * CDI_MAX_NAME, DATATYPE_TXT,
- packBuffer, packBufferSize, packBufferPos, context);
- d = cdiCheckSum(DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer);
- serializePack(&d, 1, DATATYPE_UINT32,
- packBuffer, packBufferSize, packBufferPos, context);
-
if (memberMask & gridHasReferenceFlag)
{
size = (int)strlen(gridP->reference) + 1;
@@ -22388,6 +22297,8 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
packBuffer, packBufferSize, packBufferPos, context);
}
+#undef GRID_STR_SERIALIZE
+
/*
* Local Variables:
* c-file-style: "Java"
@@ -22561,15 +22472,6 @@ void zaxis_copy(zaxis_t *zaxisptr2, zaxis_t *zaxisptr1)
zaxisptr2->self = zaxisID2;
}
-static
-void zaxisCheckPtr(const char *caller, int zaxisID, zaxis_t *zaxisptr)
-{
- if ( zaxisptr == NULL )
- Errorc("zaxis %d undefined!", zaxisID);
-}
-
-#define zaxis_check_ptr(zaxisID, zaxisptr) zaxisCheckPtr(__func__, zaxisID, zaxisptr)
-
int zaxisSize(void)
{
return reshCountType ( &zaxisOps );
@@ -22736,8 +22638,6 @@ void zaxisDefName(int zaxisID, const char *name)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( name )
{
strncpy(zaxisptr->name, name, CDI_MAX_NAME - 1);
@@ -22764,8 +22664,6 @@ void zaxisDefLongname(int zaxisID, const char *longname)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( longname )
{
strncpy(zaxisptr->longname, longname, CDI_MAX_NAME - 1);
@@ -22792,8 +22690,6 @@ void zaxisDefUnits(int zaxisID, const char *units)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( units )
{
strncpy(zaxisptr->units, units, CDI_MAX_NAME - 1);
@@ -22824,9 +22720,6 @@ The function @func{zaxisInqName} returns the name of a Z-axis.
void zaxisInqName(int zaxisID, char *name)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
strcpy(name, zaxisptr->name);
}
@@ -22852,9 +22745,6 @@ The function @func{zaxisInqLongname} returns the longname of a Z-axis.
void zaxisInqLongname(int zaxisID, char *longname)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
strcpy(longname, zaxisptr->longname);
}
@@ -22880,9 +22770,6 @@ The function @func{zaxisInqUnits} returns the units of a Z-axis.
void zaxisInqUnits(int zaxisID, char *units)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
strcpy(units, zaxisptr->units);
}
@@ -22890,9 +22777,6 @@ void zaxisInqUnits(int zaxisID, char *units)
void zaxisInqStdname(int zaxisID, char *stdname)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
strcpy(stdname, zaxisptr->stdname);
}
@@ -22901,8 +22785,6 @@ void zaxisDefPrec(int zaxisID, int prec)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if (zaxisptr->prec != prec)
{
zaxisptr->prec = prec;
@@ -22915,8 +22797,6 @@ int zaxisInqPrec(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->prec);
}
@@ -22925,8 +22805,6 @@ void zaxisDefPositive(int zaxisID, int positive)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if (zaxisptr->positive != positive)
{
zaxisptr->positive = (unsigned char)positive;
@@ -22939,8 +22817,6 @@ int zaxisInqPositive(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->positive);
}
@@ -22949,8 +22825,6 @@ void zaxisDefLtype(int zaxisID, int ltype)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if (zaxisptr->ltype != ltype)
{
zaxisptr->ltype = ltype;
@@ -22963,8 +22837,6 @@ int zaxisInqLtype(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->ltype);
}
@@ -22973,8 +22845,6 @@ void zaxisDefLtype2(int zaxisID, int ltype2)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if (zaxisptr->ltype2 != ltype2)
{
zaxisptr->ltype2 = ltype2;
@@ -22987,8 +22857,6 @@ int zaxisInqLtype2(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->ltype2);
}
@@ -23010,8 +22878,6 @@ void zaxisDefLevels(int zaxisID, const double *levels)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
int size = zaxisptr->size;
double *vals = zaxisptr->vals;
@@ -23040,8 +22906,6 @@ void zaxisDefLevel(int zaxisID, int levelID, double level)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( levelID >= 0 && levelID < zaxisptr->size )
zaxisptr->vals[levelID] = level;
reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE);
@@ -23052,8 +22916,6 @@ void zaxisDefNlevRef(int zaxisID, const int nhlev)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if (zaxisptr->nhlev != nhlev)
{
zaxisptr->nhlev = nhlev;
@@ -23066,8 +22928,6 @@ int zaxisInqNlevRef(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->nhlev);
}
@@ -23089,8 +22949,6 @@ void zaxisDefNumber(int zaxisID, const int number)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if (zaxisptr->number != number)
{
zaxisptr->number = number;
@@ -23117,8 +22975,6 @@ int zaxisInqNumber(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->number);
}
@@ -23140,8 +22996,6 @@ void zaxisDefUUID(int zaxisID, const unsigned char uuid[CDI_UUID_SIZE])
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
memcpy(zaxisptr->uuid, uuid, CDI_UUID_SIZE);
reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE);
}
@@ -23164,9 +23018,6 @@ The function @func{zaxisInqUUID} returns the UUID to a generalized Z-axis.
void zaxisInqUUID(int zaxisID, unsigned char uuid[CDI_UUID_SIZE])
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
memcpy(uuid, zaxisptr->uuid, CDI_UUID_SIZE);
}
@@ -23191,8 +23042,6 @@ double zaxisInqLevel(int zaxisID, int levelID)
double level = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( levelID >= 0 && levelID < zaxisptr->size )
level = zaxisptr->vals[levelID];
@@ -23204,8 +23053,6 @@ double zaxisInqLbound(int zaxisID, int index)
double level = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisptr->lbounds )
if ( index >= 0 && index < zaxisptr->size )
level = zaxisptr->lbounds[index];
@@ -23219,8 +23066,6 @@ double zaxisInqUbound(int zaxisID, int index)
double level = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisptr->ubounds )
if ( index >= 0 && index < zaxisptr->size )
level = zaxisptr->ubounds[index];
@@ -23232,9 +23077,6 @@ double zaxisInqUbound(int zaxisID, int index)
const double *zaxisInqLevelsPtr(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return ( zaxisptr->vals );
}
@@ -23258,9 +23100,6 @@ The function @func{zaxisInqLevels} returns all levels of a Z-axis.
void zaxisInqLevels(int zaxisID, double *levels)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
int size = zaxisptr->size;
for (int i = 0; i < size; i++ )
levels[i] = zaxisptr->vals[i];
@@ -23272,8 +23111,6 @@ int zaxisInqLbounds(int zaxisID, double *lbounds)
int size = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisptr->lbounds )
{
size = zaxisptr->size;
@@ -23292,8 +23129,6 @@ int zaxisInqUbounds(int zaxisID, double *ubounds)
int size = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisptr->ubounds )
{
size = zaxisptr->size;
@@ -23312,8 +23147,6 @@ int zaxisInqWeights(int zaxisID, double *weights)
int size = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisptr->weights )
{
size = zaxisptr->size;
@@ -23332,8 +23165,6 @@ int zaxisInqLevelID(int zaxisID, double level)
int levelID = CDI_UNDEFID;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
int size = zaxisptr->size;
for ( int i = 0; i < size; i++ )
if ( fabs(level-zaxisptr->vals[i]) < DBL_EPSILON )
@@ -23373,9 +23204,6 @@ The valid CDI Z-axis types are @func{ZAXIS_GENERIC}, @func{ZAXIS_SURFACE},
int zaxisInqType(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->type);
}
@@ -23398,12 +23226,7 @@ The function @func{zaxisInqSize} returns the size of a Z-axis.
int zaxisInqSize(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
- int size = zaxisptr->size;
-
- return (size);
+ return (zaxisptr->size);
}
@@ -23411,8 +23234,6 @@ void cdiCheckZaxis(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisInqType(zaxisID) == ZAXIS_GENERIC )
{
int size = zaxisptr->size;
@@ -23449,8 +23270,6 @@ void zaxisDefVct(int zaxisID, int size, const double *vct)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisptr->vct == 0 )
{
zaxisptr->vctsize = size;
@@ -23467,9 +23286,6 @@ void zaxisDefVct(int zaxisID, int size, const double *vct)
void zaxisInqVct(int zaxisID, double *vct)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
memcpy(vct, zaxisptr->vct, (size_t)zaxisptr->vctsize * sizeof (double));
}
@@ -23477,9 +23293,6 @@ void zaxisInqVct(int zaxisID, double *vct)
int zaxisInqVctSize(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->vctsize);
}
@@ -23487,9 +23300,6 @@ int zaxisInqVctSize(int zaxisID)
const double *zaxisInqVctPtr(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->vct);
}
@@ -23498,8 +23308,6 @@ void zaxisDefLbounds(int zaxisID, const double *lbounds)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
size_t size = (size_t)zaxisptr->size;
if ( CDI_Debug )
@@ -23518,8 +23326,6 @@ void zaxisDefUbounds(int zaxisID, const double *ubounds)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
size_t size = (size_t)zaxisptr->size;
if ( CDI_Debug )
@@ -23538,8 +23344,6 @@ void zaxisDefWeights(int zaxisID, const double *weights)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
size_t size = (size_t)zaxisptr->size;
if ( CDI_Debug )
@@ -23557,9 +23361,6 @@ void zaxisDefWeights(int zaxisID, const double *weights)
void zaxisChangeType(int zaxisID, int zaxistype)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
zaxisptr->type = zaxistype;
}
@@ -23569,7 +23370,6 @@ void zaxisResize(int zaxisID, int size)
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
xassert(size >= 0);
- zaxis_check_ptr(zaxisID, zaxisptr);
zaxisptr->size = size;
@@ -23583,8 +23383,6 @@ int zaxisDuplicate(int zaxisID)
int zaxisIDnew;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
int zaxistype = zaxisInqType(zaxisID);
int zaxissize = zaxisInqSize(zaxisID);
@@ -23860,7 +23658,6 @@ zaxisTxCode ( void )
}
enum { zaxisNint = 8,
- zaxisNstrings = 4,
vals = 1 << 0,
lbounds = 1 << 1,
ubounds = 1 << 2,
@@ -23869,6 +23666,8 @@ enum { zaxisNint = 8,
zaxisHasUUIDFlag = 1 << 5,
};
+#define ZAXIS_STR_SERIALIZE { zaxisP->name, zaxisP->longname, \
+ zaxisP->stdname, zaxisP->units }
static
int zaxisGetMemberMask ( zaxis_t * zaxisP )
@@ -23917,9 +23716,14 @@ zaxisGetPackSize(void * voidP, void *context)
+ serializeGetSize(1, DATATYPE_UINT32, context);
}
- packBufferSize += serializeGetSize(zaxisNstrings * CDI_MAX_NAME, DATATYPE_TXT, context)
- + serializeGetSize(1, DATATYPE_UINT32, context)
- + serializeGetSize(1, DATATYPE_UCHAR, context);
+ {
+ const char *strTab[] = ZAXIS_STR_SERIALIZE;
+ size_t numStr = sizeof (strTab) / sizeof (strTab[0]);
+ packBufferSize
+ += serializeStrTabGetPackSize(strTab, (int)numStr, context);
+ }
+
+ packBufferSize += serializeGetSize(1, DATATYPE_UCHAR, context);
if (!cdiUUIDIsNull(zaxisP->uuid))
packBufferSize += serializeGetSize(CDI_UUID_SIZE, DATATYPE_UCHAR, context);
@@ -23935,7 +23739,6 @@ zaxisUnpack(char * unpackBuffer, int unpackBufferSize,
{
int intBuffer[zaxisNint], memberMask;
uint32_t d;
- char charBuffer[zaxisNstrings * CDI_MAX_NAME];
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
intBuffer, zaxisNint, DATATYPE_INT, context);
@@ -24023,17 +23826,12 @@ zaxisUnpack(char * unpackBuffer, int unpackBufferSize,
xassert(cdiCheckSum(DATATYPE_FLT64, size, zaxisP->vct) == d);
}
- serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
- charBuffer, zaxisNstrings * CDI_MAX_NAME, DATATYPE_TXT, context);
- serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
- &d, 1, DATATYPE_UINT32, context);
-
- xassert(d == cdiCheckSum(DATATYPE_TXT, zaxisNstrings * CDI_MAX_NAME, charBuffer));
-
- memcpy ( zaxisP->name, &charBuffer[CDI_MAX_NAME * 0], CDI_MAX_NAME );
- memcpy ( zaxisP->longname, &charBuffer[CDI_MAX_NAME * 1], CDI_MAX_NAME );
- memcpy ( zaxisP->stdname, &charBuffer[CDI_MAX_NAME * 2], CDI_MAX_NAME );
- memcpy ( zaxisP->units, &charBuffer[CDI_MAX_NAME * 3], CDI_MAX_NAME );
+ {
+ char *strTab[] = ZAXIS_STR_SERIALIZE;
+ int numStr = sizeof (strTab) / sizeof (strTab[0]);
+ serializeStrTabUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+ strTab, numStr, context);
+ }
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&zaxisP->positive, 1, DATATYPE_UCHAR, context);
@@ -24052,7 +23850,6 @@ zaxisPack(void * voidP, void * packBuffer, int packBufferSize,
int intBuffer[zaxisNint];
int memberMask;
uint32_t d;
- char charBuffer[zaxisNstrings * CDI_MAX_NAME];
intBuffer[0] = zaxisP->self;
intBuffer[1] = zaxisP->prec;
@@ -24123,16 +23920,12 @@ zaxisPack(void * voidP, void * packBuffer, int packBufferSize,
packBuffer, packBufferSize, packBufferPos, context);
}
- memcpy ( &charBuffer[CDI_MAX_NAME * 0], zaxisP->name, CDI_MAX_NAME );
- memcpy ( &charBuffer[CDI_MAX_NAME * 1], zaxisP->longname, CDI_MAX_NAME );
- memcpy ( &charBuffer[CDI_MAX_NAME * 2], zaxisP->stdname, CDI_MAX_NAME );
- memcpy ( &charBuffer[CDI_MAX_NAME * 3], zaxisP->units, CDI_MAX_NAME );
-
- serializePack(charBuffer, zaxisNstrings * CDI_MAX_NAME, DATATYPE_TXT,
- packBuffer, packBufferSize, packBufferPos, context);
- d = cdiCheckSum(DATATYPE_TXT, zaxisNstrings * CDI_MAX_NAME, charBuffer);
- serializePack(&d, 1, DATATYPE_UINT32,
- packBuffer, packBufferSize, packBufferPos, context);
+ {
+ const char *strTab[] = ZAXIS_STR_SERIALIZE;
+ int numStr = sizeof (strTab) / sizeof (strTab[0]);
+ serializeStrTabPack(strTab, numStr,
+ packBuffer, packBufferSize, packBufferPos, context);
+ }
serializePack(&zaxisP->positive, 1, DATATYPE_UCHAR,
packBuffer, packBufferSize, packBufferPos, context);
@@ -24148,6 +23941,9 @@ void zaxisGetIndexList ( int nzaxis, int * zaxisResHs )
{
reshGetResHListOfType ( nzaxis, zaxisResHs, &zaxisOps );
}
+
+#undef ZAXIS_STR_SERIALIZE
+
/*
* Local Variables:
* c-file-style: "Java"
@@ -24166,8 +23962,6 @@ void zaxisGetIndexList ( int nzaxis, int * zaxisResHs )
#include <string.h>
-extern int CDF_Fatal;
-extern int CDF_Verbose;
extern int CDF_Debug;
#if defined (HAVE_LIBNETCDF)
@@ -25028,14 +24822,14 @@ void cdf_inq_attid(int ncid, int varid, const char *name, int *attnump)
#include <string.h>
#include <errno.h>
-char *cdiStringError(int cdiErrno)
+const char *cdiStringError(int cdiErrno)
{
- static char UnknownError[] = "Unknown Error";
- static char _EUFTYPE[] = "Unsupported file type";
- static char _ELIBNAVAIL[] = "Unsupported file type (library support not compiled in)";
- static char _EUFSTRUCT[] = "Unsupported file structure";
- static char _EUNC4[] = "Unsupported netCDF4 structure";
- static char _ELIMIT[] = "Internal limits exceeded";
+ static const char UnknownError[] = "Unknown Error";
+ static const char _EUFTYPE[] = "Unsupported file type";
+ static const char _ELIBNAVAIL[] = "Unsupported file type (library support not compiled in)";
+ static const char _EUFSTRUCT[] = "Unsupported file structure";
+ static const char _EUNC4[] = "Unsupported netCDF4 structure";
+ static const char _ELIMIT[] = "Internal limits exceeded";
switch (cdiErrno) {
case CDI_ESYSTEM:
@@ -26385,8 +26179,7 @@ open stream. Otherwise, a negative number with the error status is returned.
@EndList
@Example
-Here is an example using @func{streamOpenWrite} to create a new netCDF file
-named @func{foo.nc} for writing:
+Here is an example using @func{streamOpenWrite} to create a new netCDF file named @func{foo.nc} for writing:
@Source
...
@@ -26416,7 +26209,6 @@ void streamDefaultValue ( stream_t * streamptr )
streamptr->filetype = FILETYPE_UNDEF;
streamptr->byteorder = CDI_UNDEFID;
streamptr->fileID = 0;
- streamptr->dimgroupID = CDI_UNDEFID;
streamptr->filemode = 0;
streamptr->numvals = 0;
streamptr->filename = NULL;
@@ -26425,12 +26217,10 @@ void streamDefaultValue ( stream_t * streamptr )
streamptr->nrecs = 0;
streamptr->nvars = 0;
streamptr->vars = NULL;
- streamptr->varinit = 0;
streamptr->ncmode = 0;
streamptr->curTsID = CDI_UNDEFID;
streamptr->rtsteps = 0;
streamptr->ntsteps = CDI_UNDEFID;
- streamptr->numTimestep = 0;
streamptr->tsteps = NULL;
streamptr->tstepsTableSize = 0;
streamptr->tstepsNextID = 0;
@@ -26457,10 +26247,6 @@ void streamDefaultValue ( stream_t * streamptr )
for ( i = 0; i < MAX_GRIDS_PS; i++ ) streamptr->ncyvarID[i] = CDI_UNDEFID;
for ( i = 0; i < MAX_GRIDS_PS; i++ ) streamptr->ncavarID[i] = CDI_UNDEFID;
- streamptr->curfile = 0;
- streamptr->nfiles = 0;
- streamptr->fnames = NULL;
-
streamptr->gribContainers = NULL;
streamptr->vlistIDorig = CDI_UNDEFID;
}
@@ -26617,14 +26403,6 @@ void streamClose(int streamID)
if ( streamptr->basetime.timevar_cache ) free(streamptr->basetime.timevar_cache);
- if ( streamptr->nfiles > 0 )
- {
- for ( index = 0; index < streamptr->nfiles; ++index )
- free(streamptr->fnames[index]);
-
- free(streamptr->fnames);
- }
-
if ( vlistID != -1 )
{
if ( streamptr->filemode != 'w' )
@@ -27259,7 +27037,7 @@ void streamReadVarSlice(int streamID, int varID, int levelID, double *data, int
if ( cdiStreamReadVarSlice(streamID, varID, levelID, MEMTYPE_DOUBLE, data, nmiss) )
{
Warning("Unexpected error returned from cdiStreamReadVarSlice()!");
- size_t elementCount = gridInqSize(vlistInqVarGrid(streamInqVlist(streamID), varID));
+ size_t elementCount = (size_t)gridInqSize(vlistInqVarGrid(streamInqVlist(streamID), varID));
memset(data, 0, elementCount * sizeof(*data));
}
}
@@ -27288,10 +27066,10 @@ void streamReadVarSliceF(int streamID, int varID, int levelID, float *data, int
{
// In case the file format does not support single precision reading,
// we fall back to double precision reading, converting the data on the fly.
- size_t elementCount = gridInqSize(vlistInqVarGrid(streamInqVlist(streamID), varID));
+ size_t elementCount = (size_t)gridInqSize(vlistInqVarGrid(streamInqVlist(streamID), varID));
double* conversionBuffer = malloc(elementCount * sizeof(*conversionBuffer));
streamReadVarSlice(streamID, varID, levelID, conversionBuffer, nmiss);
- for (size_t i = elementCount; i--; ) data[i] = conversionBuffer[i];
+ for (size_t i = elementCount; i--; ) data[i] = (float)conversionBuffer[i];
free(conversionBuffer);
}
}
@@ -27705,46 +27483,17 @@ int streamInqFileID(int streamID)
return (streamptr->fileID);
}
-void streamDefDimgroupID(int streamID, int dimgroupID)
-{
- stream_t *streamptr;
-
- streamptr = ( stream_t *) reshGetVal ( streamID, &streamOps );
-
- streamptr->dimgroupID = dimgroupID;
-}
-
-
-int streamInqDimgroupID(int streamID)
-{
- stream_t *streamptr;
-
- streamptr = ( stream_t *) reshGetVal ( streamID, &streamOps );
-
- return (streamptr->dimgroupID);
-}
-
-
void cdiDefAccesstype(int streamID, int type)
{
- stream_t *streamptr;
-
- streamptr = ( stream_t *) reshGetVal ( streamID, &streamOps );
+ stream_t *streamptr = reshGetVal(streamID, &streamOps);
if ( streamptr->accesstype == CDI_UNDEFID )
{
streamptr->accesstype = type;
}
- else
- {
- if ( streamptr->accesstype != type )
- {
- if ( streamptr->accesstype == TYPE_REC )
- Error("Changing access type from REC to VAR not allowed!");
- else
- Error("Changing access type from VAR to REC not allowed!");
- }
- }
+ else if ( streamptr->accesstype != type )
+ Error("Changing access type from %s not allowed!",
+ streamptr->accesstype == TYPE_REC ? "REC to VAR" : "VAR to REC");
}
@@ -27781,25 +27530,26 @@ void cdiStreamSetupVlist(stream_t *streamptr, int vlistID, int vlistIDorig)
}
if (streamptr->filemode == 'w' )
- {
- if ( streamptr->filetype == FILETYPE_NC ||
- streamptr->filetype == FILETYPE_NC2 ||
- streamptr->filetype == FILETYPE_NC4 ||
- streamptr->filetype == FILETYPE_NC4C )
- {
+ switch (streamptr->filetype)
+ {
#ifdef HAVE_LIBNETCDF
+ case FILETYPE_NC:
+ case FILETYPE_NC2:
+ case FILETYPE_NC4:
+ case FILETYPE_NC4C:
+ {
void (*myCdfDefVars)(stream_t *streamptr)
= (void (*)(stream_t *))
namespaceSwitchGet(NSSWITCH_CDF_STREAM_SETUP).func;
myCdfDefVars(streamptr);
-#endif
- }
- else if ( streamptr->filetype == FILETYPE_GRB ||
- streamptr->filetype == FILETYPE_GRB2 )
- {
- gribContainersNew(streamptr);
}
- }
+ break;
+#endif
+ case FILETYPE_GRB:
+ case FILETYPE_GRB2:
+ gribContainersNew(streamptr);
+ break;
+ }
}
@@ -27810,9 +27560,8 @@ void streamGetIndexList ( int nstreams, int * streamIndexList )
int streamInqNvars ( int streamID )
{
- stream_t * streamptr;
- streamptr = ( stream_t * ) reshGetVal ( streamID, &streamOps );
- return ( streamptr->nvars );
+ stream_t *streamptr = reshGetVal(streamID, &streamOps);
+ return streamptr->nvars;
}
@@ -27873,21 +27622,17 @@ void streamPrintP ( void * streamptr, FILE * fp )
fprintf ( fp, "filetype = %d\n", sp->filetype );
fprintf ( fp, "byteorder = %d\n", sp->byteorder );
fprintf ( fp, "fileID = %d\n", sp->fileID );
- fprintf ( fp, "dimgroupID = %d\n", sp->dimgroupID );
fprintf ( fp, "filemode = %d\n", sp->filemode );
fprintf ( fp, "//off_t numvals;\n" );
fprintf ( fp, "filename = %s\n", sp->filename );
fprintf ( fp, "//Record *record;\n" );
fprintf ( fp, "nrecs = %d\n", sp->nrecs );
fprintf ( fp, "nvars = %d\n", sp->nvars );
- fprintf ( fp, "varlocked = %d\n", sp->varlocked );
fprintf ( fp, "//svarinfo_t *vars;\n" );
fprintf ( fp, "varsAllocated = %d\n", sp->varsAllocated );
- fprintf ( fp, "varinit = %d\n", sp->varinit );
fprintf ( fp, "curTsID = %d\n", sp->curTsID );
fprintf ( fp, "rtsteps = %d\n", sp->rtsteps );
fprintf ( fp, "//long ntsteps;\n" );
- fprintf ( fp, "numTimestep = %d\n", sp->numTimestep );
fprintf ( fp, "// tsteps_t *tsteps;\n" );
fprintf ( fp, "tstepsTableSize= %d\n", sp->tstepsTableSize );
fprintf ( fp, "tstepsNextID = %d\n", sp->tstepsNextID );
@@ -27909,9 +27654,6 @@ void streamPrintP ( void * streamptr, FILE * fp )
fprintf ( fp, "have_missval = %d\n", sp->have_missval );
fprintf ( fp, "ztype = %d\n", sp->comptype );
fprintf ( fp, "zlevel = %d\n", sp->complevel );
- fprintf ( fp, "curfile = %d\n", sp->curfile );
- fprintf ( fp, "nfiles = %d\n", sp->nfiles );
- fprintf ( fp, "// char **fnames;\n" );
fprintf ( fp, "// void **gribContainers;\n" );
fprintf ( fp, "vlistIDorig = %d\n", sp->vlistIDorig );
}
@@ -28601,35 +28343,62 @@ compvar_t cgribexVarSet(int param, int level1, int level2, int leveltype, int tr
return (compVar);
}
-static
-int cgribexVarCompare(compvar_t compVar, record_t record, int flag)
-{
- compvar_t compVar0;
+static inline int
+cgribexVarCompare(compvar_t compVar, record_t record, int flag)
+{
+ int tstepDiff = (!((flag == 0) & (((compVar.tsteptype == TSTEP_INSTANT)
+ & (record.tsteptype == TSTEP_INSTANT3))
+ |((compVar.tsteptype == TSTEP_INSTANT3)
+ & (record.tsteptype == TSTEP_INSTANT)))))
+ & (compVar.tsteptype != record.tsteptype);
+ int rstatus = (compVar.param != record.param)
+ | (compVar.level1 != record.ilevel)
+ | (compVar.level2 != record.ilevel2)
+ | (compVar.ltype != record.ltype)
+ | tstepDiff;
+ return (rstatus);
+}
+#endif
- compVar0.param = record.param;
- compVar0.level1 = record.ilevel;
- compVar0.level2 = record.ilevel2;
- compVar0.ltype = record.ltype;
- compVar0.tsteptype = record.tsteptype;
+#define gribWarning(text, nrecs, timestep, paramstr, level1, level2) \
+ Warning("Record %2d (id=%s lev1=%d lev2=%d) timestep %d: %s", nrecs, paramstr, level1, level2, timestep, text)
- if ( flag == 0 )
+#if defined (HAVE_LIBCGRIBEX)
+
+static inline void
+cgribexScanTsFixNtsteps(stream_t *streamptr, off_t recpos)
+{
+ if ( streamptr->ntsteps == -1 )
{
- if ( compVar0.tsteptype == TSTEP_INSTANT && compVar.tsteptype == TSTEP_INSTANT3 ) compVar0.tsteptype = TSTEP_INSTANT3;
- if ( compVar0.tsteptype == TSTEP_INSTANT3 && compVar.tsteptype == TSTEP_INSTANT ) compVar0.tsteptype = TSTEP_INSTANT;
- }
+ int tsID = tstepsNewEntry(streamptr);
+ if ( tsID != streamptr->rtsteps )
+ Error("Internal error. tsID = %d", tsID);
- int rstatus = memcmp(&compVar0, &compVar, sizeof(compvar_t));
+ streamptr->tsteps[tsID-1].next = TRUE;
+ streamptr->tsteps[tsID].position = recpos;
+ }
+}
- return (rstatus);
+static inline void
+cgribexScanTsConstAdjust(stream_t *streamptr, taxis_t *taxis)
+{
+ int vlistID = streamptr->vlistID;
+ if ( streamptr->ntsteps == 1 )
+ {
+ if ( taxis->vdate == 0 && taxis->vtime == 0 )
+ {
+ streamptr->ntsteps = 0;
+ for (int varID = 0; varID < streamptr->nvars; varID++ )
+ {
+ vlistDefVarTsteptype(vlistID, varID, TSTEP_CONSTANT);
+ }
+ }
+ }
}
-#endif
-#define gribWarning(text, nrecs, timestep, paramstr, level1, level2) \
- Warning("Record %2d (id=%s lev1=%d lev2=%d) timestep %d: %s", nrecs, paramstr, level1, level2, timestep, text)
int cgribexScanTimestep1(stream_t * streamptr)
{
-#if defined (HAVE_LIBCGRIBEX)
int *isec0, *isec1, *isec2, *isec3, *isec4;
double fsec2[512], fsec3[2], *fsec4 = NULL;
int lmv = 0, iret = 0;
@@ -28642,7 +28411,6 @@ int cgribexScanTimestep1(stream_t * streamptr)
int level1 = 0, level2 = 0, vdate = 0, vtime = 0;
DateTime datetime, datetime0;
int tsID;
- int varID;
size_t readsize;
unsigned nrecords, recID;
int nrecs_scanned = 0;
@@ -28656,7 +28424,6 @@ int cgribexScanTimestep1(stream_t * streamptr)
int vlistID;
int comptype;
long unzipsize;
- compvar_t compVar;
char paramstr[32];
extern int cdiSkipRecords;
int nskip = cdiSkipRecords;
@@ -28704,7 +28471,7 @@ int cgribexScanTimestep1(stream_t * streamptr)
if ( (size_t)recsize > buffersize )
{
buffersize = (size_t)recsize;
- gribbuffer = (unsigned char *) realloc(gribbuffer, buffersize);
+ gribbuffer = (unsigned char *)xrealloc(gribbuffer, buffersize);
}
readsize = (size_t)recsize;
@@ -28756,7 +28523,7 @@ int cgribexScanTimestep1(stream_t * streamptr)
datetime.date = vdate;
datetime.time = vtime;
- compVar = cgribexVarSet(param, level1, level2, ISEC1_LevelType, ISEC1_TimeRange);
+ compvar_t compVar = cgribexVarSet(param, level1, level2, ISEC1_LevelType, ISEC1_TimeRange);
for ( recID = 0; recID < nrecs; recID++ )
{
@@ -28850,30 +28617,8 @@ int cgribexScanTimestep1(stream_t * streamptr)
streamptr->record->buffer = gribbuffer;
streamptr->record->buffersize = (size_t)buffersize;
- if ( streamptr->ntsteps == -1 )
- {
- tsID = tstepsNewEntry(streamptr);
- if ( tsID != streamptr->rtsteps )
- Error("Internal error. tsID = %d", tsID);
-
- streamptr->tsteps[tsID-1].next = TRUE;
- streamptr->tsteps[tsID].position = recpos;
- }
-
- if ( streamptr->ntsteps == 1 )
- {
- if ( taxis->vdate == 0 && taxis->vtime == 0 )
- {
- streamptr->ntsteps = 0;
- for ( varID = 0; varID < streamptr->nvars; varID++ )
- {
- vlistDefVarTsteptype(vlistID, varID, TSTEP_CONSTANT);
- }
- }
- }
-#else
- Error("CGRIBEX support not compiled in!");
-#endif
+ cgribexScanTsFixNtsteps(streamptr, recpos);
+ cgribexScanTsConstAdjust(streamptr, taxis);
return (0);
}
@@ -28882,7 +28627,6 @@ int cgribexScanTimestep1(stream_t * streamptr)
int cgribexScanTimestep2(stream_t * streamptr)
{
int rstatus = 0;
-#if defined (HAVE_LIBCGRIBEX)
int *isec0, *isec1, *isec2, *isec3, *isec4;
double fsec2[512], fsec3[2], *fsec4 = NULL;
int lmv = 0, iret = 0;
@@ -28905,7 +28649,6 @@ int cgribexScanTimestep2(stream_t * streamptr)
taxis_t *taxis;
int vlistID;
long unzipsize;
- compvar_t compVar;
char paramstr[32];
streamptr->curTsID = 1;
@@ -28925,7 +28668,7 @@ int cgribexScanTimestep2(stream_t * streamptr)
tsID = streamptr->rtsteps;
if ( tsID != 1 )
- Error("Internal problem! unexpeceted timestep %d", tsID+1);
+ Error("Internal problem! unexpected timestep %d", tsID+1);
taxis = &streamptr->tsteps[tsID].taxis;
@@ -28962,7 +28705,7 @@ int cgribexScanTimestep2(stream_t * streamptr)
if ( (size_t)recsize > buffersize )
{
buffersize = (size_t)recsize;
- gribbuffer = (unsigned char *) realloc(gribbuffer, buffersize);
+ gribbuffer = (unsigned char *)xrealloc(gribbuffer, buffersize);
}
readsize = (size_t)recsize;
@@ -29035,7 +28778,7 @@ int cgribexScanTimestep2(stream_t * streamptr)
datetime.date = vdate;
datetime.time = vtime;
- compVar = cgribexVarSet(param, level1, level2, ISEC1_LevelType, ISEC1_TimeRange);
+ compvar_t compVar = cgribexVarSet(param, level1, level2, ISEC1_LevelType, ISEC1_TimeRange);
for ( recID = 0; recID < nrecords; recID++ )
{
@@ -29123,28 +28866,20 @@ int cgribexScanTimestep2(stream_t * streamptr)
streamptr->rtsteps = 2;
- if ( streamptr->ntsteps == -1 )
- {
- tsID = tstepsNewEntry(streamptr);
- if ( tsID != streamptr->rtsteps )
- Error("Internal error. tsID = %d", tsID);
-
- streamptr->tsteps[tsID-1].next = TRUE;
- streamptr->tsteps[tsID].position = recpos;
- }
+ cgribexScanTsFixNtsteps(streamptr, recpos);
streamptr->record->buffer = gribbuffer;
streamptr->record->buffersize = buffersize;
-#endif
return (rstatus);
}
+#endif
+#if defined (HAVE_LIBCGRIBEX)
int cgribexScanTimestep(stream_t * streamptr)
{
int rstatus = 0;
-#if defined (HAVE_LIBCGRIBEX)
double fsec2[512], fsec3[2], *fsec4 = NULL;
int lmv = 0, iret = 0;
long recsize = 0;
@@ -29162,7 +28897,6 @@ int cgribexScanTimestep(stream_t * streamptr)
int rindex, nrecs = 0;
int nrecs_scanned;
long unzipsize;
- compvar_t compVar;
char paramstr[32];
/*
@@ -29299,7 +29033,7 @@ int cgribexScanTimestep(stream_t * streamptr)
datetime.date = vdate;
datetime.time = vtime;
- compVar = cgribexVarSet(param, level1, level2, ISEC1_LevelType, ISEC1_TimeRange);
+ compvar_t compVar = cgribexVarSet(param, level1, level2, ISEC1_LevelType, ISEC1_TimeRange);
for ( vrecID = 0; vrecID < nrecs; vrecID++ )
{
@@ -29401,20 +29135,20 @@ int cgribexScanTimestep(stream_t * streamptr)
}
rstatus = (int)streamptr->ntsteps;
-#endif
return (rstatus);
}
+#endif
#ifdef gribWarning
#undef gribWarning
#endif
+#if defined (HAVE_LIBCGRIBEX)
int cgribexDecode(unsigned char *gribbuffer, int gribsize, double *data, int gridsize,
int unreduced, int *nmiss, double missval)
{
int status = 0;
-#if defined (HAVE_LIBCGRIBEX)
int iret = 0, iword = 0;
int isec0[2], isec1[4096], isec2[4096], isec3[2], isec4[512];
double fsec2[512], fsec3[2];
@@ -29447,12 +29181,11 @@ int cgribexDecode(unsigned char *gribbuffer, int gribsize, double *data, int gri
(*nmiss)++;
}
}
-#else
- Error("CGRIBEX support not compiled in!");
-#endif
return (status);
}
+#endif
+
#if defined (HAVE_LIBCGRIBEX)
static
@@ -29808,19 +29541,19 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
ISEC2_NumLon = nlon;
ISEC2_NumLat = nlat;
- ISEC2_FirstLat = lround(yfirst*1000);
- ISEC2_LastLat = lround(ylast*1000);
+ ISEC2_FirstLat = (int)lround(yfirst*1000);
+ ISEC2_LastLat = (int)lround(ylast*1000);
if ( gridtype == GRID_GAUSSIAN_REDUCED )
{
ISEC2_FirstLon = 0;
- ISEC2_LastLon = lround(1000*(360.-360./(nlat*2)));
- ISEC2_LonIncr = lround(1000*360./(nlat*2));
+ ISEC2_LastLon = (int)lround(1000*(360.-360./(nlat*2)));
+ ISEC2_LonIncr = (int)lround(1000*360./(nlat*2));
}
else
{
- ISEC2_FirstLon = lround(xfirst*1000);
- ISEC2_LastLon = lround(xlast*1000);
- ISEC2_LonIncr = lround(xinc*1000);
+ ISEC2_FirstLon = (int)lround(xfirst*1000);
+ ISEC2_LastLon = (int)lround(xlast*1000);
+ ISEC2_LonIncr = (int)lround(xinc*1000);
}
// if ( fabs(xinc*1000 - ISEC2_LonIncr) > FLT_EPSILON ) ISEC2_LonIncr = 0;
@@ -29833,7 +29566,7 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
}
else
{
- ISEC2_LatIncr = lround(yinc*1000);
+ ISEC2_LatIncr = (int)lround(yinc*1000);
// if ( fabs(yinc*1000 - ISEC2_LatIncr) > FLT_EPSILON ) ISEC2_LatIncr = 0;
if ( ISEC2_LatIncr < 0 ) ISEC2_LatIncr = -ISEC2_LatIncr;
@@ -29852,8 +29585,8 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
if ( gridIsRotated(gridID) )
{
- ISEC2_LatSP = - lround(gridInqYpole(gridID) * 1000);
- ISEC2_LonSP = lround((gridInqXpole(gridID) + 180) * 1000);
+ ISEC2_LatSP = - (int)lround(gridInqYpole(gridID) * 1000);
+ ISEC2_LonSP = (int)lround((gridInqXpole(gridID) + 180) * 1000);
}
/* East -> West */
@@ -29879,13 +29612,13 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
ISEC2_GridType = GRIB1_GTYPE_LCC;
ISEC2_NumLon = xsize;
ISEC2_NumLat = ysize;
- ISEC2_FirstLon = lround(originLon * 1000);
- ISEC2_FirstLat = lround(originLat * 1000);
- ISEC2_Lambert_Lov = lround(lonParY * 1000);
- ISEC2_Lambert_LatS1 = lround(lat1 * 1000);
- ISEC2_Lambert_LatS2 = lround(lat2 * 1000);
- ISEC2_Lambert_dx = lround(xincm);
- ISEC2_Lambert_dy = lround(yincm);
+ ISEC2_FirstLon = (int)lround(originLon * 1000);
+ ISEC2_FirstLat = (int)lround(originLat * 1000);
+ ISEC2_Lambert_Lov = (int)lround(lonParY * 1000);
+ ISEC2_Lambert_LatS1 = (int)lround(lat1 * 1000);
+ ISEC2_Lambert_LatS2 = (int)lround(lat2 * 1000);
+ ISEC2_Lambert_dx = (int)lround(xincm);
+ ISEC2_Lambert_dy = (int)lround(yincm);
ISEC2_Lambert_LatSP = 0;
ISEC2_Lambert_LatSP = 0;
ISEC2_Lambert_ProjFlag = projflag;
@@ -30256,12 +29989,12 @@ void cgribexDefEnsembleVar(int *isec1, int vlistID, int varID)
#endif
+#if defined (HAVE_LIBCGRIBEX)
size_t cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridID, int zaxisID,
int vdate, int vtime, int tsteptype, int numavg,
long datasize, const double *data, int nmiss, unsigned char *gribbuffer, size_t gribbuffersize)
{
size_t nbytes = 0;
-#if defined (HAVE_LIBCGRIBEX)
int gribsize;
int iret = 0, iword = 0;
int isec0[2], isec1[4096], isec2[4096], isec3[2], isec4[512];
@@ -30312,8 +30045,9 @@ size_t cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridI
if ( memtype == MEMTYPE_FLOAT )
{
- for ( int i = 0; i < ISEC2_NumVCP; ++i ) fsec2f[10+i] = fsec2[10+i];
- fsec3f[ 1] = fsec3[ 1];
+ size_t numVCP = ISEC2_NumVCP > 0 ? (size_t)ISEC2_NumVCP : (size_t)0;
+ for ( size_t i = 0; i < numVCP; ++i ) fsec2f[10+i] = (float)fsec2[10+i];
+ fsec3f[ 1] = (float)fsec3[ 1];
}
if ( memtype == MEMTYPE_FLOAT )
@@ -30326,12 +30060,9 @@ size_t cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridI
if ( iret ) Error("Problem during GRIB encode (errno = %d)!", iret);
nbytes = (size_t)iword * sizeof (int);
-#else
- Error("CGRIBEX support not compiled in!");
-#endif
-
return (nbytes);
}
+#endif
/*
* Local Variables:
* c-file-style: "Java"
@@ -31841,7 +31572,7 @@ int gribapiScanTimestep2(stream_t * streamptr)
tsID = streamptr->rtsteps;
if ( tsID != 1 )
- Error("Internal problem! unexpeceted timestep %d", tsID+1);
+ Error("Internal problem! unexpected timestep %d", tsID+1);
taxis = &streamptr->tsteps[tsID].taxis;
@@ -33422,11 +33153,10 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
#ifdef HAVE_LIBGRIB_API
size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID,
- int vdate, int vtime, int tsteptype, int numavg,
+ int vdate, int vtime, int tsteptype, int numavg,
long datasize, const double *data, int nmiss, unsigned char **gribbuffer, size_t *gribbuffersize,
int comptype, void *gribContainer)
{
- size_t nbytes = 0;
size_t recsize = 0;
void *dummy = NULL;
int datatype;
@@ -33438,7 +33168,6 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
long bitsPerValue;
long editionNumber = 2;
char name[256];
- grib_handle *gh = NULL;
gribContainer_t *gc = (gribContainer_t *) gribContainer;
// extern unsigned char _grib_template_GRIB2[];
@@ -33450,11 +33179,10 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
vlistInqVarName(vlistID, varID, name);
#if defined(GRIBAPIENCODETEST)
- gh = (grib_handle *) gribHandleNew(editionNumber);
+ grib_handle *gh = (grib_handle *) gribHandleNew(editionNumber);
#else
- gh = gc->gribHandle;
+ grib_handle *gh = gc->gribHandle;
#endif
-
GRIB_CHECK(grib_get_long(gh, "editionNumber", &editionNumber), 0);
if ( editionNumber == 2 )
@@ -33496,15 +33224,15 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
/* Local change: 2013-01-28, FP (DWD) */
/* ---------------------------------- */
- vlist_t *vlistptr;
- vlistptr = vlist_to_pointer(vlistID);
+ vlist_t *vlistptr = vlist_to_pointer(vlistID);
//if (!gc->init)
{
- for (int i=0; i<vlistptr->vars[varID].opt_grib_dbl_nentries; i++)
+ for ( int i=0; i<vlistptr->vars[varID].opt_grib_dbl_nentries; i++ )
{
if ( vlistptr->vars[varID].opt_grib_dbl_update[i] )
{
- vlistptr->vars[varID].opt_grib_dbl_update[i] = FALSE;
+ //DR: Fix for multi-level fields (otherwise only the 1st level is correct)
+ if ( zaxisInqSize(zaxisID)==(levelID+1) ) vlistptr->vars[varID].opt_grib_dbl_update[i] = FALSE;
int ret = my_grib_set_double(gh, vlistptr->vars[varID].opt_grib_dbl_keyword[i],
vlistptr->vars[varID].opt_grib_dbl_val[i]);
if (ret != 0) {
@@ -33515,11 +33243,12 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
GRIB_CHECK(ret, 0);
}
}
- for (int i=0; i<vlistptr->vars[varID].opt_grib_int_nentries; i++)
+ for ( int i=0; i<vlistptr->vars[varID].opt_grib_int_nentries; i++ )
{
if ( vlistptr->vars[varID].opt_grib_int_update[i] )
{
- vlistptr->vars[varID].opt_grib_int_update[i] = FALSE;
+ //DR: Fix for multi-level fields (otherwise only the 1st level is correct)
+ if ( zaxisInqSize(zaxisID)==(levelID+1) ) vlistptr->vars[varID].opt_grib_int_update[i] = FALSE;
int ret = my_grib_set_long(gh, vlistptr->vars[varID].opt_grib_int_keyword[i],
vlistptr->vars[varID].opt_grib_int_val[i]);
if (ret != 0) {
@@ -33556,9 +33285,7 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
gc->init = TRUE;
- nbytes = recsize;
-
- return (nbytes);
+ return (recsize);
}
#endif
@@ -33831,7 +33558,7 @@ int grbUnzipRecord(unsigned char *gribbuffer, size_t *gribsize)
igribsize = *gribsize;
ogribsize = *gribsize;
- if ( (izip = gribGetZip(igribsize, gribbuffer, &unzipsize)) > 0 )
+ if ( (izip = gribGetZip((long)igribsize, gribbuffer, &unzipsize)) > 0 )
{
zip = izip;
if ( izip == 128 ) /* szip */
@@ -33855,7 +33582,7 @@ int grbUnzipRecord(unsigned char *gribbuffer, size_t *gribsize)
unzipsize += 100; /* need 0 to 1 bytes for rounding of bds */
- ogribsize = gribUnzip(gribbuffer, unzipsize, itmpbuffer, igribsize);
+ ogribsize = (size_t)gribUnzip(gribbuffer, unzipsize, itmpbuffer, (long)igribsize);
free(itmpbuffer);
@@ -34148,6 +33875,7 @@ size_t grbEncode(int filetype, int memtype, int varID, int levelID, int vlistID,
#else
Error("GRIB_API support not compiled in!");
(void)gribContainer;
+ (void)comptype;
#endif
@@ -34794,7 +34522,7 @@ int srvScanTimestep2(stream_t *streamptr)
tsID = streamptr->rtsteps;
if ( tsID != 1 )
- Error("Internal problem! unexpeceted timestep %d", tsID+1);
+ Error("Internal problem! unexpected timestep %d", tsID+1);
taxis = &streamptr->tsteps[tsID].taxis;
@@ -35720,7 +35448,7 @@ int extScanTimestep2(stream_t *streamptr)
tsID = streamptr->rtsteps;
if ( tsID != 1 )
- Error("Internal problem! unexpeceted timestep %d", tsID+1);
+ Error("Internal problem! unexpected timestep %d", tsID+1);
taxis = &streamptr->tsteps[tsID].taxis;
@@ -36457,7 +36185,7 @@ int calc_resfac(double xfirst, double xlast, double xinc, double yfirst, double
ifact = ifacarr[j];
for ( i = 0; i < 6; ++i )
{
- if ( fabs(vals[i]*ifact-(lround(vals[i]*ifact))) > FLT_EPSILON ) break;
+ if ( fabs(vals[i]*ifact - round(vals[i]*ifact)) > FLT_EPSILON ) break;
}
if ( i == 6 )
{
@@ -36508,12 +36236,11 @@ void iegDefGrid(int *gdb, int gridID)
if ( gridtype == GRID_LONLAT || gridtype == GRID_GAUSSIAN )
{
- int nlon, nlat;
double xfirst = 0, xlast = 0, xinc = 0;
double yfirst = 0, ylast = 0, yinc = 0;
- nlon = (int) gridInqXsize(gridID);
- nlat = (int) gridInqYsize(gridID);
+ int nlon = gridInqXsize(gridID),
+ nlat = gridInqYsize(gridID);
if ( nlon == 0 )
{
@@ -36552,11 +36279,11 @@ void iegDefGrid(int *gdb, int gridID)
IEG_G_NumLon(gdb) = nlon;
IEG_G_NumLat(gdb) = nlat;
- IEG_G_FirstLat(gdb) = lround(yfirst*resfac);
- IEG_G_LastLat(gdb) = lround(ylast*resfac);
- IEG_G_FirstLon(gdb) = lround(xfirst*resfac);
- IEG_G_LastLon(gdb) = lround(xlast*resfac);
- IEG_G_LonIncr(gdb) = lround(xinc*resfac);
+ IEG_G_FirstLat(gdb) = (int)lround(yfirst*resfac);
+ IEG_G_LastLat(gdb) = (int)lround(ylast*resfac);
+ IEG_G_FirstLon(gdb) = (int)lround(xfirst*resfac);
+ IEG_G_LastLon(gdb) = (int)lround(xlast*resfac);
+ IEG_G_LonIncr(gdb) = (int)lround(xinc*resfac);
if ( fabs(xinc*resfac - IEG_G_LonIncr(gdb)) > FLT_EPSILON )
IEG_G_LonIncr(gdb) = 0;
@@ -36564,7 +36291,7 @@ void iegDefGrid(int *gdb, int gridID)
IEG_G_LatIncr(gdb) = nlat/2;
else
{
- IEG_G_LatIncr(gdb) = lround(yinc*resfac);
+ IEG_G_LatIncr(gdb) = (int)lround(yinc*resfac);
if ( fabs(yinc*resfac - IEG_G_LatIncr(gdb)) > FLT_EPSILON )
IEG_G_LatIncr(gdb) = 0;
@@ -36584,8 +36311,8 @@ void iegDefGrid(int *gdb, int gridID)
if ( gridIsRotated(gridID) )
{
- IEG_G_LatSP(gdb) = - lround(gridInqYpole(gridID) * resfac);
- IEG_G_LonSP(gdb) = lround((gridInqXpole(gridID) + 180) * resfac);
+ IEG_G_LatSP(gdb) = - (int)lround(gridInqYpole(gridID) * resfac);
+ IEG_G_LonSP(gdb) = (int)lround((gridInqXpole(gridID) + 180) * resfac);
IEG_G_Size(gdb) = 42;
}
else
@@ -37213,7 +36940,7 @@ int iegScanTimestep2(stream_t *streamptr)
tsID = streamptr->rtsteps;
if ( tsID != 1 )
- Error("Internal problem! unexpeceted timestep %d", tsID+1);
+ Error("Internal problem! unexpected timestep %d", tsID+1);
taxis = &streamptr->tsteps[tsID].taxis;
@@ -38253,13 +37980,26 @@ int cdfDefDatatype(int datatype, int filetype)
return (xtype);
}
+static inline void *
+resizeBuf(void **buf, size_t *bufSize, size_t reqSize)
+{
+ if (reqSize > *bufSize)
+ {
+ *buf = xrealloc(*buf, reqSize);
+ *bufSize = reqSize;
+ }
+ return *buf;
+}
+
static
void defineAttributes(int vlistID, int varID, int fileID, int ncvarID)
{
int natts, iatt;
int atttype, attlen;
size_t len;
- char attname[1024];
+ char attname[CDI_MAX_NAME+1];
+ void *attBuf = NULL;
+ size_t attBufSize = 0;
vlistInqNatts(vlistID, varID, &natts);
@@ -38271,35 +38011,30 @@ void defineAttributes(int vlistID, int varID, int fileID, int ncvarID)
if ( atttype == DATATYPE_TXT )
{
- char *atttxt = (char *)xmalloc((size_t)attlen*sizeof(char));
+ size_t attSize = (size_t)attlen*sizeof(char);
+ char *atttxt = (char *)resizeBuf(&attBuf, &attBufSize, attSize);
vlistInqAttTxt(vlistID, varID, attname, attlen, atttxt);
len = (size_t)attlen;
cdf_put_att_text(fileID, ncvarID, attname, len, atttxt);
- free(atttxt);
}
else if ( atttype == DATATYPE_INT16 || atttype == DATATYPE_INT32 )
{
- int *attint = (int *)xmalloc((size_t)attlen*sizeof(int));
+ size_t attSize = (size_t)attlen*sizeof(int);
+ int *attint = (int *)resizeBuf(&attBuf, &attBufSize, attSize);
vlistInqAttInt(vlistID, varID, attname, attlen, &attint[0]);
len = (size_t)attlen;
- if ( atttype == DATATYPE_INT16 )
- cdf_put_att_int(fileID, ncvarID, attname, NC_SHORT, len, attint);
- else
- cdf_put_att_int(fileID, ncvarID, attname, NC_INT, len, attint);
- free(attint);
+ cdf_put_att_int(fileID, ncvarID, attname, atttype == DATATYPE_INT16 ? NC_SHORT : NC_INT, len, attint);
}
else if ( atttype == DATATYPE_FLT32 || atttype == DATATYPE_FLT64 )
{
- double *attflt = (double *)xmalloc((size_t)attlen*sizeof(double));
+ size_t attSize = (size_t)attlen * sizeof(double);
+ double *attflt = (double *)resizeBuf(&attBuf, &attBufSize, attSize);
vlistInqAttFlt(vlistID, varID, attname, attlen, attflt);
len = (size_t)attlen;
- if ( atttype == DATATYPE_FLT32 )
- cdf_put_att_double(fileID, ncvarID, attname, NC_FLOAT, len, attflt);
- else
- cdf_put_att_double(fileID, ncvarID, attname, NC_DOUBLE, len, attflt);
- free(attflt);
+ cdf_put_att_double(fileID, ncvarID, attname, atttype == DATATYPE_FLT32 ? NC_FLOAT : NC_DOUBLE, len, attflt);
}
}
+ free(attBuf);
}
void cdfCopyRecord(stream_t *streamptr2, stream_t *streamptr1)
@@ -38497,15 +38232,13 @@ void cdf_write_record(stream_t *streamptr, int memtype, const void *data, int nm
void cdfReadRecord(stream_t *streamptr, double *data, int *nmiss)
{
- int levelID, varID, tsID, recID, vrecID;
-
if ( CDI_Debug ) Message("streamID = %d", streamptr->self);
- tsID = streamptr->curTsID;
- vrecID = streamptr->tsteps[tsID].curRecID;
- recID = streamptr->tsteps[tsID].recIDs[vrecID];
- varID = streamptr->tsteps[tsID].records[recID].varID;
- levelID = streamptr->tsteps[tsID].records[recID].levelID;
+ int tsID = streamptr->curTsID;
+ int vrecID = streamptr->tsteps[tsID].curRecID;
+ int recID = streamptr->tsteps[tsID].recIDs[vrecID];
+ int varID = streamptr->tsteps[tsID].records[recID].varID;
+ int levelID = streamptr->tsteps[tsID].records[recID].levelID;
cdfReadVarSliceDP(streamptr, varID, levelID, data, nmiss);
}
@@ -38513,16 +38246,12 @@ void cdfReadRecord(stream_t *streamptr, double *data, int *nmiss)
static
void cdfDefTimeValue(stream_t *streamptr, int tsID)
{
- int fileID;
- int ncvarid;
- taxis_t *taxis;
-
- fileID = streamptr->fileID;
+ int fileID = streamptr->fileID;
if ( CDI_Debug )
Message("streamID = %d, fileID = %d", streamptr->self, fileID);
- taxis = &streamptr->tsteps[tsID].taxis;
+ taxis_t *taxis = &streamptr->tsteps[tsID].taxis;
if ( streamptr->ncmode == 1 )
{
@@ -38535,7 +38264,7 @@ void cdfDefTimeValue(stream_t *streamptr, int tsID)
double timevalue = cdiEncodeTimeval(taxis->vdate, taxis->vtime, &streamptr->tsteps[0].taxis);
if ( CDI_Debug ) Message("tsID = %d timevalue = %f", tsID, timevalue);
- ncvarid = streamptr->basetime.ncvarid;
+ int ncvarid = streamptr->basetime.ncvarid;
cdf_put_var1_double(fileID, ncvarid, &index, &timevalue);
if ( taxis->has_bounds )
@@ -38771,9 +38500,7 @@ void cdfDefTime(stream_t* streamptr)
void cdfDefTimestep(stream_t *streamptr, int tsID)
{
- int vlistID;
-
- vlistID = streamptr->vlistID;
+ int vlistID = streamptr->vlistID;
if ( vlistHasTime(vlistID) ) cdfDefTime(streamptr);
@@ -38784,19 +38511,14 @@ static
void cdfDefComplex(stream_t *streamptr, int gridID)
{
char axisname[] = "nc2";
- int index;
int dimID = UNDEFID;
- int gridID0, gridtype0, gridindex;
- int ngrids;
- int fileID;
- int vlistID;
-
- vlistID = streamptr->vlistID;
- fileID = streamptr->fileID;
+ int gridID0, gridtype0;
+ int vlistID = streamptr->vlistID;
+ int fileID = streamptr->fileID;
- ngrids = vlistNgrids(vlistID);
+ int ngrids = vlistNgrids(vlistID);
- for ( index = 0; index < ngrids; index++ )
+ for ( int index = 0; index < ngrids; index++ )
{
if ( streamptr->xdimID[index] != UNDEFID )
{
@@ -38822,7 +38544,7 @@ void cdfDefComplex(stream_t *streamptr, int gridID)
streamptr->ncmode = 2;
}
- gridindex = vlistGridIndex(vlistID, gridID);
+ int gridindex = vlistGridIndex(vlistID, gridID);
streamptr->xdimID[gridindex] = dimID;
}
@@ -41115,7 +40837,7 @@ size_t cdfDoInputDataTransformationDP(size_t valueCount, double *data, bool have
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? missVal
: isMissVal ? data[i] : data[i] * scaleFactor + offset;
}
@@ -41125,7 +40847,7 @@ size_t cdfDoInputDataTransformationDP(size_t valueCount, double *data, bool have
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? missVal
: isMissVal ? data[i] : data[i] + offset;
}
@@ -41135,7 +40857,7 @@ size_t cdfDoInputDataTransformationDP(size_t valueCount, double *data, bool have
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? missVal
: isMissVal ? data[i] : data[i] * scaleFactor;
}
@@ -41145,7 +40867,7 @@ size_t cdfDoInputDataTransformationDP(size_t valueCount, double *data, bool have
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? missVal : data[i];
}
break;
@@ -41214,7 +40936,7 @@ size_t cdfDoInputDataTransformationSP(size_t valueCount, float *data, bool haveM
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? (float)missVal
: isMissVal ? data[i] : (float)(data[i] * scaleFactor + offset);
}
@@ -41224,7 +40946,7 @@ size_t cdfDoInputDataTransformationSP(size_t valueCount, float *data, bool haveM
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? (float)missVal
: isMissVal ? data[i] : (float)(data[i] + offset);
}
@@ -41234,7 +40956,7 @@ size_t cdfDoInputDataTransformationSP(size_t valueCount, float *data, bool haveM
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? (float)missVal
: isMissVal ? data[i] : (float)(data[i] * scaleFactor);
}
@@ -41244,7 +40966,7 @@ size_t cdfDoInputDataTransformationSP(size_t valueCount, float *data, bool haveM
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? (float)missVal : data[i];
}
break;
@@ -41931,7 +41653,7 @@ void cdfReadVarSP(stream_t *streamptr, int varID, float *data, int *nmiss)
cdf_get_vara_float(fileID, ncvarid, start, count, data);
- size_t size = (size_t)gridInqSize(gridID)*zaxisInqSize(zaxisID);
+ size_t size = (size_t)gridInqSize(gridID) * (size_t)zaxisInqSize(zaxisID);
double missval = vlistInqVarMissval(vlistID, varID);
const bool haveMissVal = vlistInqVarMissvalUsed(vlistID, varID);
double validRange[2];
@@ -42062,63 +41784,52 @@ void cdfReadVarSliceSP(stream_t *streamptr, int varID, int levelID, float *data,
void cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, const void *data, int nmiss)
{
- int fileID;
- int gridID;
- int zaxisID;
- int xid = UNDEFID, yid = UNDEFID, zid = UNDEFID;
- int ncvarid;
- long nvals;
size_t xsize = 0, ysize = 0;
size_t start[5];
size_t count[5];
- int ndims = 0;
- int idim;
- int tsteptype;
- int gridindex, zaxisindex;
int dimorder[3];
- int swapxy = FALSE;
- int dtype;
- int vlistID;
- extern int CDF_Debug;
+ int xid = UNDEFID, yid = UNDEFID, zid = UNDEFID;
if ( CDI_Debug ) Message("streamID = %d varID = %d", streamptr->self, varID);
- vlistID = streamptr->vlistID;
- fileID = streamptr->fileID;
+ int vlistID = streamptr->vlistID;
+ int fileID = streamptr->fileID;
long ntsteps = streamptr->ntsteps;
if ( CDI_Debug ) Message("ntsteps = %ld", ntsteps);
if ( vlistHasTime(vlistID) ) cdfDefTime(streamptr);
- ncvarid = cdfDefVar(streamptr, varID);
+ int ncvarid = cdfDefVar(streamptr, varID);
- gridID = vlistInqVarGrid(vlistID, varID);
- zaxisID = vlistInqVarZaxis(vlistID, varID);
- tsteptype = vlistInqVarTsteptype(vlistID, varID);
+ int gridID = vlistInqVarGrid(vlistID, varID);
+ int zaxisID = vlistInqVarZaxis(vlistID, varID);
+ int tsteptype = vlistInqVarTsteptype(vlistID, varID);
vlistInqVarDimorder(vlistID, varID, &dimorder);
- gridindex = vlistGridIndex(vlistID, gridID);
if ( gridInqType(gridID) == GRID_TRAJECTORY )
{
cdfWriteGridTraj(streamptr, gridID);
}
else
{
+ int gridindex = vlistGridIndex(vlistID, gridID);
xid = streamptr->xdimID[gridindex];
yid = streamptr->ydimID[gridindex];
}
+ {
+ int zaxisindex = vlistZaxisIndex(vlistID, zaxisID);
+ zid = streamptr->zaxisID[zaxisindex];
+ }
- zaxisindex = vlistZaxisIndex(vlistID, zaxisID);
- zid = streamptr->zaxisID[zaxisindex];
-
- if ( (dimorder[2] == 2 || dimorder[0] == 1) && xid != UNDEFID && yid != UNDEFID ) swapxy = TRUE;
+ int swapxy = (dimorder[2] == 2 || dimorder[0] == 1) && xid != UNDEFID && yid != UNDEFID;
/*
printf("swapxy %d\n", swapxy);
printf("dimorder: %d %d %d\n", dimorder[0], dimorder[1], dimorder[2]);
*/
+ size_t ndims = 0;
if ( tsteptype != TSTEP_CONSTANT )
{
start[ndims] = (size_t)ntsteps - 1;
@@ -42151,14 +41862,14 @@ void cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtyp
}
if ( CDI_Debug )
- for (idim = 0; idim < ndims; idim++)
+ for (size_t idim = 0; idim < ndims; idim++)
Message("dim = %d start = %d count = %d", idim, start[idim], count[idim]);
- dtype = vlistInqVarDatatype(vlistID, varID);
+ int dtype = vlistInqVarDatatype(vlistID, varID);
if ( nmiss > 0 ) cdfDefVarMissval(streamptr, varID, dtype, 1);
- nvals = gridInqSize(gridID);
+ long nvals = gridInqSize(gridID);
cdf_write_var_data(fileID, vlistID, varID, ncvarid, dtype, nvals, xsize, ysize, swapxy, start, count, memtype, data, nmiss);
@@ -42677,23 +42388,6 @@ void printNCvars(ncvar_t *ncvars, int nvars, const char *oname)
}
}
-typedef struct
-{
- int ncvarid;
- char name[CDI_MAX_NAME];
-}
-varinfo_t;
-
-
-static
-int cmpvarname(const void *s1, const void *s2)
-{
- varinfo_t *x = (varinfo_t *) s1;
- varinfo_t *y = (varinfo_t *) s2;
-
- return (strcmp(x->name, y->name));
-}
-
static
void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
int timedimid, int modelID, int format)
@@ -43696,7 +43390,6 @@ void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
int ltwarn = TRUE;
size_t attlen;
char attname[CDI_MAX_NAME];
- const int attstringlen = 8192; char attstring[8192];
double datt;
for ( ncvarid = 0; ncvarid < nvars; ++ncvarid )
@@ -44154,6 +43847,11 @@ void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
if ( strcmp(attname, "grid_mapping_name") == 0 )
{
+ enum {
+ attstringlen = 8192,
+ };
+ char attstring[attstringlen];
+
cdfGetAttText(ncvars[ncvarid].ncid, ncvars[ncvarid].gmapid, attname, attstringlen-1, attstring);
strtolower(attstring);
@@ -44404,7 +44102,6 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
int zdimid = UNDEFID;
int zvarid = UNDEFID;
int zsize = 1;
- double *zvar = NULL;
double *lbounds = NULL;
double *ubounds = NULL;
int zaxisType;
@@ -44426,7 +44123,7 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
if ( CDI_Debug ) Message("nlevs = %d", zsize);
- zvar = (double *)xmalloc((size_t)zsize * sizeof (double));
+ double *zvar = (double *)xmalloc((size_t)zsize * sizeof (double));
zaxisType = UNDEFID;
@@ -44546,50 +44243,53 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
}
}
+struct varinfo
+{
+ int ncvarid;
+ const char *name;
+};
+
+static
+int cmpvarname(const void *s1, const void *s2)
+{
+ const struct varinfo *x = (const struct varinfo *)s1,
+ *y = (const struct varinfo *)s2;
+ return (strcmp(x->name, y->name));
+}
+
/* define all input data variables */
static
void define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID, int *varids, int nvars, int num_ncvars, ncvar_t *ncvars)
{
- int ncid;
- int varID1, varID, ncvarid;
- int code;
- int tableID;
-
if ( streamptr->sortname )
{
- int index;
- varinfo_t **varInfo;
- varInfo = (varinfo_t **)xmalloc((size_t)nvars * sizeof (varinfo_t *));
- varInfo[0] = (varinfo_t *)xmalloc((size_t)nvars * sizeof (varinfo_t));
-
- for ( index = 1; index < nvars; index++ )
- varInfo[index] = varInfo[0] + index;
+ struct varinfo *varInfo
+ = (struct varinfo *)xmalloc((size_t)nvars * sizeof (struct varinfo));
- for ( varID = 0; varID < nvars; varID++ )
+ for ( int varID = 0; varID < nvars; varID++ )
{
- ncvarid = varids[varID];
- varInfo[varID]->ncvarid = ncvarid;
- strcpy(varInfo[varID]->name, ncvars[ncvarid].name);
+ int ncvarid = varids[varID];
+ varInfo[varID].ncvarid = ncvarid;
+ varInfo[varID].name = ncvars[ncvarid].name;
}
- qsort(varInfo[0], (size_t)nvars, sizeof(varinfo_t), cmpvarname);
- for ( varID = 0; varID < nvars; varID++ )
+ qsort(varInfo, (size_t)nvars, sizeof(varInfo[0]), cmpvarname);
+ for ( int varID = 0; varID < nvars; varID++ )
{
- varids[varID] = varInfo[varID]->ncvarid;
+ varids[varID] = varInfo[varID].ncvarid;
}
- free(varInfo[0]);
free(varInfo);
}
- for ( varID1 = 0; varID1 < nvars; varID1++ )
+ for ( int varID1 = 0; varID1 < nvars; varID1++ )
{
int gridID, zaxisID;
- ncvarid = varids[varID1];
+ int ncvarid = varids[varID1];
gridID = ncvars[ncvarid].gridID;
zaxisID = ncvars[ncvarid].zaxisID;
- varID = stream_new_var(streamptr, gridID, zaxisID);
- varID = vlistDefVar(vlistID, gridID, zaxisID, ncvars[ncvarid].tsteptype);
+ stream_new_var(streamptr, gridID, zaxisID);
+ int varID = vlistDefVar(vlistID, gridID, zaxisID, ncvars[ncvarid].tsteptype);
#if defined (HAVE_NETCDF4)
if ( ncvars[ncvarid].deflate )
@@ -44704,10 +44404,10 @@ void define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID,
}
}
- for ( varID = 0; varID < nvars; varID++ )
+ for ( int varID = 0; varID < nvars; varID++ )
{
- ncvarid = varids[varID];
- ncid = ncvars[ncvarid].ncid;
+ int ncvarid = varids[varID];
+ int ncid = ncvars[ncvarid].ncid;
if ( ncvars[ncvarid].natts )
{
@@ -44763,12 +44463,12 @@ void define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID,
}
/* release mem of not freed attributes */
- for ( ncvarid = 0; ncvarid < num_ncvars; ncvarid++ )
+ for ( int ncvarid = 0; ncvarid < num_ncvars; ncvarid++ )
if ( ncvars[ncvarid].atts ) free(ncvars[ncvarid].atts);
if ( varids ) free(varids);
- for ( varID = 0; varID < nvars; varID++ )
+ for ( int varID = 0; varID < nvars; varID++ )
{
if ( vlistInqVarCode(vlistID, varID) == -varID-1 )
{
@@ -44803,12 +44503,12 @@ void define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID,
}
}
- for ( varID = 0; varID < nvars; varID++ )
+ for ( int varID = 0; varID < nvars; varID++ )
{
- instID = vlistInqVarInstitut(vlistID, varID);
- modelID = vlistInqVarModel(vlistID, varID);
- tableID = vlistInqVarTable(vlistID, varID);
- code = vlistInqVarCode(vlistID, varID);
+ int instID = vlistInqVarInstitut(vlistID, varID);
+ int modelID = vlistInqVarModel(vlistID, varID);
+ int tableID = vlistInqVarTable(vlistID, varID);
+ int code = vlistInqVarCode(vlistID, varID);
if ( cdiDefaultTableID != UNDEFID )
{
if ( tableInqParNamePtr(cdiDefaultTableID, code) )
@@ -44841,12 +44541,15 @@ void define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID,
}
static
-void scan_global_attributes(int fileID, int vlistID, stream_t *streamptr, int ngatts, int *instID, int *modelID, int *ucla_les, unsigned char *uuidOfHGrid, unsigned char *uuidOfVGrid, char *gridfile, int *number_of_grid_used, char *fcreftime)
+void scan_global_attributes(int fileID, int vlistID, stream_t *streamptr, int ngatts, int *instID, int *modelID, int *ucla_les, unsigned char *uuidOfHGrid, unsigned char *uuidOfVGrid, char *gridfile, int *number_of_grid_used)
{
nc_type xtype;
size_t attlen;
char attname[CDI_MAX_NAME];
- const int attstringlen = 8192; char attstring[8192];
+ enum {
+ attstringlen = 8192,
+ };
+ char attstring[attstringlen];
int iatt;
for ( iatt = 0; iatt < ngatts; iatt++ )
@@ -44964,9 +44667,8 @@ static
int find_leadtime(int nvars, ncvar_t *ncvars)
{
int leadtime_id = UNDEFID;
- int ncvarid;
- for ( ncvarid = 0; ncvarid < nvars; ncvarid++ )
+ for ( int ncvarid = 0; ncvarid < nvars; ncvarid++ )
{
if ( ncvars[ncvarid].stdname[0] )
{
@@ -45094,12 +44796,10 @@ int cdfInqContents(stream_t *streamptr)
int ndims, nvars, ngatts, unlimdimid;
int ncvarid;
int ncdimid;
- int fileID;
size_t ntsteps;
int timedimid = -1;
int *varids;
int nvarids;
- const int attstringlen = 8192; char attstring[8192];
int time_has_units = FALSE;
int time_has_bounds = FALSE;
int time_climatology = FALSE;
@@ -45115,7 +44815,6 @@ int cdfInqContents(stream_t *streamptr)
int calendar = UNDEFID;
ncdim_t *ncdims;
ncvar_t *ncvars = NULL;
- int vlistID;
int format = 0;
int ucla_les = FALSE;
unsigned char uuidOfHGrid[CDI_UUID_SIZE];
@@ -45129,8 +44828,8 @@ int cdfInqContents(stream_t *streamptr)
gridfile[0] = 0;
fcreftime[0] = 0;
- vlistID = streamptr->vlistID;
- fileID = streamptr->fileID;
+ int vlistID = streamptr->vlistID;
+ int fileID = streamptr->fileID;
if ( CDI_Debug ) Message("streamID = %d, fileID = %d", streamptr->self, fileID);
@@ -45198,7 +44897,7 @@ int cdfInqContents(stream_t *streamptr)
/* scan global attributes */
scan_global_attributes(fileID, vlistID, streamptr, ngatts, &instID, &modelID, &ucla_les,
- uuidOfHGrid, uuidOfVGrid, gridfile, &number_of_grid_used, fcreftime);
+ uuidOfHGrid, uuidOfVGrid, gridfile, &number_of_grid_used);
/* find time dim */
if ( unlimdimid >= 0 )
@@ -45524,6 +45223,11 @@ int cdfInqContents(stream_t *streamptr)
if ( ncvarid != UNDEFID )
if ( ncvars[ncvarid].calendar == TRUE )
{
+ enum {
+ attstringlen = 8192,
+ };
+ char attstring[attstringlen];
+
cdfGetAttText(fileID, ncvarid, "calendar", attstringlen-1, attstring);
strtolower(attstring);
@@ -45817,13 +45521,12 @@ static void cdfDefSource(stream_t *streamptr)
static void cdfDefGlobalAtts(stream_t *streamptr)
{
- int fileID, vlistID;
int natts;
if ( streamptr->globalatts ) return;
- vlistID = streamptr->vlistID;
- fileID = streamptr->fileID;
+ int vlistID = streamptr->vlistID;
+ int fileID = streamptr->fileID;
cdfDefSource(streamptr);
cdfDefInstitut(streamptr);
@@ -45899,31 +45602,31 @@ void cdfInqHistoryString(stream_t *streamptr, char *history)
void cdfDefVars(stream_t *streamptr)
{
- int index, gridID, zaxisID, vlistID;
- int ngrids, nzaxis;
/* int nvars, ncvarid; */
- vlistID = streamptr->vlistID;
+ int vlistID = streamptr->vlistID;
if ( vlistID == UNDEFID )
Error("Internal problem! vlist undefined for streamptr %p", streamptr);
/* nvars = vlistNvars(vlistID); */
- ngrids = vlistNgrids(vlistID);
- nzaxis = vlistNzaxis(vlistID);
+ int ngrids = vlistNgrids(vlistID);
+ int nzaxis = vlistNzaxis(vlistID);
/*
if ( vlistHasTime(vlistID) ) cdfDefTime(streamptr);
*/
- for ( index = 0; index < ngrids; index++ )
- {
- gridID = vlistGrid(vlistID, index);
- cdfDefGrid(streamptr, gridID);
- }
+ if (ngrids > 0)
+ for (size_t index = 0; index < (size_t)ngrids; index++ )
+ {
+ int gridID = vlistGrid(vlistID, (int)index);
+ cdfDefGrid(streamptr, gridID);
+ }
- for ( index = 0; index < nzaxis; index++ )
- {
- zaxisID = vlistZaxis(vlistID, index);
- if ( streamptr->zaxisID[index] == UNDEFID ) cdfDefZaxis(streamptr, zaxisID);
- }
+ if (nzaxis > 0)
+ for (size_t index = 0; index < (size_t)nzaxis; index++ )
+ {
+ int zaxisID = vlistZaxis(vlistID, (int)index);
+ if ( streamptr->zaxisID[index] == UNDEFID ) cdfDefZaxis(streamptr, zaxisID);
+ }
/*
define time first!!!
for (varID = 0; varID < nvars; varID++ )
@@ -46168,21 +45871,16 @@ void cdiInitRecord(stream_t *streamptr)
{
streamptr->record = (Record *) malloc(sizeof(Record));
- streamptr->record->used = 0;
- streamptr->record->nrec = 0;
- streamptr->record->dataread = 1;
streamptr->record->param = 0;
streamptr->record->level = 0;
streamptr->record->date = 0;
streamptr->record->time = 0;
streamptr->record->gridID = 0;
- streamptr->record->zaxisID = 0;
streamptr->record->buffer = NULL;
streamptr->record->buffersize = 0;
streamptr->record->position = 0;
streamptr->record->varID = 0;
streamptr->record->levelID = CDI_UNDEFID;
- streamptr->record->recid = 0;
}
@@ -46263,7 +45961,6 @@ void streamDefRecord(int streamID, int varID, int levelID)
streamptr->record->date = streamptr->tsteps[tsID].taxis.vdate;
streamptr->record->time = streamptr->tsteps[tsID].taxis.vtime;
streamptr->record->gridID = gridID;
- streamptr->record->zaxisID = zaxisID;
streamptr->record->prec = vlistInqVarDatatype(vlistID, varID);
switch (streamptr->filetype)
@@ -48159,7 +47856,7 @@ size_t fileWrite(int fileID, const void *restrict ptr, size_t size)
* End:
*/
-/* Automatically generated by m214003 at 2014-09-30, do not edit */
+/* Automatically generated by m214003 at 2014-12-03, do not edit */
/* CGRIBEXLIB_VERSION="1.7.0" */
@@ -48169,7 +47866,6 @@ size_t fileWrite(int fileID, const void *restrict ptr, size_t size)
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
-#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic warning "-Wstrict-overflow"
#endif
@@ -50284,16 +49980,16 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
/* Round up for negative numbers. */
if ( isign == 0 )
- *kmant = (int) rpowref;
+ *kmant = (int)rpowref;
else
- *kmant = lround(rpowref + 0.5);
+ *kmant = (int)lround(rpowref + 0.5);
}
else
{
/* Closest number in GRIB format to the original number */
/* (equal to, greater than or less than original number). */
- *kmant = lround(rpowref);
+ *kmant = (int)lround(rpowref);
}
/* Check that mantissa value does not exceed 24 bits. */
@@ -50341,16 +50037,16 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
/* Round up for negative numbers. */
if ( isign == 0 )
- *kmant = (int) rpowref;
+ *kmant = (int)rpowref;
else
- *kmant = lround(rpowref + 0.5);
+ *kmant = (int)lround(rpowref + 0.5);
}
else
{
/* Closest number in GRIB format to the original number */
/* (equal to, greater or less than original number). */
- *kmant = lround(rpowref);
+ *kmant = (int)lround(rpowref);
}
/* Repeat calculation (with modified exponent) if still have */
@@ -62373,7 +62069,7 @@ void encode_dummy(void)
(void) encode_array_unrolled_double(0, 0, 0, NULL, NULL, 0, 0, NULL);
(void) encode_array_unrolled_float(0, 0, 0, NULL, NULL, 0, 0, NULL);
}
-static const char grb_libvers[] = "1.7.0" " of ""Sep 30 2014"" ""13:27:33";
+static const char grb_libvers[] = "1.7.0" " of ""Dec 3 2014"" ""08:52:12";
const char *
cgribexLibraryVersion(void)
{
@@ -62899,7 +62595,7 @@ void cdfComment(int ncid)
strcat(comment, "??");
else
strncat(comment, libvers, size);
- strcat(comment, " (http://code.zmaw.de/projects/cdi)");
+ strcat(comment, " (https://code.zmaw.de/projects/cdi)");
}
cdf_put_att_text(ncid, NC_GLOBAL, "CDI", strlen(comment), comment);
@@ -63083,28 +62779,6 @@ static int activeNamespace = 0;
#define CDI_NETCDF_SWITCHES
#endif
-#if defined (SX)
-static const union namespaceSwitchValue defaultSwitches[NUM_NAMESPACE_SWITCH] = {
- { .func = (void (*)()) cdiAbortC_serial },
- { .func = (void (*)()) cdiWarning },
- { .func = (void (*)()) serializeGetSizeInCore },
- { .func = (void (*)()) serializePackInCore },
- { .func = (void (*)()) serializeUnpackInCore },
- { .func = (void (*)()) fileOpen_serial },
- { .func = (void (*)()) fileWrite },
- { .func = (void (*)()) fileClose_serial },
- { .func = (void (*)()) cdiStreamOpenDefaultDelegate },
- { .func = (void (*)()) cdiStreamDefVlist_ },
- { .func = (void (*)()) cdiStreamWriteVar_ },
- { .func = (void (*)()) cdiStreamwriteVarChunk_ },
- { .func = (void (*)()) 0 },
- { .func = (void (*)()) 0 },
- { .func = (void (*)()) cdiStreamCloseDefaultDelegate },
- { .func = (void (*)()) cdiStreamDefTimestep_ },
- { .func = (void (*)()) cdiStreamSync_ },
- CDI_NETCDF_SWITCHES
-};
-#else
#define defaultSwitches { \
{ .func = (void (*)()) cdiAbortC_serial }, \
{ .func = (void (*)()) cdiWarning }, \
@@ -63125,6 +62799,10 @@ static const union namespaceSwitchValue defaultSwitches[NUM_NAMESPACE_SWITCH] =
{ .func = (void (*)()) cdiStreamSync_ }, \
CDI_NETCDF_SWITCHES \
}
+
+#if defined (SX)
+static const union namespaceSwitchValue
+ defaultSwitches_[NUM_NAMESPACE_SWITCH] = defaultSwitches;
#endif
struct Namespace
@@ -63133,30 +62811,7 @@ struct Namespace
union namespaceSwitchValue switches[NUM_NAMESPACE_SWITCH];
} initialNamespace = {
.resStage = STAGE_DEFINITION,
-#if defined (SX)
- .switches = {
- { .func = (void (*)()) cdiAbortC_serial },
- { .func = (void (*)()) cdiWarning },
- { .func = (void (*)()) serializeGetSizeInCore },
- { .func = (void (*)()) serializePackInCore },
- { .func = (void (*)()) serializeUnpackInCore },
- { .func = (void (*)()) fileOpen_serial },
- { .func = (void (*)()) fileWrite },
- { .func = (void (*)()) fileClose_serial },
- { .func = (void (*)()) cdiStreamOpenDefaultDelegate },
- { .func = (void (*)()) cdiStreamDefVlist_ },
- { .func = (void (*)()) cdiStreamWriteVar_ },
- { .func = (void (*)()) cdiStreamwriteVarChunk_ },
- { .func = (void (*)()) 0 },
- { .func = (void (*)()) 0 },
- { .func = (void (*)()) cdiStreamCloseDefaultDelegate },
- { .func = (void (*)()) cdiStreamDefTimestep_ },
- { .func = (void (*)()) cdiStreamSync_ },
- CDI_NETCDF_SWITCHES
-}
-#else
.switches = defaultSwitches
-#endif
};
struct Namespace *namespaces = &initialNamespace;
@@ -63274,7 +62929,8 @@ namespaceNew()
++nNamespaces;
namespaces[newNamespaceID].resStage = STAGE_DEFINITION;
#if defined (SX)
- memcpy(namespaces[newNamespaceID].switches, defaultSwitches,
+ memcpy(namespaces[newNamespaceID].switches,
+ defaultSwitches_,
sizeof (namespaces[newNamespaceID].switches));
#else
memcpy(namespaces[newNamespaceID].switches,
@@ -63419,22 +63075,22 @@ serializeGetSize(int count, int datatype, void *context)
return serialize_get_size_p(count, datatype, context);
}
-void serializePack(void *data, int count, int datatype,
- void *buf, int buf_size, int *position, void *context)
+void serializePack(const void *data, int count, int datatype,
+ void *buf, int buf_size, int *position, void *context)
{
- void (*serialize_pack_p)(void *data, int count, int datatype,
+ void (*serialize_pack_p)(const void *data, int count, int datatype,
void *buf, int buf_size, int *position, void *context)
- = (void (*)(void *, int, int, void *, int, int *, void *))
+ = (void (*)(const void *, int, int, void *, int, int *, void *))
namespaceSwitchGet(NSSWITCH_SERIALIZE_PACK).func;
serialize_pack_p(data, count, datatype, buf, buf_size, position, context);
}
-void serializeUnpack(void *buf, int buf_size, int *position,
- void *data, int count, int datatype, void *context)
+void serializeUnpack(const void *buf, int buf_size, int *position,
+ void *data, int count, int datatype, void *context)
{
- void (*serialize_unpack_p)(void *buf, int buf_size, int *position,
+ void (*serialize_unpack_p)(const void *buf, int buf_size, int *position,
void *data, int count, int datatype, void *context)
- = (void (*)(void *, int, int *, void *, int, int, void *))
+ = (void (*)(const void *, int, int *, void *, int, int, void *))
namespaceSwitchGet(NSSWITCH_SERIALIZE_UNPACK).func;
serialize_unpack_p(buf, buf_size, position, data, count, datatype, context);
}
@@ -63468,14 +63124,17 @@ serializeGetSizeInCore(int count, int datatype, void *context)
case DATATYPE_UCHAR:
elemSize = 1;
break;
+ case DATATYPE_LONG:
+ elemSize = sizeof (long);
+ break;
default:
xabort("Unexpected datatype");
}
return count * elemSize;
}
-void serializePackInCore(void *data, int count, int datatype,
- void *buf, int buf_size, int *position, void *context)
+void serializePackInCore(const void *data, int count, int datatype,
+ void *buf, int buf_size, int *position, void *context)
{
int size = serializeGetSize(count, datatype, context);
int pos = *position;
@@ -63485,8 +63144,8 @@ void serializePackInCore(void *data, int count, int datatype,
*position = pos;
}
-void serializeUnpackInCore(void *buf, int buf_size, int *position,
- void *data, int count, int datatype, void *context)
+void serializeUnpackInCore(const void *buf, int buf_size, int *position,
+ void *data, int count, int datatype, void *context)
{
int size = serializeGetSize(count, datatype, context);
int pos = *position;
@@ -63513,15 +63172,14 @@ void serializeUnpackInCore(void *buf, int buf_size, int *position,
static
void show_stackframe()
{
-#if defined (HAVE_EXECINFO_H)
+#if defined HAVE_EXECINFO_H && defined backtrace_size_t && defined HAVE_BACKTRACE
void *trace[16];
- size_t i;
- size_t trace_size = backtrace(trace, 16);
+ backtrace_size_t trace_size = backtrace(trace, 16);
char **messages = backtrace_symbols(trace, trace_size);
fprintf(stderr, "[bt] Execution path:\n");
if ( messages ) {
- for ( i = 0; i < trace_size; ++i )
+ for ( backtrace_size_t i = 0; i < trace_size; ++i )
fprintf(stderr, "[bt] %s\n", messages[i]);
free(messages);
}
@@ -64025,6 +63683,10 @@ reshPackResource_intern(int resH, const resOps *ops, void *buf, int buf_size, in
curr->res.v.ops->valPack(curr->res.v.val, buf, buf_size, position, context);
}
+enum {
+ resHPackHeaderNInt = 2,
+ resHDeleteNInt = 2,
+};
static int getPackBufferSize(void *context)
{
@@ -64033,7 +63695,7 @@ static int getPackBufferSize(void *context)
int nsp = namespaceGetActive ();
/* pack start marker, namespace and sererator marker */
- packBufferSize += 3 * (intpacksize = serializeGetSize(1, DATATYPE_INT, context));
+ packBufferSize += resHPackHeaderNInt * (intpacksize = serializeGetSize(1, DATATYPE_INT, context));
/* pack resources, type marker and seperator marker */
listElem_t *r = resHList[nsp].resources;
@@ -64042,15 +63704,15 @@ static int getPackBufferSize(void *context)
{
if (r[i].status == RESH_DESYNC_DELETED)
{
- packBufferSize += 3 * intpacksize;
+ packBufferSize += resHDeleteNInt * intpacksize;
}
else if (r[i].status == RESH_DESYNC_IN_USE)
{
xassert ( r[i].res.v.ops );
- /* message plus frame of 2 ints */
+ /* packed resource plus 1 int for type */
packBufferSize +=
r[i].res.v.ops->valGetPackSize(r[i].res.v.val, context)
- + 2 * intpacksize;
+ + intpacksize;
}
}
/* end marker */
@@ -64071,7 +63733,7 @@ void reshPackBufferDestroy ( char ** buffer )
void reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
{
int i, packBufferPos = 0;
- int start = START, end = END, sep = SEPARATOR, type;
+ int end = END;
xassert ( packBuffer );
@@ -64083,8 +63745,8 @@ void reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
char *pB = *packBuffer = (char *)xcalloc(1, (size_t)pBSize);
{
- int header[3] = { start, nsp, sep };
- serializePack(header, 3, DATATYPE_INT, pB, pBSize, &packBufferPos, context);
+ int header[resHPackHeaderNInt] = { START, nsp };
+ serializePack(header, resHPackHeaderNInt, DATATYPE_INT, pB, pBSize, &packBufferPos, context);
}
listElem_t *r = resHList[nsp].resources;
@@ -64093,23 +63755,21 @@ void reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
{
if (r[i].status == RESH_DESYNC_DELETED)
{
- enum { del_ints = 3 };
- int temp[del_ints] = { RESH_DELETE, namespaceIdxEncode2(nsp, i), SEPARATOR };
- serializePack(temp, del_ints, DATATYPE_INT,
+ int temp[resHDeleteNInt]
+ = { RESH_DELETE, namespaceIdxEncode2(nsp, i) };
+ serializePack(temp, resHDeleteNInt, DATATYPE_INT,
pB, pBSize, &packBufferPos, context);
}
else
{
listElem_t * curr = r + i;
xassert ( curr->res.v.ops );
- type = curr->res.v.ops->valTxCode ();
+ int type = curr->res.v.ops->valTxCode();
if ( ! type ) continue;
serializePack(&type, 1, DATATYPE_INT, pB,
pBSize, &packBufferPos, context);
curr->res.v.ops->valPack(curr->res.v.val,
pB, pBSize, &packBufferPos, context);
- serializePack(&sep, 1, DATATYPE_INT,
- pB, pBSize, &packBufferPos, context);
}
r[i].status &= ~RESH_SYNC_BIT;
}
@@ -64305,7 +63965,7 @@ void reshListPrint(FILE *fp)
* require-trailing-newline: t
* End:
*/
- static const char cdi_libvers[] = "1.6.6" " of ""Nov 25 2014"" ""15:24:48";
+ static const char cdi_libvers[] = "1.6.7" " of ""Dec 10 2014"" ""16:20:02";
const char *cdiLibraryVersion(void)
{
return (cdi_libvers);
@@ -66838,6 +66498,7 @@ FCALLSCFUN3 (INT, cdiEncodeTime, CDIENCODETIME, cdiencodetime, INT, INT, INT)
/* STREAM control routines */
+FCALLSCFUN2 (INT, cdiGetFiletype, CDIGETFILETYPE, cdigetfiletype, STRING, PINT)
FCALLSCFUN1 (INT, streamOpenRead, STREAMOPENREAD, streamopenread, STRING)
FCALLSCFUN2 (INT, streamOpenWrite, STREAMOPENWRITE, streamopenwrite, STRING, INT)
FCALLSCFUN1 (INT, streamOpenAppend, STREAMOPENAPPEND, streamopenappend, STRING)
diff --git a/libcdi/src/cdipio.h b/libcdi/src/cdipio.h
index 6d907ff..e6a9323 100644
--- a/libcdi/src/cdipio.h
+++ b/libcdi/src/cdipio.h
@@ -28,8 +28,8 @@
void pioEndDef ( void );
void pioEndTimestepping ( void );
void pioFinalize ( void );
-/* Dummy function to use as argument to pioInit if no actions are
- * ncecessary after I/O servers initialize communication */
+/* cdiPioNoPostCommSetup: Dummy function to use as argument to pioInit
+ * if no actions are necessary after I/O servers initialize communication */
void cdiPioNoPostCommSetup(void);
/* pioInit: initialize I/O server processes and communication */
MPI_Comm pioInit(MPI_Comm commSuper, int nProcsIO, int IOMode,
diff --git a/libcdi/src/cgribexlib.c b/libcdi/src/cgribexlib.c
index 629b130..12a5fd1 100644
--- a/libcdi/src/cgribexlib.c
+++ b/libcdi/src/cgribexlib.c
@@ -1,5 +1,5 @@
-/* Automatically generated by m214003 at 2014-09-30, do not edit */
+/* Automatically generated by m214003 at 2014-12-03, do not edit */
/* CGRIBEXLIB_VERSION="1.7.0" */
@@ -9,7 +9,6 @@
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
-#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic warning "-Wstrict-overflow"
#endif
@@ -2134,16 +2133,16 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
/* Round up for negative numbers. */
if ( isign == 0 )
- *kmant = (int) rpowref;
+ *kmant = (int)rpowref;
else
- *kmant = lround(rpowref + 0.5);
+ *kmant = (int)lround(rpowref + 0.5);
}
else
{
/* Closest number in GRIB format to the original number */
/* (equal to, greater than or less than original number). */
- *kmant = lround(rpowref);
+ *kmant = (int)lround(rpowref);
}
/* Check that mantissa value does not exceed 24 bits. */
@@ -2191,16 +2190,16 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
/* Round up for negative numbers. */
if ( isign == 0 )
- *kmant = (int) rpowref;
+ *kmant = (int)rpowref;
else
- *kmant = lround(rpowref + 0.5);
+ *kmant = (int)lround(rpowref + 0.5);
}
else
{
/* Closest number in GRIB format to the original number */
/* (equal to, greater or less than original number). */
- *kmant = lround(rpowref);
+ *kmant = (int)lround(rpowref);
}
/* Repeat calculation (with modified exponent) if still have */
@@ -14225,7 +14224,7 @@ void encode_dummy(void)
(void) encode_array_unrolled_double(0, 0, 0, NULL, NULL, 0, 0, NULL);
(void) encode_array_unrolled_float(0, 0, 0, NULL, NULL, 0, 0, NULL);
}
-static const char grb_libvers[] = "1.7.0" " of ""Sep 30 2014"" ""13:27:33";
+static const char grb_libvers[] = "1.7.0" " of ""Dec 3 2014"" ""08:52:12";
const char *
cgribexLibraryVersion(void)
{
diff --git a/libcdi/src/config.h.in b/libcdi/src/config.h.in
index 82ff618..0c6aa67 100644
--- a/libcdi/src/config.h.in
+++ b/libcdi/src/config.h.in
@@ -9,6 +9,9 @@
/* Compiler version */
#undef COMP_VERSION
+/* Defined if backtrace() could be fully identified. */
+#undef HAVE_BACKTRACE
+
/* Define if C / Fortran interface cfortran.h works */
#undef HAVE_CF_INTERFACE
@@ -254,3 +257,6 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
+
+/* Defined to return type of backtrace(). */
+#undef backtrace_size_t
diff --git a/libcdi/src/dmemory.c b/libcdi/src/dmemory.c
index 7249d24..b1a8ebb 100644
--- a/libcdi/src/dmemory.c
+++ b/libcdi/src/dmemory.c
@@ -527,8 +527,8 @@ void Free(const char *caller, const char *file, int line, void *ptr)
void *cdiXmalloc(size_t size, const char *filename, const char *functionname,
int line)
{
- void * value = calloc (1, size );
- if ( value == NULL )
+ void *value = malloc(size);
+ if (size == 0 || value != NULL) ; else
cdiAbort(filename, functionname, line, "malloc failed: %s",
strerror(errno));
return value;
@@ -537,8 +537,8 @@ void *cdiXmalloc(size_t size, const char *filename, const char *functionname,
void *cdiXcalloc(size_t nmemb, size_t size, const char *filename,
const char *functionname, int line)
{
- void * value = calloc ( nmemb, size );
- if ( value == NULL )
+ void *value = calloc(nmemb, size);
+ if (size == 0 || value != NULL) ; else
cdiAbort(filename, functionname, line, "calloc failed: %s",
strerror(errno) );
return value;
@@ -548,7 +548,7 @@ void *cdiXrealloc(void *p, size_t size, const char *functionname,
const char *filename, int line)
{
void *value = realloc(p, size);
- if ( value == NULL )
+ if (size == 0 || value != NULL) ; else
cdiAbort(filename, functionname, line, "realloc failed: %s",
strerror(errno));
return value;
diff --git a/libcdi/src/gribapi.h b/libcdi/src/gribapi.h
index 141af58..264ff60 100644
--- a/libcdi/src/gribapi.h
+++ b/libcdi/src/gribapi.h
@@ -1,7 +1,7 @@
#ifndef _GRIBAPI_H
#define _GRIBAPI_H
-#ifdef HAVE_LIBGRIBAPI
+#ifdef HAVE_LIBGRIB_API
# include "error.h"
# include <grib_api.h>
#endif
@@ -50,7 +50,7 @@
const char *gribapiLibraryVersionString(void);
void gribContainersNew(stream_t * streamptr);
void gribContainersDelete(stream_t * streamptr);
-#ifdef HAVE_LIBGRIBAPI
+#ifdef HAVE_LIBGRIB_API
static inline void *gribHandleNew(int editionNumber)
{
void *gh =
diff --git a/libcdi/src/grid.c b/libcdi/src/grid.c
index 1fb44aa..704348d 100644
--- a/libcdi/src/grid.c
+++ b/libcdi/src/grid.c
@@ -83,7 +83,11 @@ void grid_init(grid_t *gridptr)
gridptr->ybounds = NULL;
gridptr->rowlon = NULL;
gridptr->nrowlon = 0;
+ gridptr->xfirst = 0.0;
+ gridptr->xlast = 0.0;
gridptr->xinc = 0.0;
+ gridptr->yfirst = 0.0;
+ gridptr->ylast = 0.0;
gridptr->yinc = 0.0;
gridptr->lcc_originLon = 0.0;
gridptr->lcc_originLat = 0.0;
@@ -225,7 +229,7 @@ void gridGenXvals(int xsize, double xfirst, double xlast, double xinc, double *x
static
void calc_gaussgrid(double *yvals, int ysize, double yfirst, double ylast)
{
- double *yw = (double *)xmalloc((size_t)ysize * sizeof(double));
+ double *restrict yw = (double *)xmalloc((size_t)ysize * sizeof(double));
gaussaw(yvals, yw, (size_t)ysize);
free(yw);
for (int i = 0; i < ysize; i++ )
@@ -258,7 +262,7 @@ void gridGenYvals(int gridtype, int ysize, double yfirst, double ylast, double y
if ( fabs(yvals[0] - yfirst) > deleps || fabs(yvals[ysize-1] - ylast) > deleps )
{
double yinc = fabs(ylast-yfirst)/(ysize-1);
- double *ytmp = NULL;
+ double *restrict ytmp = NULL;
int nstart, lfound = 0;
int ny = (int) (180./yinc + 0.5);
ny -= ny%2;
@@ -273,8 +277,8 @@ void gridGenYvals(int gridtype, int ysize, double yfirst, double ylast, double y
nstart = i;
- if ( (nstart+ysize-1) < ny )
- if ( fabs(ytmp[nstart+ysize-1] - ylast) < deleps ) lfound = 1;
+ lfound = (nstart+ysize-1) < ny
+ && fabs(ytmp[nstart+ysize-1] - ylast) < deleps;
}
if ( lfound )
@@ -2206,8 +2210,8 @@ int gridCompareP ( void * gridptr1, void * gridptr2 )
{
grid_t * g1 = ( grid_t * ) gridptr1;
grid_t * g2 = ( grid_t * ) gridptr2;
- int differ = -1;
- int equal = 0;
+ enum { equal = 0,
+ differ = -1 };
int i, size;
xassert ( g1 );
@@ -2350,14 +2354,14 @@ int gridCompareP ( void * gridptr1, void * gridptr2 )
else if ( g2->ybounds )
return differ;
- if ( memcmp ( &g1->xname ,&g2->xname ,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->yname ,&g2->yname ,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->xlongname,&g2->xlongname,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->ylongname,&g2->ylongname,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->xstdname ,&g2->xstdname ,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->ystdname ,&g2->ystdname ,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->xunits ,&g2->xunits ,CDI_MAX_NAME ) ) return differ;
- if ( memcmp ( &g1->yunits ,&g2->yunits ,CDI_MAX_NAME ) ) return differ;
+ if (strcmp(g1->xname, g2->xname)) return differ;
+ if (strcmp(g1->yname, g2->yname)) return differ;
+ if (strcmp(g1->xlongname, g2->xlongname)) return differ;
+ if (strcmp(g1->ylongname, g2->ylongname)) return differ;
+ if (strcmp(g1->xstdname, g2->xstdname)) return differ;
+ if (strcmp(g1->ystdname, g2->ystdname)) return differ;
+ if (strcmp(g1->xunits, g2->xunits)) return differ;
+ if (strcmp(g1->yunits, g2->yunits)) return differ;
if ( g1->reference )
{
@@ -2780,7 +2784,7 @@ void gridDefArea(int gridID, const double *area)
{
grid_t *gridptr = gridID2Ptr(gridID);
- size_t size = gridptr->size;
+ size_t size = (size_t)gridptr->size;
if ( size == 0 )
Error("size undefined for gridID = %d", gridID);
@@ -3870,7 +3874,6 @@ gridTxCode ()
enum { gridNint = 27,
gridNdouble = 24,
- gridNstrings= 8,
gridHasMaskFlag = 1 << 0,
gridHasGMEMaskFlag = 1 << 1,
gridHasXValsFlag = 1 << 2,
@@ -3900,6 +3903,11 @@ static int gridGetComponentFlags(const grid_t * gridP)
}
+#define GRID_STR_SERIALIZE { gridP->xname, gridP->yname, \
+ gridP->xlongname, gridP->ylongname, \
+ gridP->xstdname, gridP->ystdname, \
+ gridP->xunits, gridP->yunits }
+
static int
gridGetPackSize(void * voidP, void *context)
{
@@ -3974,9 +3982,12 @@ gridGetPackSize(void * voidP, void *context)
+ serializeGetSize(1, DATATYPE_UINT32, context));
}
- packBuffSize +=
- serializeGetSize(gridNstrings * CDI_MAX_NAME , DATATYPE_TXT, context)
- + serializeGetSize(1, DATATYPE_UINT32, context);
+ {
+ const char *strTab[] = GRID_STR_SERIALIZE;
+ int numStr = (int)(sizeof (strTab) / sizeof (strTab[0]));
+ packBuffSize
+ += serializeStrTabGetPackSize(strTab, numStr, context);
+ }
if (gridP->reference)
{
@@ -4007,11 +4018,6 @@ gridGetPackSize(void * voidP, void *context)
return packBuffSize;
}
-#define GRID_STR_SERIALIZE { gridP->xname, gridP->yname, \
- gridP->xlongname, gridP->ylongname, \
- gridP->xstdname, gridP->ystdname, \
- gridP->xunits, gridP->yunits }
-
void
gridUnpack(char * unpackBuffer, int unpackBufferSize,
int * unpackBufferPos, int originNamespace, void *context,
@@ -4020,7 +4026,6 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
grid_t * gridP;
uint32_t d;
int memberMask, size;
- char charBuffer[gridNstrings * CDI_MAX_NAME];
gridInit();
@@ -4174,17 +4179,11 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
xassert(cdiCheckSum(DATATYPE_FLT, size, gridP->ybounds) == d);
}
- serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
- charBuffer, gridNstrings * CDI_MAX_NAME, DATATYPE_TXT, context);
- serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
- &d, 1, DATATYPE_UINT32, context);
-
- xassert(d == cdiCheckSum(DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer));
{
char *strTab[] = GRID_STR_SERIALIZE;
- size_t numStr = sizeof (strTab) / sizeof (strTab[0]);
- for (size_t i = 0; i < numStr; ++i)
- memcpy(strTab[i], charBuffer + CDI_MAX_NAME * i, CDI_MAX_NAME);
+ int numStr = sizeof (strTab) / sizeof (strTab[0]);
+ serializeStrTabUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+ strTab, numStr, context);
}
if (memberMask & gridHasReferenceFlag)
@@ -4237,7 +4236,6 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
int size;
uint32_t d;
int memberMask;
- char charBuffer[gridNstrings * CDI_MAX_NAME];
{
int intBuffer[gridNint];
@@ -4279,7 +4277,8 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
if (memberMask & gridHasRowLonFlag)
{
- xassert((size = gridP->nrowlon));
+ size = gridP->nrowlon;
+ xassert(size > 0);
serializePack(gridP->rowlon, size, DATATYPE_INT,
packBuffer, packBufferSize, packBufferPos, context);
d = cdiCheckSum(DATATYPE_INT , size, gridP->rowlon);
@@ -4395,18 +4394,12 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
}
{
- char *strTab[] = GRID_STR_SERIALIZE;
- size_t numStr = sizeof (strTab) / sizeof (strTab[0]);
- for (size_t i = 0; i < numStr; ++i)
- memcpy(charBuffer + CDI_MAX_NAME * i, strTab[i], CDI_MAX_NAME);
+ const char *strTab[] = GRID_STR_SERIALIZE;
+ int numStr = sizeof (strTab) / sizeof (strTab[0]);
+ serializeStrTabPack(strTab, numStr,
+ packBuffer, packBufferSize, packBufferPos, context);
}
- serializePack( charBuffer, gridNstrings * CDI_MAX_NAME, DATATYPE_TXT,
- packBuffer, packBufferSize, packBufferPos, context);
- d = cdiCheckSum(DATATYPE_TXT, gridNstrings * CDI_MAX_NAME, charBuffer);
- serializePack(&d, 1, DATATYPE_UINT32,
- packBuffer, packBufferSize, packBufferPos, context);
-
if (memberMask & gridHasReferenceFlag)
{
size = (int)strlen(gridP->reference) + 1;
@@ -4445,6 +4438,8 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
packBuffer, packBufferSize, packBufferPos, context);
}
+#undef GRID_STR_SERIALIZE
+
/*
* Local Variables:
* c-file-style: "Java"
diff --git a/libcdi/src/mo_cdi.f90 b/libcdi/src/mo_cdi.f90
index dbd531d..f2fe49e 100644
--- a/libcdi/src/mo_cdi.f90
+++ b/libcdi/src/mo_cdi.f90
@@ -85,6 +85,7 @@ module mo_cdi
integer, parameter :: DATATYPE_TXT = 253
integer, parameter :: DATATYPE_CPX = 254
integer, parameter :: DATATYPE_UCHAR = 255
+ integer, parameter :: DATATYPE_LONG = 256
integer, parameter :: CHUNK_AUTO = 1
integer, parameter :: CHUNK_GRID = 2
integer, parameter :: CHUNK_LINES = 3
@@ -452,7 +453,7 @@ module mo_cdi
import :: c_int,c_double
integer(kind=c_int), value :: streamID
integer(kind=c_int), value :: varID
- real(kind=c_double), intent(in),dimension(*) :: data_vec
+ real(kind=c_double), intent(in), dimension(*) :: data_vec
integer(kind=c_int), value :: nmiss
end subroutine streamWriteVar
end interface
@@ -461,7 +462,7 @@ module mo_cdi
import :: c_int,c_float
integer(kind=c_int), value :: streamID
integer(kind=c_int), value :: varID
- real(kind=c_float), intent(in),dimension(*) :: data_vec
+ real(kind=c_float), intent(in), dimension(*) :: data_vec
integer(kind=c_int), value :: nmiss
end subroutine streamWriteVarF
end interface
@@ -470,7 +471,7 @@ module mo_cdi
import :: c_int,c_double
integer(kind=c_int), value :: streamID
integer(kind=c_int), value :: varID
- real(kind=c_double), intent(out),dimension(*) :: data_vec
+ real(kind=c_double), intent(out), dimension(*) :: data_vec
integer(kind=c_int), intent(out) :: nmiss
end subroutine streamReadVar
end interface
@@ -479,7 +480,7 @@ module mo_cdi
import :: c_int,c_float
integer(kind=c_int), value :: streamID
integer(kind=c_int), value :: varID
- real(kind=c_float), intent(out),dimension(*) :: data_vec
+ real(kind=c_float), intent(out), dimension(*) :: data_vec
integer(kind=c_int), intent(out) :: nmiss
end subroutine streamReadVarF
end interface
@@ -489,7 +490,7 @@ module mo_cdi
integer(kind=c_int), value :: streamID
integer(kind=c_int), value :: varID
integer(kind=c_int), value :: levelID
- real(kind=c_double), intent(in),dimension(*) :: data_vec
+ real(kind=c_double), intent(in), dimension(*) :: data_vec
integer(kind=c_int), value :: nmiss
end subroutine streamWriteVarSlice
end interface
@@ -499,7 +500,7 @@ module mo_cdi
integer(kind=c_int), value :: streamID
integer(kind=c_int), value :: varID
integer(kind=c_int), value :: levelID
- real(kind=c_float), intent(in),dimension(*) :: data_vec
+ real(kind=c_float), intent(in), dimension(*) :: data_vec
integer(kind=c_int), value :: nmiss
end subroutine streamWriteVarSliceF
end interface
@@ -509,7 +510,7 @@ module mo_cdi
integer(kind=c_int), value :: streamID
integer(kind=c_int), value :: varID
integer(kind=c_int), value :: levelID
- real(kind=c_double), intent(out),dimension(*) :: data_vec
+ real(kind=c_double), intent(out), dimension(*) :: data_vec
integer(kind=c_int), intent(out) :: nmiss
end subroutine streamReadVarSlice
end interface
@@ -519,7 +520,7 @@ module mo_cdi
integer(kind=c_int), value :: streamID
integer(kind=c_int), value :: varID
integer(kind=c_int), value :: levelID
- real(kind=c_float), intent(out),dimension(*) :: data_vec
+ real(kind=c_float), intent(out), dimension(*) :: data_vec
integer(kind=c_int), intent(out) :: nmiss
end subroutine streamReadVarSliceF
end interface
@@ -543,7 +544,7 @@ module mo_cdi
subroutine streamWriteRecord(streamID,data_vec,nmiss) bind(c,name='streamWriteRecord')
import :: c_int,c_double
integer(kind=c_int), value :: streamID
- real(kind=c_double), intent(in),dimension(*) :: data_vec
+ real(kind=c_double), intent(in), dimension(*) :: data_vec
integer(kind=c_int), value :: nmiss
end subroutine streamWriteRecord
end interface
@@ -551,7 +552,7 @@ module mo_cdi
subroutine streamWriteRecordF(streamID,data_vec,nmiss) bind(c,name='streamWriteRecordF')
import :: c_int,c_float
integer(kind=c_int), value :: streamID
- real(kind=c_float), intent(in),dimension(*) :: data_vec
+ real(kind=c_float), intent(in), dimension(*) :: data_vec
integer(kind=c_int), value :: nmiss
end subroutine streamWriteRecordF
end interface
@@ -559,7 +560,7 @@ module mo_cdi
subroutine streamReadRecord(streamID,data_vec,nmiss) bind(c,name='streamReadRecord')
import :: c_int,c_double
integer(kind=c_int), value :: streamID
- real(kind=c_double), intent(out),dimension(*) :: data_vec
+ real(kind=c_double), intent(out), dimension(*) :: data_vec
integer(kind=c_int), intent(out) :: nmiss
end subroutine streamReadRecord
end interface
@@ -1435,7 +1436,7 @@ module mo_cdi
character(kind=c_char), dimension(*) :: name
integer(kind=c_int), value :: type
integer(kind=c_int), value :: len
- integer(kind=c_int), intent(in),dimension(*) :: ip_vec
+ integer(kind=c_int), intent(in), dimension(*) :: ip_vec
integer(kind=c_int) :: vlistDefAttInt
end function vlistDefAttInt
end interface
@@ -1447,7 +1448,7 @@ module mo_cdi
character(kind=c_char), dimension(*) :: name
integer(kind=c_int), value :: type
integer(kind=c_int), value :: len
- real(kind=c_double), intent(in),dimension(*) :: dp_vec
+ real(kind=c_double), intent(in), dimension(*) :: dp_vec
integer(kind=c_int) :: vlistDefAttFlt
end function vlistDefAttFlt
end interface
@@ -1469,7 +1470,7 @@ module mo_cdi
integer(kind=c_int), value :: varID
character(kind=c_char), dimension(*) :: name
integer(kind=c_int), value :: mlen
- integer(kind=c_int), intent(out),dimension(*) :: ip_vec
+ integer(kind=c_int), intent(out), dimension(*) :: ip_vec
integer(kind=c_int) :: vlistInqAttInt
end function vlistInqAttInt
end interface
@@ -1480,7 +1481,7 @@ module mo_cdi
integer(kind=c_int), value :: varID
character(kind=c_char), dimension(*) :: name
integer(kind=c_int), value :: mlen
- real(kind=c_double), intent(out),dimension(*) :: dp_vec
+ real(kind=c_double), intent(out), dimension(*) :: dp_vec
integer(kind=c_int) :: vlistInqAttFlt
end function vlistInqAttFlt
end interface
@@ -1512,14 +1513,14 @@ module mo_cdi
subroutine gridDefMaskGME(gridID,mask_vec) bind(c,name='gridDefMaskGME')
import :: c_int
integer(kind=c_int), value :: gridID
- integer(kind=c_int), intent(in),dimension(*) :: mask_vec
+ integer(kind=c_int), intent(in), dimension(*) :: mask_vec
end subroutine gridDefMaskGME
end interface
interface
function gridInqMaskGME(gridID,mask_vec) bind(c,name='gridInqMaskGME')
import :: c_int
integer(kind=c_int), value :: gridID
- integer(kind=c_int), intent(out),dimension(*) :: mask_vec
+ integer(kind=c_int), intent(out), dimension(*) :: mask_vec
integer(kind=c_int) :: gridInqMaskGME
end function gridInqMaskGME
end interface
@@ -1527,14 +1528,14 @@ module mo_cdi
subroutine gridDefMask(gridID,mask_vec) bind(c,name='gridDefMask')
import :: c_int
integer(kind=c_int), value :: gridID
- integer(kind=c_int), intent(in),dimension(*) :: mask_vec
+ integer(kind=c_int), intent(in), dimension(*) :: mask_vec
end subroutine gridDefMask
end interface
interface
function gridInqMask(gridID,mask_vec) bind(c,name='gridInqMask')
import :: c_int
integer(kind=c_int), value :: gridID
- integer(kind=c_int), intent(out),dimension(*) :: mask_vec
+ integer(kind=c_int), intent(out), dimension(*) :: mask_vec
integer(kind=c_int) :: gridInqMask
end function gridInqMask
end interface
@@ -1626,14 +1627,14 @@ module mo_cdi
subroutine gridDefXvals(gridID,xvals_vec) bind(c,name='gridDefXvals')
import :: c_int,c_double
integer(kind=c_int), value :: gridID
- real(kind=c_double), intent(in),dimension(*) :: xvals_vec
+ real(kind=c_double), intent(in), dimension(*) :: xvals_vec
end subroutine gridDefXvals
end interface
interface
function gridInqXvals(gridID,xvals_vec) bind(c,name='gridInqXvals')
import :: c_int,c_double
integer(kind=c_int), value :: gridID
- real(kind=c_double), intent(out),dimension(*) :: xvals_vec
+ real(kind=c_double), intent(out), dimension(*) :: xvals_vec
integer(kind=c_int) :: gridInqXvals
end function gridInqXvals
end interface
@@ -1641,14 +1642,14 @@ module mo_cdi
subroutine gridDefYvals(gridID,yvals_vec) bind(c,name='gridDefYvals')
import :: c_int,c_double
integer(kind=c_int), value :: gridID
- real(kind=c_double), intent(in),dimension(*) :: yvals_vec
+ real(kind=c_double), intent(in), dimension(*) :: yvals_vec
end subroutine gridDefYvals
end interface
interface
function gridInqYvals(gridID,yvals_vec) bind(c,name='gridInqYvals')
import :: c_int,c_double
integer(kind=c_int), value :: gridID
- real(kind=c_double), intent(out),dimension(*) :: yvals_vec
+ real(kind=c_double), intent(out), dimension(*) :: yvals_vec
integer(kind=c_int) :: gridInqYvals
end function gridInqYvals
end interface
@@ -1965,16 +1966,16 @@ module mo_cdi
end interface
interface
subroutine gridDefUUID(gridID,uuid) bind(c,name='gridDefUUID')
- import :: c_int,c_char
+ import :: c_int,c_signed_char
integer(kind=c_int), value :: gridID
- character(kind=c_char), dimension(16) :: uuid
+ integer(kind=c_signed_char), intent(in), dimension(16) :: uuid
end subroutine gridDefUUID
end interface
interface
subroutine gridInqUUID(gridID,uuid) bind(c,name='gridInqUUID')
- import :: c_int,c_char
+ import :: c_int,c_signed_char
integer(kind=c_int), value :: gridID
- character(kind=c_char), dimension(16) :: uuid
+ integer(kind=c_signed_char), intent(out), dimension(16) :: uuid
end subroutine gridInqUUID
end interface
interface
@@ -2051,14 +2052,14 @@ module mo_cdi
subroutine gridDefArea(gridID,area_vec) bind(c,name='gridDefArea')
import :: c_int,c_double
integer(kind=c_int), value :: gridID
- real(kind=c_double), intent(in),dimension(*) :: area_vec
+ real(kind=c_double), intent(in), dimension(*) :: area_vec
end subroutine gridDefArea
end interface
interface
subroutine gridInqArea(gridID,area_vec) bind(c,name='gridInqArea')
import :: c_int,c_double
integer(kind=c_int), value :: gridID
- real(kind=c_double), intent(out),dimension(*) :: area_vec
+ real(kind=c_double), intent(out), dimension(*) :: area_vec
end subroutine gridInqArea
end interface
interface
@@ -2086,14 +2087,14 @@ module mo_cdi
subroutine gridDefXbounds(gridID,xbounds_vec) bind(c,name='gridDefXbounds')
import :: c_int,c_double
integer(kind=c_int), value :: gridID
- real(kind=c_double), intent(in),dimension(*) :: xbounds_vec
+ real(kind=c_double), intent(in), dimension(*) :: xbounds_vec
end subroutine gridDefXbounds
end interface
interface
function gridInqXbounds(gridID,xbounds_vec) bind(c,name='gridInqXbounds')
import :: c_int,c_double
integer(kind=c_int), value :: gridID
- real(kind=c_double), intent(out),dimension(*) :: xbounds_vec
+ real(kind=c_double), intent(out), dimension(*) :: xbounds_vec
integer(kind=c_int) :: gridInqXbounds
end function gridInqXbounds
end interface
@@ -2101,14 +2102,14 @@ module mo_cdi
subroutine gridDefYbounds(gridID,ybounds_vec) bind(c,name='gridDefYbounds')
import :: c_int,c_double
integer(kind=c_int), value :: gridID
- real(kind=c_double), intent(in),dimension(*) :: ybounds_vec
+ real(kind=c_double), intent(in), dimension(*) :: ybounds_vec
end subroutine gridDefYbounds
end interface
interface
function gridInqYbounds(gridID,ybounds_vec) bind(c,name='gridInqYbounds')
import :: c_int,c_double
integer(kind=c_int), value :: gridID
- real(kind=c_double), intent(out),dimension(*) :: ybounds_vec
+ real(kind=c_double), intent(out), dimension(*) :: ybounds_vec
integer(kind=c_int) :: gridInqYbounds
end function gridInqYbounds
end interface
@@ -2117,14 +2118,14 @@ module mo_cdi
import :: c_int
integer(kind=c_int), value :: gridID
integer(kind=c_int), value :: nrowlon
- integer(kind=c_int), intent(in),dimension(*) :: rowlon_vec
+ integer(kind=c_int), intent(in), dimension(*) :: rowlon_vec
end subroutine gridDefRowlon
end interface
interface
subroutine gridInqRowlon(gridID,rowlon_vec) bind(c,name='gridInqRowlon')
import :: c_int
integer(kind=c_int), value :: gridID
- integer(kind=c_int), intent(out),dimension(*) :: rowlon_vec
+ integer(kind=c_int), intent(out), dimension(*) :: rowlon_vec
end subroutine gridInqRowlon
end interface
interface
@@ -2207,14 +2208,14 @@ module mo_cdi
subroutine zaxisDefLevels(zaxisID,levels_vec) bind(c,name='zaxisDefLevels')
import :: c_int,c_double
integer(kind=c_int), value :: zaxisID
- real(kind=c_double), intent(in),dimension(*) :: levels_vec
+ real(kind=c_double), intent(in), dimension(*) :: levels_vec
end subroutine zaxisDefLevels
end interface
interface
subroutine zaxisInqLevels(zaxisID,levels_vec) bind(c,name='zaxisInqLevels')
import :: c_int,c_double
integer(kind=c_int), value :: zaxisID
- real(kind=c_double), intent(out),dimension(*) :: levels_vec
+ real(kind=c_double), intent(out), dimension(*) :: levels_vec
end subroutine zaxisInqLevels
end interface
interface
@@ -2263,16 +2264,16 @@ module mo_cdi
end interface
interface
subroutine zaxisDefUUID(zaxisID,uuid) bind(c,name='zaxisDefUUID')
- import :: c_int,c_char
+ import :: c_int,c_signed_char
integer(kind=c_int), value :: zaxisID
- character(kind=c_char), dimension(16) :: uuid
+ integer(kind=c_signed_char), intent(in), dimension(16) :: uuid
end subroutine zaxisDefUUID
end interface
interface
subroutine zaxisInqUUID(zaxisID,uuid) bind(c,name='zaxisInqUUID')
- import :: c_int,c_char
+ import :: c_int,c_signed_char
integer(kind=c_int), value :: zaxisID
- character(kind=c_char), dimension(16) :: uuid
+ integer(kind=c_signed_char), intent(out), dimension(16) :: uuid
end subroutine zaxisInqUUID
end interface
interface
@@ -2378,14 +2379,14 @@ module mo_cdi
import :: c_int,c_double
integer(kind=c_int), value :: zaxisID
integer(kind=c_int), value :: size
- real(kind=c_double), intent(in),dimension(*) :: vct_vec
+ real(kind=c_double), intent(in), dimension(*) :: vct_vec
end subroutine zaxisDefVct
end interface
interface
subroutine zaxisInqVct(zaxisID,vct_vec) bind(c,name='zaxisInqVct')
import :: c_int,c_double
integer(kind=c_int), value :: zaxisID
- real(kind=c_double), intent(out),dimension(*) :: vct_vec
+ real(kind=c_double), intent(out), dimension(*) :: vct_vec
end subroutine zaxisInqVct
end interface
interface
@@ -2406,14 +2407,14 @@ module mo_cdi
subroutine zaxisDefLbounds(zaxisID,lbounds_vec) bind(c,name='zaxisDefLbounds')
import :: c_int,c_double
integer(kind=c_int), value :: zaxisID
- real(kind=c_double), intent(in),dimension(*) :: lbounds_vec
+ real(kind=c_double), intent(in), dimension(*) :: lbounds_vec
end subroutine zaxisDefLbounds
end interface
interface
function zaxisInqLbounds(zaxisID,lbounds_vec) bind(c,name='zaxisInqLbounds')
import :: c_int,c_double
integer(kind=c_int), value :: zaxisID
- real(kind=c_double), intent(out),dimension(*) :: lbounds_vec
+ real(kind=c_double), intent(out), dimension(*) :: lbounds_vec
integer(kind=c_int) :: zaxisInqLbounds
end function zaxisInqLbounds
end interface
@@ -2429,14 +2430,14 @@ module mo_cdi
subroutine zaxisDefUbounds(zaxisID,ubounds_vec) bind(c,name='zaxisDefUbounds')
import :: c_int,c_double
integer(kind=c_int), value :: zaxisID
- real(kind=c_double), intent(in),dimension(*) :: ubounds_vec
+ real(kind=c_double), intent(in), dimension(*) :: ubounds_vec
end subroutine zaxisDefUbounds
end interface
interface
function zaxisInqUbounds(zaxisID,ubounds_vec) bind(c,name='zaxisInqUbounds')
import :: c_int,c_double
integer(kind=c_int), value :: zaxisID
- real(kind=c_double), intent(out),dimension(*) :: ubounds_vec
+ real(kind=c_double), intent(out), dimension(*) :: ubounds_vec
integer(kind=c_int) :: zaxisInqUbounds
end function zaxisInqUbounds
end interface
@@ -2452,14 +2453,14 @@ module mo_cdi
subroutine zaxisDefWeights(zaxisID,weights_vec) bind(c,name='zaxisDefWeights')
import :: c_int,c_double
integer(kind=c_int), value :: zaxisID
- real(kind=c_double), intent(in),dimension(*) :: weights_vec
+ real(kind=c_double), intent(in), dimension(*) :: weights_vec
end subroutine zaxisDefWeights
end interface
interface
function zaxisInqWeights(zaxisID,weights_vec) bind(c,name='zaxisInqWeights')
import :: c_int,c_double
integer(kind=c_int), value :: zaxisID
- real(kind=c_double), intent(out),dimension(*) :: weights_vec
+ real(kind=c_double), intent(out), dimension(*) :: weights_vec
integer(kind=c_int) :: zaxisInqWeights
end function zaxisInqWeights
end interface
@@ -3385,6 +3386,7 @@ module mo_cdi
public :: DATATYPE_TXT
public :: DATATYPE_CPX
public :: DATATYPE_UCHAR
+ public :: DATATYPE_LONG
public :: CHUNK_AUTO
public :: CHUNK_GRID
public :: CHUNK_LINES
diff --git a/libcdi/src/namespace.c b/libcdi/src/namespace.c
index 7f3927c..15fc5ed 100644
--- a/libcdi/src/namespace.c
+++ b/libcdi/src/namespace.c
@@ -35,28 +35,6 @@ static int activeNamespace = 0;
#define CDI_NETCDF_SWITCHES
#endif
-#if defined (SX)
-static const union namespaceSwitchValue defaultSwitches[NUM_NAMESPACE_SWITCH] = {
- { .func = (void (*)()) cdiAbortC_serial },
- { .func = (void (*)()) cdiWarning },
- { .func = (void (*)()) serializeGetSizeInCore },
- { .func = (void (*)()) serializePackInCore },
- { .func = (void (*)()) serializeUnpackInCore },
- { .func = (void (*)()) fileOpen_serial },
- { .func = (void (*)()) fileWrite },
- { .func = (void (*)()) fileClose_serial },
- { .func = (void (*)()) cdiStreamOpenDefaultDelegate },
- { .func = (void (*)()) cdiStreamDefVlist_ },
- { .func = (void (*)()) cdiStreamWriteVar_ },
- { .func = (void (*)()) cdiStreamwriteVarChunk_ },
- { .func = (void (*)()) 0 },
- { .func = (void (*)()) 0 },
- { .func = (void (*)()) cdiStreamCloseDefaultDelegate },
- { .func = (void (*)()) cdiStreamDefTimestep_ },
- { .func = (void (*)()) cdiStreamSync_ },
- CDI_NETCDF_SWITCHES
-};
-#else
#define defaultSwitches { \
{ .func = (void (*)()) cdiAbortC_serial }, \
{ .func = (void (*)()) cdiWarning }, \
@@ -77,6 +55,10 @@ static const union namespaceSwitchValue defaultSwitches[NUM_NAMESPACE_SWITCH] =
{ .func = (void (*)()) cdiStreamSync_ }, \
CDI_NETCDF_SWITCHES \
}
+
+#if defined (SX)
+static const union namespaceSwitchValue
+ defaultSwitches_[NUM_NAMESPACE_SWITCH] = defaultSwitches;
#endif
struct Namespace
@@ -85,30 +67,7 @@ struct Namespace
union namespaceSwitchValue switches[NUM_NAMESPACE_SWITCH];
} initialNamespace = {
.resStage = STAGE_DEFINITION,
-#if defined (SX)
- .switches = {
- { .func = (void (*)()) cdiAbortC_serial },
- { .func = (void (*)()) cdiWarning },
- { .func = (void (*)()) serializeGetSizeInCore },
- { .func = (void (*)()) serializePackInCore },
- { .func = (void (*)()) serializeUnpackInCore },
- { .func = (void (*)()) fileOpen_serial },
- { .func = (void (*)()) fileWrite },
- { .func = (void (*)()) fileClose_serial },
- { .func = (void (*)()) cdiStreamOpenDefaultDelegate },
- { .func = (void (*)()) cdiStreamDefVlist_ },
- { .func = (void (*)()) cdiStreamWriteVar_ },
- { .func = (void (*)()) cdiStreamwriteVarChunk_ },
- { .func = (void (*)()) 0 },
- { .func = (void (*)()) 0 },
- { .func = (void (*)()) cdiStreamCloseDefaultDelegate },
- { .func = (void (*)()) cdiStreamDefTimestep_ },
- { .func = (void (*)()) cdiStreamSync_ },
- CDI_NETCDF_SWITCHES
-}
-#else
.switches = defaultSwitches
-#endif
};
struct Namespace *namespaces = &initialNamespace;
@@ -226,7 +185,8 @@ namespaceNew()
++nNamespaces;
namespaces[newNamespaceID].resStage = STAGE_DEFINITION;
#if defined (SX)
- memcpy(namespaces[newNamespaceID].switches, defaultSwitches,
+ memcpy(namespaces[newNamespaceID].switches,
+ defaultSwitches_,
sizeof (namespaces[newNamespaceID].switches));
#else
memcpy(namespaces[newNamespaceID].switches,
diff --git a/libcdi/src/pio.c b/libcdi/src/pio.c
index 4345514..b440c8d 100644
--- a/libcdi/src/pio.c
+++ b/libcdi/src/pio.c
@@ -19,22 +19,14 @@
#include "pio_rpc.h"
#include "pio_util.h"
-char * command2charP[6] = {"IO_Open_file", "IO_Close_file",
- "IO_Get_fp","IO_Set_fp",
- "IO_Send_buffer", "IO_Finalize"};
-
-long initial_buffersize = 16 * 1024 * 1024;
-/* 4 KB <= x < 256 MB */
-/* 16 * 1024 * 1024; */
-/* 16 * 1024; */
-/* 4 * 1024; */
-
-double accumProbe = 0.0;
-double accumRecv = 0.0;
-double accumSend = 0.0;
-double accumSuspend = 0.0;
-double accumWait = 0.0;
-double accumWrite = 0.0;
+const char *const cdiPioCmdStrTab[] = {
+ "IO_Open_file",
+ "IO_Close_file",
+ "IO_Get_fp",
+ "IO_Set_fp",
+ "IO_Send_buffer",
+ "IO_Finalize"
+};
char *token = "%";
diff --git a/libcdi/src/pio_comm.c b/libcdi/src/pio_comm.c
index 610c3f5..3e91a1b 100644
--- a/libcdi/src/pio_comm.c
+++ b/libcdi/src/pio_comm.c
@@ -97,7 +97,7 @@ void pioInfoInit ( pioInfo_t * p )
void commInit ( void )
{
xassert ( info == 0 );
- info = (pioInfo_t*) xmalloc ( sizeof ( pioInfo_t ));
+ info = xcalloc(1, sizeof (pioInfo_t));
pioInfoInit ( info );
}
@@ -592,8 +592,8 @@ void commEvalPhysNodes ( void )
// define nodeSizes
info->nodeInfo.nNodes = nNodes;
- info->nodeSizes = (int *)xmalloc((size_t)info->nodeInfo.nNodes
- * sizeof (info->nodeSizes[0]));
+ info->nodeSizes = xcalloc((size_t)info->nodeInfo.nNodes,
+ sizeof (info->nodeSizes[0]));
collID = 0;
for ( IOID = 0; IOID < info->nProcsIO; IOID++ )
if ( nodeInfo[IOID].isProcColl )
diff --git a/libcdi/src/pio_impl.h b/libcdi/src/pio_impl.h
index 30e5306..8481b19 100644
--- a/libcdi/src/pio_impl.h
+++ b/libcdi/src/pio_impl.h
@@ -21,6 +21,22 @@ enum IO_Server_command
* larger than IO_Finalize */
};
+extern const char *const cdiPioCmdStrTab[];
+
+
+static inline size_t
+findWriteAccumBufsize()
+{
+ unsigned long initial_buffersize = 16UL * 1024UL * 1024UL;
+ const char *p = getenv("BUFSIZE");
+ long temp = p ? atol(p) : -1;
+ unsigned long buffersize
+ = (temp > 0 && (unsigned long)temp > initial_buffersize)
+ ? (unsigned long)temp : initial_buffersize;
+ return buffersize;
+}
+
+
struct dBuffer
{
size_t wr_pointer;
@@ -96,7 +112,6 @@ void pioWriterAIO(void);
#endif
/* pio_posixfpguardsendrecv.c */
-void fpgPOSIXFPGUARDSENDRECV ( void );
int fowPOSIXFPGUARDSENDRECV ( const char * );
int fcPOSIXFPGUARDSENDRECV ( int );
size_t fwPOSIXFPGUARDSENDRECV ( int, int, const void *, size_t );
diff --git a/libcdi/src/pio_interface.c b/libcdi/src/pio_interface.c
index 6241cfe..19d3b7d 100644
--- a/libcdi/src/pio_interface.c
+++ b/libcdi/src/pio_interface.c
@@ -267,7 +267,7 @@ varsMapNDeco(int nNodes, int *nodeSizes)
streamSizes[i] = streamInqNvars ( * ( resHs + i ));
nVars = sum_int((size_t)nStreams, streamSizes);
- varSizes = xmalloc((size_t)nVars * sizeof (varSizes[0]));
+ varSizes = xcalloc((size_t)nVars, sizeof (varSizes[0]));
varMapping = xmalloc((size_t)nVars * sizeof (varMapping[0]));
for (int i = 0; i < nStreams; i++ )
@@ -455,7 +455,7 @@ void modelWinCreate ( void )
int nProcsColl = commInqNProcsColl ();
xdebug("%s", "START");
- txWin = xmalloc((size_t)nProcsColl * sizeof (txWin[0]));
+ txWin = xcalloc((size_t)nProcsColl, sizeof (txWin[0]));
modelWinDefBufferSizes ();
ranks[0] = commInqNProcsModel ();
@@ -886,17 +886,16 @@ void pioEndTimestepping ( void )
void pioFinalize ( void )
{
- int collID, ibuffer = 1111;
xdebug("%s", "START");
/* pioNamespace_ is unchanged on I/O servers */
if (pioNamespace_ == -1)
return;
namespaceDelete(pioNamespace_);
- for ( collID = 0; collID < commInqNProcsColl (); collID++ )
+ for (int collID = 0; collID < commInqNProcsColl (); collID++ )
{
- xmpi ( MPI_Send ( &ibuffer, 1, MPI_INT, commInqNProcsModel (),
- FINALIZE, commInqCommsIO ( collID )));
+ xmpi(MPI_Send(NULL, 0, MPI_INT, commInqNProcsModel(),
+ FINALIZE, commInqCommsIO ( collID )));
xdebug("%s", "SENT MESSAGE WITH TAG \"FINALIZE\"");
}
modelWinCleanup ();
diff --git a/libcdi/src/pio_mpinonb.c b/libcdi/src/pio_mpinonb.c
index 569cbdf..b87eeae 100644
--- a/libcdi/src/pio_mpinonb.c
+++ b/libcdi/src/pio_mpinonb.c
@@ -15,10 +15,6 @@
#include "pio_impl.h"
#include "pio_util.h"
-extern long initial_buffersize;
-
-extern double accumWait;
-
typedef struct
{
size_t size;
@@ -58,7 +54,7 @@ static aFiledataM *initAFiledataMPINONB ( const char *filename, size_t bs )
of->db2 = NULL;
/* init output buffer */
-
+
iret = dbuffer_init ( &( of->db1 ), of->size );
iret += dbuffer_init ( &( of->db2 ), of->size );
@@ -73,7 +69,7 @@ static aFiledataM *initAFiledataMPINONB ( const char *filename, size_t bs )
MPI_INFO_NULL, &( of->fh )));
of->request = MPI_REQUEST_NULL;
of->finished = false;
-
+
return of;
}
@@ -86,32 +82,28 @@ destroyAFiledataMPINONB(void *v)
aFiledataM *of;
MPI_Status status;
int rankNode = commInqRankNode ();
- double startTime;
MPI_Offset endpos;
of = (aFiledataM * ) v;
xdebug ( "IOPE%d: close file %d, name=\"%s\"",
rankNode, of->fileID, of->name );
-
- /* close file */
- startTime = MPI_Wtime ();
- xmpi ( MPI_Wait ( & ( of->request ), &status ));
+ /* close file */
+ xmpi(MPI_Wait(&of->request, &status));
xmpi(MPI_Barrier(commInqCommNode()));
- accumWait += ( MPI_Wtime () - startTime );
xmpi(MPI_File_get_position_shared(of->fh, &endpos));
xmpi(MPI_File_set_size(of->fh, endpos));
iret = MPI_File_close ( & ( of->fh ));
/* file closed, cleanup */
-
+
dbuffer_cleanup ( & ( of->db1 ));
dbuffer_cleanup ( & ( of->db2 ));
free ( of );
- xdebug ( "IOPE%d: closed file, cleaned up, return",
+ xdebug ( "IOPE%d: closed file, cleaned up, return",
rankNode );
return iret == MPI_SUCCESS ? 0 : -1;
@@ -137,33 +129,33 @@ writeMPINONB(aFiledataM *of)
int fileID = of->fileID;
/* write buffer */
-
+
amount = ( int ) dbuffer_data_size ( of->db );
if ( amount == 0 ) return;
- xdebug3 ( "IOPI%d: Write buffer, size %d bytes, in",
+ xdebug3 ( "IOPI%d: Write buffer, size %d bytes, in",
rankNode, amount );
-
+
xmpi ( MPI_Wait ( & ( of->request ), &status ));
- xmpi ( MPI_File_iwrite_shared ( of->fh, of->db->buffer, amount, MPI_CHAR,
- & ( of->request )));
- xdebug ( "%d bytes written for fileID=%d", amount, fileID );
+ xmpi(MPI_File_iwrite_shared(of->fh, of->db->buffer, amount, MPI_UNSIGNED_CHAR,
+ &of->request));
+ xdebug("%d bytes written for fileID=%d", amount, fileID);
/* change outputBuffer */
-
+
dbuffer_reset ( of->db );
-
+
if ( of->db == of->db1 )
{
- xdebug3 ( "IOPE%d: fileID=%d, change to buffer 2 ...",
+ xdebug3 ( "IOPE%d: fileID=%d, change to buffer 2 ...",
rankNode, fileID );
of->db = of->db2;
}
- else
+ else
{
- xdebug3 ( "IOPE%d: fileID=%d, change to buffer 1 ...",
- rankNode, fileID );
+ xdebug3 ( "IOPE%d: fileID=%d, change to buffer 1 ...",
+ rankNode, fileID );
of->db = of->db1;
}
@@ -173,7 +165,7 @@ writeMPINONB(aFiledataM *of)
/***************************************************************/
size_t fwMPINONB ( int fileID, int tsID, const void *buffer, size_t len )
-{
+{
int error = 0;
int filled = 0;
aFiledataM *of;
@@ -197,21 +189,21 @@ size_t fwMPINONB ( int fileID, int tsID, const void *buffer, size_t len )
filled = dbuffer_push ( of->db, ( unsigned char * ) buffer, len );
xdebug3 ( "IOPE%d: fileID = %d, tsID = %d,"
- " pushed data on buffer, filled = %d",
- rankNode, fileID, tsID, filled );
+ " pushed data on buffer, filled = %d",
+ rankNode, fileID, tsID, filled );
- if ( filled == 1 )
+ if ( filled == 1 )
{
if ( flush )
- error = filled;
+ error = filled;
else
- {
- writeMPINONB(of);
-
- error = dbuffer_push ( of->db, ( unsigned char * ) buffer, len );
- }
+ {
+ writeMPINONB(of);
+
+ error = dbuffer_push ( of->db, ( unsigned char * ) buffer, len );
+ }
}
-
+
if ( error == 1 )
xabort("did not succeed filling output buffer, fileID=%d", fileID);
@@ -223,9 +215,6 @@ size_t fwMPINONB ( int fileID, int tsID, const void *buffer, size_t len )
int fcMPINONB ( int fileID )
{
aFiledataM *of;
- int iret;
- double accumWaitMax;
- MPI_Comm commNode = commInqCommNode ();
int rankNode = commInqRankNode ();
xdebug("IOPE%d: write buffer, close file and cleanup, in %d",
@@ -237,21 +226,7 @@ int fcMPINONB ( int fileID )
writeMPINONB(of);
/* remove file element */
- iret = listSetRemove(bibAFiledataM, fileIDTest, (void *)(intptr_t)fileID);
-
- /* timer output */
-
- if ( ddebug == MAXDEBUG )
- {
- xmpi ( MPI_Reduce ( &accumWait, &accumWaitMax,
- 1, MPI_DOUBLE, MPI_MAX, 0, commNode ));
- xdebug ( "IOPE%d: Wait time %15.10lf s",
- rankNode, accumWait );
- if ( rankNode == 0 )
- xdebug ( "IOPE%d: Max wait time %15.10lf s",
- rankNode, accumWaitMax );
- }
-
+ int iret = listSetRemove(bibAFiledataM, fileIDTest, (void *)(intptr_t)fileID);
return iret;
}
@@ -270,27 +245,21 @@ elemCheck(void *q, void *nm)
int fowMPINONB ( const char *filename )
{
static aFiledataM *of;
- static long buffersize = 0;
- int id, bcastRank = 0;
+ static unsigned long buffersize = 0;
+ int id;
+ enum {
+ bcastRoot = 0
+ };
MPI_Comm commNode = commInqCommNode ();
int rankNode = commInqRankNode ();
/* broadcast buffersize to collectors ( just once, for all files )*/
-
- if ( ! buffersize )
+
+ if (!buffersize)
{
- xdebug ( "IOPE%d: Broadcast buffersize to collectors ...",
- rankNode );
-
- if ( rankNode == bcastRank )
- {
- if ( getenv( "BUFSIZE" ) != NULL )
- buffersize = atol ( getenv ( "BUFSIZE" ));
- if ( buffersize < initial_buffersize )
- buffersize = initial_buffersize;
- }
-
- xmpi ( MPI_Bcast ( &buffersize, 1, MPI_LONG, bcastRank, commNode ));
+ if (rankNode == bcastRoot)
+ buffersize = findWriteAccumBufsize();
+ xmpi(MPI_Bcast(&buffersize, 1, MPI_UNSIGNED_LONG, bcastRoot, commNode));
}
xdebug("buffersize=%ld", buffersize);
@@ -331,9 +300,9 @@ initMPINONB(void (*postCommSetupActions)(void))
commDefCommsIO ();
postCommSetupActions();
bibAFiledataM = listSetNew( destroyAFiledataMPINONB, compareNamesMPINONB );
-
+
if ( bibAFiledataM == NULL )
- xabort ( "listSetNew did not succeed" );
+ xabort ( "listSetNew did not succeed" );
}
/*
diff --git a/libcdi/src/pio_posixasynch.c b/libcdi/src/pio_posixasynch.c
index db38307..caf1dc3 100644
--- a/libcdi/src/pio_posixasynch.c
+++ b/libcdi/src/pio_posixasynch.c
@@ -27,14 +27,8 @@
#include "pio_util.h"
#include "dmemory.h"
-extern char * command2charP[6];
-
extern char *token;
-extern double accumSuspend;
-extern double accumWrite;
-
-
typedef struct
{
struct dBuffer *fb;
@@ -105,7 +99,6 @@ destroyBFiledataPA ( void *v )
ssize_t ssiret;
int nextFinishOp = (bfd->nextOpIndex - bfd->prefIndex + nPrefStreams)
% nPrefStreams;
- double startTime;
xdebug ( "filename=%s, cleanup and close file", bfd->name );
@@ -115,10 +108,6 @@ destroyBFiledataPA ( void *v )
{
xdebug("file: %s, prefIndex=%d", bfd->name, (int)bfd->prefIndex);
ccBP[0] = ( bfd->ctrlBlks + nextFinishOp );
-
- if ( ddebug )
- startTime = MPI_Wtime ();
-
do
{
iret = aio_suspend ( ccBP, 1, NULL );
@@ -126,9 +115,6 @@ destroyBFiledataPA ( void *v )
}
while ( iret != 0 );
- if ( ddebug )
- accumSuspend += ( MPI_Wtime () - startTime);
-
iret = aio_error(bfd->ctrlBlks + nextFinishOp);
if (( ssiret = aio_return ( bfd->ctrlBlks + nextFinishOp )) == -1 )
xabort("aio_return () failed: %s", strerror(iret));
@@ -170,7 +156,6 @@ writePA(bFiledataPA *bfd, size_t amount)
{
const struct aiocb *ccBP[1];
ssize_t iret;
- double startTime;
xdebug ( "file %s, in", bfd->name );
@@ -181,12 +166,8 @@ writePA(bFiledataPA *bfd, size_t amount)
bfd->name, bfd->ctrlBlks[bfd->currOpIndex].aio_nbytes,
bfd->ctrlBlks[bfd->currOpIndex].aio_offset );
- if ( ddebug ) startTime = MPI_Wtime ();
-
iret = aio_write ( bfd->ctrlBlks + bfd->currOpIndex );
- if ( ddebug ) accumWrite += ( MPI_Wtime () - startTime);
-
xdebug ( "after aio_write(), file %s, aio_nbytes=%zu, aio_offset=%zu,"
"iret=aio_write()=%d",
bfd->name, bfd->ctrlBlks[bfd->currOpIndex].aio_nbytes,
@@ -205,10 +186,6 @@ writePA(bFiledataPA *bfd, size_t amount)
if ( bfd->prefIndex >= nPrefStreams )
{
ccBP[0] = ( bfd->ctrlBlks + bfd->nextOpIndex );
-
- if ( ddebug )
- startTime = MPI_Wtime ();
-
do
{
iret = aio_suspend ( ccBP, 1, NULL );
@@ -216,10 +193,7 @@ writePA(bFiledataPA *bfd, size_t amount)
xabort ( "aio_suspend () failed" );
} while ( iret != 0 );
- if ( ddebug )
- accumSuspend += ( MPI_Wtime () - startTime);
-
- if (( iret = aio_return ( bfd->ctrlBlks + bfd->nextOpIndex )) == -1 )
+ if (( iret = aio_return ( bfd->ctrlBlks + bfd->nextOpIndex )) == -1 )
xabort ( "aio_return () failed" );
bfd->prefIndex --;
@@ -253,7 +227,7 @@ void pioWriterAIO(void)
xdebug ( "nProcsCollNode=%d on this node", nProcsCollNode );
bibBFiledataPA = listSetNew(destroyBFiledataPA, compareNamesBPA);
- sentFinalize = xmalloc((size_t)nProcsCollNode * sizeof (sentFinalize[0]));
+ sentFinalize = xcalloc((size_t)nProcsCollNode, sizeof (sentFinalize[0]));
for ( ;; )
{
@@ -266,11 +240,11 @@ void pioWriterAIO(void)
struct fileOpTag rtag = decodeFileOpTag(tag);
int messagesize;
- xmpi (MPI_Get_count(&status, MPI_CHAR, &messagesize));
+ xmpi(MPI_Get_count(&status, MPI_UNSIGNED_CHAR, &messagesize));
xdebug ( "receive message from source=%d, id=%d, command=%d ( %s ), "
"messagesize=%d", source, rtag.id, rtag.command,
- command2charP[rtag.command], messagesize);
+ cdiPioCmdStrTab[rtag.command], messagesize);
switch (rtag.command)
{
@@ -280,7 +254,7 @@ void pioWriterAIO(void)
* sizeof (messageBuffer[0]));
char *pMB = messageBuffer;
- xmpi(MPI_Recv(messageBuffer, messagesize, MPI_CHAR, source,
+ xmpi(MPI_Recv(messageBuffer, messagesize, MPI_UNSIGNED_CHAR, source,
tag, commNode, &status ));
char *filename = strtok(pMB, token);
@@ -291,7 +265,7 @@ void pioWriterAIO(void)
size_t amount = (size_t)(messageBuffer + messagesize - pMB);
xdebug("command %s, filename=%s, buffersize=%ld, amount=%zd",
- command2charP[rtag.command], filename, buffersize, amount);
+ cdiPioCmdStrTab[rtag.command], filename, buffersize, amount);
if (!(bfd = listSetGet(bibBFiledataPA, fileIDTest,
(void *)(intptr_t)rtag.id)))
@@ -326,13 +300,14 @@ void pioWriterAIO(void)
xabort("fileID=%d is not in set", rtag.id);
xdebug("command: %s, id=%d, name=%s",
- command2charP[rtag.command], rtag.id, bfd->name );
+ cdiPioCmdStrTab[rtag.command], rtag.id, bfd->name );
bfd->currOpIndex = bfd->nextOpIndex;
bfd->nextOpIndex = ( bfd->nextOpIndex + 1 ) % nPrefStreams;
xmpi(MPI_Recv((void *)bfd->ctrlBlks[bfd->currOpIndex].aio_buf,
- messagesize, MPI_CHAR, source, tag, commNode, &status ));
+ messagesize, MPI_UNSIGNED_CHAR, source, tag, commNode,
+ &status));
writePA(bfd, (size_t)messagesize);
break;
@@ -343,14 +318,15 @@ void pioWriterAIO(void)
xabort("fileID=%d is not in set", rtag.id);
xdebug(" command %s, id=%d, name=%s",
- command2charP[rtag.command], rtag.id, bfd->name);
+ cdiPioCmdStrTab[rtag.command], rtag.id, bfd->name);
bfd->currOpIndex = bfd->nextOpIndex;
bfd->nextOpIndex = ( bfd->nextOpIndex + 1 ) % nPrefStreams;
- MPI_Recv((void *)bfd->ctrlBlks[bfd->currOpIndex].aio_buf,
- messagesize, MPI_CHAR, source, tag, commNode, &status);
+ xmpi(MPI_Recv((void *)bfd->ctrlBlks[bfd->currOpIndex].aio_buf,
+ messagesize, MPI_UNSIGNED_CHAR,
+ source, tag, commNode, &status));
writePA(bfd, (size_t)messagesize);
@@ -380,6 +356,7 @@ void pioWriterAIO(void)
" return");
listSetDelete(bibBFiledataPA);
}
+ free(sentFinalize);
return;
}
}
diff --git a/libcdi/src/pio_posixfpguardsendrecv.c b/libcdi/src/pio_posixfpguardsendrecv.c
index 90e144f..2a20275 100644
--- a/libcdi/src/pio_posixfpguardsendrecv.c
+++ b/libcdi/src/pio_posixfpguardsendrecv.c
@@ -21,10 +21,6 @@
#include "pio_util.h"
#include "dmemory.h"
-extern char * command2charP[6];
-
-extern long initial_buffersize;
-
typedef struct
{
struct dBuffer *db1;
@@ -161,7 +157,8 @@ compareNamesAPF(void *v1, void *v2)
/***************************************************************/
-void fpgPOSIXFPGUARDSENDRECV ( void )
+static void
+fpgPOSIXFPGUARDSENDRECV(void)
{
int i, source, iret;
struct fileOpTag rtag;
@@ -176,7 +173,7 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
xdebug ( "ncollectors=%d on this node", nProcsCollNode );
bibBFiledataPF = listSetNew( destroyBFiledataPF, fileIDCmpB);
- sentFinalize = xmalloc((size_t)nProcsCollNode * sizeof (sentFinalize[0]));
+ sentFinalize = xcalloc((size_t)nProcsCollNode, sizeof (sentFinalize[0]));
for ( ;; )
{
@@ -185,8 +182,8 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
rtag = decodeFileOpTag(status.MPI_TAG);
xdebug("receive message from source=%d, id=%d, command=%d ( %s )",
- source, rtag.id, rtag.command, command2charP[rtag.command]);
-
+ source, rtag.id, rtag.command, cdiPioCmdStrTab[rtag.command]);
+
switch (rtag.command)
{
case IO_Open_file:
@@ -202,8 +199,8 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
}
xdebug("id=%d, command=%d ( %s ), send offset=%ld", rtag.id,
- rtag.command, command2charP[rtag.command], bfd->offset);
-
+ rtag.command, cdiPioCmdStrTab[rtag.command], bfd->offset);
+
xmpi ( MPI_Sendrecv ( &( bfd->offset ), 1, MPI_LONG, source, status.MPI_TAG,
&amount, 1, MPI_LONG, source, status.MPI_TAG,
commNode, &status ));
@@ -211,7 +208,7 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
bfd->offset += amount;
xdebug("id=%d, command=%d ( %s ), recv amount=%ld, set offset=%ld",
- rtag.id, rtag.command, command2charP[rtag.command], amount,
+ rtag.id, rtag.command, cdiPioCmdStrTab[rtag.command], amount,
bfd->offset);
break;
@@ -223,7 +220,7 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
xabort("fileId=%d not in set", rtag.id);
xdebug("id=%d, command=%d ( %s ), send offset=%ld", rtag.id,
- rtag.command, command2charP[rtag.command], bfd->offset);
+ rtag.command, cdiPioCmdStrTab[rtag.command], bfd->offset);
xmpi ( MPI_Sendrecv ( &( bfd->offset ), 1, MPI_LONG, source, status.MPI_TAG,
&amount, 1, MPI_LONG, source, status.MPI_TAG,
@@ -232,7 +229,7 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
bfd->offset += amount;
xdebug("id=%d, command=%d ( %s ), recv amount=%ld, set offset=%ld",
- rtag.id, rtag.command, command2charP[rtag.command], amount,
+ rtag.id, rtag.command, cdiPioCmdStrTab[rtag.command], amount,
bfd->offset);
break;
@@ -244,7 +241,7 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
xabort("fileId=%d not in set", rtag.id);
xdebug("id=%d, command=%d ( %s )), send offset=%ld", rtag.id,
- rtag.command, command2charP[rtag.command], bfd->offset);
+ rtag.command, cdiPioCmdStrTab[rtag.command], bfd->offset);
xmpi ( MPI_Sendrecv ( &( bfd->offset ), 1, MPI_LONG, source, status.MPI_TAG,
&amount, 1, MPI_LONG, source, status.MPI_TAG,
@@ -253,7 +250,7 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
bfd->offset += amount;
xdebug("id=%d, command=%d ( %s ), recv amount=%ld, set offset=%ld",
- rtag.id, rtag.command, command2charP[rtag.command], amount,
+ rtag.id, rtag.command, cdiPioCmdStrTab[rtag.command], amount,
bfd->offset);
@@ -290,6 +287,7 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
xdebug("%s", "destroy set");
listSetDelete(bibBFiledataPF);
}
+ free(sentFinalize);
return;
}
}
@@ -454,23 +452,20 @@ elemCheck(void *q, void *nm)
int fowPOSIXFPGUARDSENDRECV ( const char *filename )
{
- int root = 0, id;
+ int id;
+ enum {
+ bcastRoot = 0
+ };
aFiledataPF *afd;
- static long buffersize = 0;
+ static unsigned long buffersize = 0;
/* broadcast buffersize to collectors */
if (!buffersize)
{
- if (commInqRankColl() == root)
- {
- xdebug("name=%s, broadcast buffersize to collectors ...",
- filename);
- if ( getenv( "BUFSIZE" ) != NULL )
- buffersize = atol ( getenv ( "BUFSIZE" ));
- if ( buffersize < initial_buffersize )
- buffersize = initial_buffersize;
- }
- xmpi(MPI_Bcast(&buffersize, 1, MPI_LONG, root, commInqCommColl()));
+ if (commInqRankColl() == bcastRoot)
+ buffersize = findWriteAccumBufsize();
+ xmpi(MPI_Bcast(&buffersize, 1, MPI_UNSIGNED_LONG, bcastRoot,
+ commInqCommColl()));
}
/* init and add file element */
diff --git a/libcdi/src/pio_posixnonb.c b/libcdi/src/pio_posixnonb.c
index 0de93d0..182f977 100644
--- a/libcdi/src/pio_posixnonb.c
+++ b/libcdi/src/pio_posixnonb.c
@@ -15,8 +15,6 @@
#include "dmemory.h"
-extern char * command2charP[6];
-
extern char *token;
typedef struct
@@ -141,7 +139,7 @@ pioWriterStdIO(void)
xdebug ( "ncollectors=%d on this node", nProcsCollNode );
bibBFiledataP = listSetNew(destroyBFiledataP, compareNamesBP);
- sentFinalize = xmalloc((size_t)nProcsCollNode * sizeof (sentFinalize[0]));
+ sentFinalize = xcalloc((size_t)nProcsCollNode, sizeof (sentFinalize[0]));
for ( ;; )
{
@@ -154,12 +152,12 @@ pioWriterStdIO(void)
tag = status.MPI_TAG;
rtag = decodeFileOpTag(tag);
-
- xmpi ( MPI_Get_count ( &status, MPI_CHAR, &messagesize ));
+
+ xmpi(MPI_Get_count(&status, MPI_UNSIGNED_CHAR, &messagesize));
xdebug ( "RECEIVE MESSAGE FROM SOURCE=%d, ID=%d, COMMAND=%d ( %s ),"
"MESSAGESIZE=%d", source, rtag.id, rtag.command,
- command2charP[rtag.command], messagesize);
+ cdiPioCmdStrTab[rtag.command], messagesize);
switch (rtag.command)
{
@@ -169,8 +167,8 @@ pioWriterStdIO(void)
= xmalloc((size_t)messagesize * sizeof (messageBuffer[0]));
pMB = messageBuffer;
- xmpi ( MPI_Recv ( messageBuffer, messagesize, MPI_CHAR, source,
- tag, commNode, &status ));
+ xmpi(MPI_Recv(messageBuffer, messagesize, MPI_UNSIGNED_CHAR,
+ source, tag, commNode, &status));
xdebug("%s", "after recv, in loop");
@@ -182,7 +180,7 @@ pioWriterStdIO(void)
amount = (size_t)(messageBuffer + messagesize - pMB);
xdebug("command %s, filename=%s, buffersize=%zu, amount=%zu",
- command2charP[rtag.command], filename, buffersize, amount);
+ cdiPioCmdStrTab[rtag.command], filename, buffersize, amount);
if (!(bfd = listSetGet(bibBFiledataP, fileIDTest,
@@ -216,11 +214,11 @@ pioWriterStdIO(void)
amount = (size_t)messagesize;
- xdebug("COMMAND %s, ID=%d, NAME=%s", command2charP[rtag.command],
+ xdebug("COMMAND %s, ID=%d, NAME=%s", cdiPioCmdStrTab[rtag.command],
rtag.id, bfd->name);
- xmpi(MPI_Recv(bfd->fb->buffer, messagesize, MPI_CHAR, source, tag,
- commNode, &status));
+ xmpi(MPI_Recv(bfd->fb->buffer, messagesize, MPI_UNSIGNED_CHAR,
+ source, tag, commNode, &status));
writeP(bfd, amount);
break;
@@ -228,7 +226,7 @@ pioWriterStdIO(void)
case IO_Close_file:
xdebug("COMMAND %s, FILE%d, SOURCE%d",
- command2charP[rtag.command], rtag.id, source);
+ cdiPioCmdStrTab[rtag.command], rtag.id, source);
if (!(bfd = listSetGet(bibBFiledataP, fileIDTest,
(void *)(intptr_t)rtag.id)))
@@ -237,10 +235,10 @@ pioWriterStdIO(void)
amount = (size_t)messagesize;
xdebug("COMMAND %s, ID=%d, NAME=%s, AMOUNT=%zu",
- command2charP[rtag.command], rtag.id, bfd->name, amount);
+ cdiPioCmdStrTab[rtag.command], rtag.id, bfd->name, amount);
- xmpi(MPI_Recv(bfd->fb->buffer, messagesize, MPI_CHAR, source, tag,
- commNode, &status));
+ xmpi(MPI_Recv(bfd->fb->buffer, messagesize, MPI_UNSIGNED_CHAR,
+ source, tag, commNode, &status));
writeP ( bfd, amount );
@@ -277,6 +275,7 @@ pioWriterStdIO(void)
" return");
listSetDelete(bibBFiledataP);
}
+ free(sentFinalize);
return;
}
}
diff --git a/libcdi/src/pio_record_send.c b/libcdi/src/pio_record_send.c
index cd9d9e3..432b9c0 100644
--- a/libcdi/src/pio_record_send.c
+++ b/libcdi/src/pio_record_send.c
@@ -11,10 +11,7 @@
#include "pio_util.h"
#include "dmemory.h"
-extern char *command2charP[];
-extern double accumWait;
extern char *token;
-extern long initial_buffersize;
typedef struct
{
@@ -104,23 +101,19 @@ sendP(remoteFileBuf *afd, int id)
int tag;
size_t amount;
MPI_Status status;
- double startTime;
amount = dbuffer_data_size ( afd->db );
tag = encodeFileOpTag(id, afd->command);
xdebug("send buffer for %s, size: %zu bytes, command=%s, in",
- afd->name, amount, command2charP[afd->command]);
-
- if ( ddebug ) startTime = MPI_Wtime ();
+ afd->name, amount, cdiPioCmdStrTab[afd->command]);
xmpiStat(MPI_Wait(&(afd->request), &status), &status);
- if ( ddebug ) accumWait += ( MPI_Wtime () - startTime );
-
/* FIXME: amount > INT_MAX unhandled */
- xmpi(MPI_Issend(afd->db->buffer, (int)amount, MPI_CHAR, commInqSpecialRankNode(),
- tag, commInqCommNode(), &( afd->request )));
+ xmpi(MPI_Issend(afd->db->buffer, (int)amount, MPI_UNSIGNED_CHAR,
+ commInqSpecialRankNode(), tag, commInqCommNode(),
+ &afd->request));
/* change outputBuffer */
dbuffer_reset ( afd->db );
@@ -173,11 +166,8 @@ pioSendWrite(int id, int tsID, const void *buffer, size_t len)
flushOp(afd, tsID);
{
- double startTime;
MPI_Status status;
- if (ddebug) startTime = MPI_Wtime();
xmpiStat(MPI_Wait(&(afd->request), &status), &status);
- if (ddebug) accumWait += MPI_Wtime() - startTime;
}
xmpi(MPI_Barrier(commInqCommColl()));
}
@@ -208,10 +198,7 @@ pioSendWrite(int id, int tsID, const void *buffer, size_t len)
int
pioSendClose(int id)
{
- double accumWaitMax;
remoteFileBuf *afd;
- int iret;
-
xdebug ( "fileID %d: send buffer, close file and cleanup",id );
afd = listSetGet(bibRemoteFileBuf, fileIDTest, (void *)(intptr_t)id);
@@ -225,18 +212,7 @@ pioSendClose(int id)
xmpi(MPI_Barrier(commInqCommColl()));
/* remove file element */
- iret = listSetRemove(bibRemoteFileBuf, fileIDTest, (void *)(intptr_t)id);
-
- /* timer output */
- if ( ddebug )
- {
- enum { root = 0 };
- xmpi(MPI_Reduce(&accumWait, &accumWaitMax,
- 1, MPI_DOUBLE, MPI_MAX, root, commInqCommColl()));
- xdebug ( "Wait time %15.10lf s", accumWait );
- if ( commInqRankColl () == root )
- xdebug ( "Max wait time %15.10lf s", accumWaitMax );
- }
+ int iret = listSetRemove(bibRemoteFileBuf, fileIDTest, (void *)(intptr_t)id);
return iret;
}
@@ -244,9 +220,10 @@ int
pioSendOpen(const char *filename)
{
remoteFileBuf *afd;
- static long buffersize = 0;
- int root = 0, id, iret;
+ static unsigned long buffersize = 0;
+ int id, iret;
enum {
+ bcastRoot = 0,
messageLength = 32,
};
char message[messageLength];
@@ -255,16 +232,10 @@ pioSendOpen(const char *filename)
/* broadcast buffersize to collectors */
if (!buffersize)
{
- if (commInqRankColl() == root)
- {
- if (getenv("BUFSIZE") != NULL)
- buffersize = atol(getenv("BUFSIZE"));
- if (buffersize < initial_buffersize)
- buffersize = initial_buffersize;
- xdebug("filename=%s, broadcast buffersize=%ld to collectors ...",
- filename, buffersize);
- }
- xmpi(MPI_Bcast(&buffersize, 1, MPI_LONG, root, commCollectors));
+ if (commInqRankColl() == bcastRoot)
+ buffersize = findWriteAccumBufsize();
+ xmpi(MPI_Bcast(&buffersize, 1, MPI_UNSIGNED_LONG, bcastRoot,
+ commCollectors));
}
/* init and add remoteFileBuf */
diff --git a/libcdi/src/pio_serialize.c b/libcdi/src/pio_serialize.c
index 008007e..009caf3 100644
--- a/libcdi/src/pio_serialize.c
+++ b/libcdi/src/pio_serialize.c
@@ -30,7 +30,8 @@ static struct
{ DATATYPE_INT, MPI_INT },
{ DATATYPE_FLT64, MPI_DOUBLE },
{ DATATYPE_TXT, MPI_CHAR },
- { DATATYPE_UCHAR, MPI_UNSIGNED_CHAR }
+ { DATATYPE_UCHAR, MPI_UNSIGNED_CHAR },
+ { DATATYPE_LONG, MPI_LONG },
};
static inline size_t
diff --git a/libcdi/src/pio_server.c b/libcdi/src/pio_server.c
index 6ec0e43..52652fa 100644
--- a/libcdi/src/pio_server.c
+++ b/libcdi/src/pio_server.c
@@ -39,8 +39,6 @@
#include "vlist_var.h"
-extern void arrayDestroy ( void );
-
static struct
{
size_t size;
@@ -426,7 +424,9 @@ int cdiPioSerialOpenFileMap(int streamID)
/* for load-balancing purposes, count number of files per process */
/* cdiOpenFileCounts[rank] gives number of open files rank has to himself */
static int *cdiSerialOpenFileCount = NULL;
-int cdiPioNextOpenRank()
+
+static int
+cdiPioNextOpenRank()
{
xassert(cdiSerialOpenFileCount != NULL);
int commCollSize = commInqSizeColl();
@@ -440,15 +440,16 @@ int cdiPioNextOpenRank()
return minRank;
}
-void cdiPioOpenFileOnRank(int rank)
+static void
+cdiPioOpenFileOnRank(int rank)
{
xassert(cdiSerialOpenFileCount != NULL
- && rank >= 0 && rank < commInqSizeColl());
+ && (unsigned)rank < (unsigned)commInqSizeColl());
++(cdiSerialOpenFileCount[rank]);
}
-
-void cdiPioCloseFileOnRank(int rank)
+static void
+cdiPioCloseFileOnRank(int rank)
{
xassert(cdiSerialOpenFileCount != NULL
&& rank >= 0 && rank < commInqSizeColl());
@@ -989,6 +990,7 @@ cdiPioStreamCDFOpenWrap(const char *filename, const char *filemode,
if (ioMode != PIO_NONE)
xmpi(MPI_Bcast(&fileID, 1, MPI_INT, rank, commInqCommColl()));
streamptr->ownerRank = rank;
+ cdiPioOpenFileOnRank(rank);
return fileID;
}
default:
@@ -1012,11 +1014,11 @@ cdiPioStreamCDFCloseWrap(stream_t *streamptr, int recordBufIsToBeDeleted)
case FILETYPE_NC4:
case FILETYPE_NC4C:
{
- int rank, rankOpen;
+ int rank, rankOpen = cdiPioSerialOpenFileMap(streamptr->self);
if (commInqIOMode() == PIO_NONE
- || ((rank = commInqRankColl())
- == (rankOpen = cdiPioSerialOpenFileMap(streamptr->self))))
+ || ((rank = commInqRankColl()) == rankOpen))
cdiStreamCloseDefaultDelegate(streamptr, recordBufIsToBeDeleted);
+ cdiPioCloseFileOnRank(rankOpen);
break;
}
default:
@@ -1086,12 +1088,8 @@ void cdiPioServer(void (*postCommSetupActions)(void))
switch ( tag )
{
case FINALIZE:
- {
- int i;
- xdebugMsg(tag, source, nfinished);
- xmpi(MPI_Recv(&i, 1, MPI_INTEGER, source,
- tag, commCalc, &status));
- }
+ xdebugMsg(tag, source, nfinished);
+ xmpi(MPI_Recv(NULL, 0, MPI_INT, source, tag, commCalc, &status));
xdebug("%s", "RECEIVED MESSAGE WITH TAG \"FINALIZE\"");
nfinished++;
xdebug("nfinished=%d, nProcsModel=%d", nfinished, nProcsModel);
diff --git a/libcdi/src/resource_handle.c b/libcdi/src/resource_handle.c
index a5d06b8..2ab1d45 100644
--- a/libcdi/src/resource_handle.c
+++ b/libcdi/src/resource_handle.c
@@ -17,15 +17,14 @@
static
void show_stackframe()
{
-#if defined (HAVE_EXECINFO_H)
+#if defined HAVE_EXECINFO_H && defined backtrace_size_t && defined HAVE_BACKTRACE
void *trace[16];
- size_t i;
- size_t trace_size = backtrace(trace, 16);
+ backtrace_size_t trace_size = backtrace(trace, 16);
char **messages = backtrace_symbols(trace, trace_size);
fprintf(stderr, "[bt] Execution path:\n");
if ( messages ) {
- for ( i = 0; i < trace_size; ++i )
+ for ( backtrace_size_t i = 0; i < trace_size; ++i )
fprintf(stderr, "[bt] %s\n", messages[i]);
free(messages);
}
@@ -539,6 +538,10 @@ reshPackResource_intern(int resH, const resOps *ops, void *buf, int buf_size, in
curr->res.v.ops->valPack(curr->res.v.val, buf, buf_size, position, context);
}
+enum {
+ resHPackHeaderNInt = 2,
+ resHDeleteNInt = 2,
+};
static int getPackBufferSize(void *context)
{
@@ -547,7 +550,7 @@ static int getPackBufferSize(void *context)
int nsp = namespaceGetActive ();
/* pack start marker, namespace and sererator marker */
- packBufferSize += 3 * (intpacksize = serializeGetSize(1, DATATYPE_INT, context));
+ packBufferSize += resHPackHeaderNInt * (intpacksize = serializeGetSize(1, DATATYPE_INT, context));
/* pack resources, type marker and seperator marker */
listElem_t *r = resHList[nsp].resources;
@@ -556,15 +559,15 @@ static int getPackBufferSize(void *context)
{
if (r[i].status == RESH_DESYNC_DELETED)
{
- packBufferSize += 3 * intpacksize;
+ packBufferSize += resHDeleteNInt * intpacksize;
}
else if (r[i].status == RESH_DESYNC_IN_USE)
{
xassert ( r[i].res.v.ops );
- /* message plus frame of 2 ints */
+ /* packed resource plus 1 int for type */
packBufferSize +=
r[i].res.v.ops->valGetPackSize(r[i].res.v.val, context)
- + 2 * intpacksize;
+ + intpacksize;
}
}
/* end marker */
@@ -585,7 +588,7 @@ void reshPackBufferDestroy ( char ** buffer )
void reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
{
int i, packBufferPos = 0;
- int start = START, end = END, sep = SEPARATOR, type;
+ int end = END;
xassert ( packBuffer );
@@ -597,8 +600,8 @@ void reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
char *pB = *packBuffer = (char *)xcalloc(1, (size_t)pBSize);
{
- int header[3] = { start, nsp, sep };
- serializePack(header, 3, DATATYPE_INT, pB, pBSize, &packBufferPos, context);
+ int header[resHPackHeaderNInt] = { START, nsp };
+ serializePack(header, resHPackHeaderNInt, DATATYPE_INT, pB, pBSize, &packBufferPos, context);
}
listElem_t *r = resHList[nsp].resources;
@@ -607,23 +610,21 @@ void reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context)
{
if (r[i].status == RESH_DESYNC_DELETED)
{
- enum { del_ints = 3 };
- int temp[del_ints] = { RESH_DELETE, namespaceIdxEncode2(nsp, i), SEPARATOR };
- serializePack(temp, del_ints, DATATYPE_INT,
+ int temp[resHDeleteNInt]
+ = { RESH_DELETE, namespaceIdxEncode2(nsp, i) };
+ serializePack(temp, resHDeleteNInt, DATATYPE_INT,
pB, pBSize, &packBufferPos, context);
}
else
{
listElem_t * curr = r + i;
xassert ( curr->res.v.ops );
- type = curr->res.v.ops->valTxCode ();
+ int type = curr->res.v.ops->valTxCode();
if ( ! type ) continue;
serializePack(&type, 1, DATATYPE_INT, pB,
pBSize, &packBufferPos, context);
curr->res.v.ops->valPack(curr->res.v.val,
pB, pBSize, &packBufferPos, context);
- serializePack(&sep, 1, DATATYPE_INT,
- pB, pBSize, &packBufferPos, context);
}
r[i].status &= ~RESH_SYNC_BIT;
}
diff --git a/libcdi/src/resource_unpack.c b/libcdi/src/resource_unpack.c
index a362a7b..b05b6e0 100644
--- a/libcdi/src/resource_unpack.c
+++ b/libcdi/src/resource_unpack.c
@@ -21,26 +21,29 @@
void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
void *context)
{
- int token1, token2, originNamespace;
+ int updateType, resH, originNamespace;
int unpackBufferPos = 0;
int numAssociations = 0, sizeAssociations = 16;
struct streamAssoc *associations
= (struct streamAssoc *)xmalloc(sizeof (associations[0])
* (size_t)sizeAssociations);
+ {
+ int msgHdr[2];
+ serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
+ &msgHdr, 2, DATATYPE_INT, context);
+ if (msgHdr[0] != START)
+ xabort("error parsing resource serialization buffer");
+ originNamespace = msgHdr[1];
+ }
while ( unpackBufferPos < unpackBufferSize )
{
serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
- &token1, 1, DATATYPE_INT, context);
-
- if (token1 == END)
+ &updateType, 1, DATATYPE_INT, context);
+ if (updateType == END)
break;
- switch (token1)
+ switch (updateType)
{
- case START:
- serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
- &originNamespace, 1, DATATYPE_INT, context);
- break;
case GRID:
gridUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
originNamespace, context, 1);
@@ -77,16 +80,13 @@ void reshUnpackResources(char * unpackBuffer, int unpackBufferSize,
break;
case RESH_DELETE:
serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
- &token2, 1, DATATYPE_INT, context);
- reshDestroy(namespaceAdaptKey(token2, originNamespace));
+ &resH, 1, DATATYPE_INT, context);
+ reshDestroy(namespaceAdaptKey(resH, originNamespace));
break;
default:
- xabort ( "TOKEN MAPS NO VALID DATATYPE" );
+ xabort("Invalid/unexpected serialization type %d or transfer error!",
+ updateType);
}
-
- serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos,
- &token2, 1, DATATYPE_INT, context);
- xassert ( token2 == SEPARATOR );
}
for (int i = 0; i < numAssociations; ++i)
{
diff --git a/libcdi/src/resource_unpack.h b/libcdi/src/resource_unpack.h
index 13c92b5..3d924d6 100644
--- a/libcdi/src/resource_unpack.h
+++ b/libcdi/src/resource_unpack.h
@@ -15,7 +15,6 @@ enum
VLIST = 7,
RESH_DELETE,
START = 55555555,
- SEPARATOR = 66666666,
END = 99999999
};
diff --git a/libcdi/src/serialize.c b/libcdi/src/serialize.c
index 6ef8265..badf140 100644
--- a/libcdi/src/serialize.c
+++ b/libcdi/src/serialize.c
@@ -16,22 +16,22 @@ serializeGetSize(int count, int datatype, void *context)
return serialize_get_size_p(count, datatype, context);
}
-void serializePack(void *data, int count, int datatype,
- void *buf, int buf_size, int *position, void *context)
+void serializePack(const void *data, int count, int datatype,
+ void *buf, int buf_size, int *position, void *context)
{
- void (*serialize_pack_p)(void *data, int count, int datatype,
+ void (*serialize_pack_p)(const void *data, int count, int datatype,
void *buf, int buf_size, int *position, void *context)
- = (void (*)(void *, int, int, void *, int, int *, void *))
+ = (void (*)(const void *, int, int, void *, int, int *, void *))
namespaceSwitchGet(NSSWITCH_SERIALIZE_PACK).func;
serialize_pack_p(data, count, datatype, buf, buf_size, position, context);
}
-void serializeUnpack(void *buf, int buf_size, int *position,
- void *data, int count, int datatype, void *context)
+void serializeUnpack(const void *buf, int buf_size, int *position,
+ void *data, int count, int datatype, void *context)
{
- void (*serialize_unpack_p)(void *buf, int buf_size, int *position,
+ void (*serialize_unpack_p)(const void *buf, int buf_size, int *position,
void *data, int count, int datatype, void *context)
- = (void (*)(void *, int, int *, void *, int, int, void *))
+ = (void (*)(const void *, int, int *, void *, int, int, void *))
namespaceSwitchGet(NSSWITCH_SERIALIZE_UNPACK).func;
serialize_unpack_p(buf, buf_size, position, data, count, datatype, context);
}
@@ -65,14 +65,17 @@ serializeGetSizeInCore(int count, int datatype, void *context)
case DATATYPE_UCHAR:
elemSize = 1;
break;
+ case DATATYPE_LONG:
+ elemSize = sizeof (long);
+ break;
default:
xabort("Unexpected datatype");
}
return count * elemSize;
}
-void serializePackInCore(void *data, int count, int datatype,
- void *buf, int buf_size, int *position, void *context)
+void serializePackInCore(const void *data, int count, int datatype,
+ void *buf, int buf_size, int *position, void *context)
{
int size = serializeGetSize(count, datatype, context);
int pos = *position;
@@ -82,8 +85,8 @@ void serializePackInCore(void *data, int count, int datatype,
*position = pos;
}
-void serializeUnpackInCore(void *buf, int buf_size, int *position,
- void *data, int count, int datatype, void *context)
+void serializeUnpackInCore(const void *buf, int buf_size, int *position,
+ void *data, int count, int datatype, void *context)
{
int size = serializeGetSize(count, datatype, context);
int pos = *position;
diff --git a/libcdi/src/serialize.h b/libcdi/src/serialize.h
index b9f5f4e..a24589f 100644
--- a/libcdi/src/serialize.h
+++ b/libcdi/src/serialize.h
@@ -5,26 +5,98 @@
#ifndef SERIALIZE_H
#define SERIALIZE_H
+#include <string.h>
+
+#include "cdi.h"
+#include "cdi_cksum.h"
+#include "error.h"
+
/*
* Generic interfaces for (de-)marshalling
*/
int serializeGetSize(int count, int datatype, void *context);
-void serializePack(void *data, int count, int datatype,
+void serializePack(const void *data, int count, int datatype,
void *buf, int buf_size, int *position, void *context);
-void serializeUnpack(void *buf, int buf_size, int *position,
+void serializeUnpack(const void *buf, int buf_size, int *position,
void *data, int count, int datatype, void *context);
/*
- * top-level de-marshalling function
+ * (de-)marshalling function for common data structures
*/
+static inline int
+serializeStrTabGetPackSize(const char **strTab, int numStr,
+ void *context)
+{
+ xassert(numStr >= 0);
+ int packBuffSize = 0;
+ for (size_t i = 0; i < (size_t)numStr; ++i)
+ {
+ size_t len = strlen(strTab[i]);
+ packBuffSize +=
+ serializeGetSize(1, DATATYPE_INT, context)
+ + serializeGetSize((int)len, DATATYPE_TXT, context);
+ }
+ packBuffSize +=
+ serializeGetSize(1, DATATYPE_UINT32, context);
+ return packBuffSize;
+}
+
+static inline void
+serializeStrTabPack(const char **strTab, int numStr,
+ void *buf, int buf_size, int *position, void *context)
+{
+ uint32_t d = 0;
+ xassert(numStr >= 0);
+ for (size_t i = 0; i < (size_t)numStr; ++i)
+ {
+ size_t len = strlen(strTab[i]);
+ serializePack(&(int){(int)len}, 1, DATATYPE_INT,
+ buf, buf_size, position, context);
+ serializePack(strTab[i], (int)len, DATATYPE_TXT,
+ buf, buf_size, position, context);
+ d ^= cdiCheckSum(DATATYPE_TXT, (int)len, strTab[i]);
+ }
+ serializePack(&d, 1, DATATYPE_UINT32,
+ buf, buf_size, position, context);
+}
+
+static inline void
+serializeStrTabUnpack(const void *buf, int buf_size, int *position,
+ char **strTab, int numStr, void *context)
+{
+ uint32_t d, d2 = 0;
+ xassert(numStr >= 0);
+ for (size_t i = 0; i < (size_t)numStr; ++i)
+ {
+ int len;
+ serializeUnpack(buf, buf_size, position,
+ &len, 1, DATATYPE_INT, context);
+ serializeUnpack(buf, buf_size, position,
+ strTab[i], len, DATATYPE_TXT, context);
+ strTab[i][len] = '\0';
+ d2 ^= cdiCheckSum(DATATYPE_TXT, (size_t)len, strTab[i]);
+ }
+ serializeUnpack(buf, buf_size, position,
+ &d, 1, DATATYPE_UINT32, context);
+ xassert(d == d2);
+}
/*
* Interfaces for marshalling within a single memory domain
*/
int serializeGetSizeInCore(int count, int datatype, void *context);
-void serializePackInCore(void *data, int count, int datatype,
+void serializePackInCore(const void *data, int count, int datatype,
void *buf, int buf_size, int *position, void *context);
-void serializeUnpackInCore(void *buf, int buf_size, int *position,
- void *data, int count, int datatype, void *context);
+void serializeUnpackInCore(const void *buf, int buf_size, int *position,
+ void *data, int count, int datatype, void *context);
#endif
+/*
+ * Local Variables:
+ * c-file-style: "Java"
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * show-trailing-whitespace: t
+ * require-trailing-newline: t
+ * End:
+ */
diff --git a/libcdi/src/stream.c b/libcdi/src/stream.c
index d3cb1b3..356b443 100644
--- a/libcdi/src/stream.c
+++ b/libcdi/src/stream.c
@@ -796,8 +796,7 @@ open stream. Otherwise, a negative number with the error status is returned.
@EndList
@Example
-Here is an example using @func{streamOpenWrite} to create a new netCDF file
-named @func{foo.nc} for writing:
+Here is an example using @func{streamOpenWrite} to create a new netCDF file named @func{foo.nc} for writing:
@Source
#include "cdi.h"
@@ -828,7 +827,6 @@ void streamDefaultValue ( stream_t * streamptr )
streamptr->filetype = FILETYPE_UNDEF;
streamptr->byteorder = CDI_UNDEFID;
streamptr->fileID = 0;
- streamptr->dimgroupID = CDI_UNDEFID;
streamptr->filemode = 0;
streamptr->numvals = 0;
streamptr->filename = NULL;
@@ -837,12 +835,10 @@ void streamDefaultValue ( stream_t * streamptr )
streamptr->nrecs = 0;
streamptr->nvars = 0;
streamptr->vars = NULL;
- streamptr->varinit = 0;
streamptr->ncmode = 0;
streamptr->curTsID = CDI_UNDEFID;
streamptr->rtsteps = 0;
streamptr->ntsteps = CDI_UNDEFID;
- streamptr->numTimestep = 0;
streamptr->tsteps = NULL;
streamptr->tstepsTableSize = 0;
streamptr->tstepsNextID = 0;
@@ -869,10 +865,6 @@ void streamDefaultValue ( stream_t * streamptr )
for ( i = 0; i < MAX_GRIDS_PS; i++ ) streamptr->ncyvarID[i] = CDI_UNDEFID;
for ( i = 0; i < MAX_GRIDS_PS; i++ ) streamptr->ncavarID[i] = CDI_UNDEFID;
- streamptr->curfile = 0;
- streamptr->nfiles = 0;
- streamptr->fnames = NULL;
-
streamptr->gribContainers = NULL;
streamptr->vlistIDorig = CDI_UNDEFID;
}
@@ -1029,14 +1021,6 @@ void streamClose(int streamID)
if ( streamptr->basetime.timevar_cache ) free(streamptr->basetime.timevar_cache);
- if ( streamptr->nfiles > 0 )
- {
- for ( index = 0; index < streamptr->nfiles; ++index )
- free(streamptr->fnames[index]);
-
- free(streamptr->fnames);
- }
-
if ( vlistID != -1 )
{
if ( streamptr->filemode != 'w' )
@@ -1671,7 +1655,7 @@ void streamReadVarSlice(int streamID, int varID, int levelID, double *data, int
if ( cdiStreamReadVarSlice(streamID, varID, levelID, MEMTYPE_DOUBLE, data, nmiss) )
{
Warning("Unexpected error returned from cdiStreamReadVarSlice()!");
- size_t elementCount = gridInqSize(vlistInqVarGrid(streamInqVlist(streamID), varID));
+ size_t elementCount = (size_t)gridInqSize(vlistInqVarGrid(streamInqVlist(streamID), varID));
memset(data, 0, elementCount * sizeof(*data));
}
}
@@ -1700,10 +1684,10 @@ void streamReadVarSliceF(int streamID, int varID, int levelID, float *data, int
{
// In case the file format does not support single precision reading,
// we fall back to double precision reading, converting the data on the fly.
- size_t elementCount = gridInqSize(vlistInqVarGrid(streamInqVlist(streamID), varID));
+ size_t elementCount = (size_t)gridInqSize(vlistInqVarGrid(streamInqVlist(streamID), varID));
double* conversionBuffer = malloc(elementCount * sizeof(*conversionBuffer));
streamReadVarSlice(streamID, varID, levelID, conversionBuffer, nmiss);
- for (size_t i = elementCount; i--; ) data[i] = conversionBuffer[i];
+ for (size_t i = elementCount; i--; ) data[i] = (float)conversionBuffer[i];
free(conversionBuffer);
}
}
@@ -2117,46 +2101,17 @@ int streamInqFileID(int streamID)
return (streamptr->fileID);
}
-void streamDefDimgroupID(int streamID, int dimgroupID)
-{
- stream_t *streamptr;
-
- streamptr = ( stream_t *) reshGetVal ( streamID, &streamOps );
-
- streamptr->dimgroupID = dimgroupID;
-}
-
-
-int streamInqDimgroupID(int streamID)
-{
- stream_t *streamptr;
-
- streamptr = ( stream_t *) reshGetVal ( streamID, &streamOps );
-
- return (streamptr->dimgroupID);
-}
-
-
void cdiDefAccesstype(int streamID, int type)
{
- stream_t *streamptr;
-
- streamptr = ( stream_t *) reshGetVal ( streamID, &streamOps );
+ stream_t *streamptr = reshGetVal(streamID, &streamOps);
if ( streamptr->accesstype == CDI_UNDEFID )
{
streamptr->accesstype = type;
}
- else
- {
- if ( streamptr->accesstype != type )
- {
- if ( streamptr->accesstype == TYPE_REC )
- Error("Changing access type from REC to VAR not allowed!");
- else
- Error("Changing access type from VAR to REC not allowed!");
- }
- }
+ else if ( streamptr->accesstype != type )
+ Error("Changing access type from %s not allowed!",
+ streamptr->accesstype == TYPE_REC ? "REC to VAR" : "VAR to REC");
}
@@ -2193,25 +2148,26 @@ void cdiStreamSetupVlist(stream_t *streamptr, int vlistID, int vlistIDorig)
}
if (streamptr->filemode == 'w' )
- {
- if ( streamptr->filetype == FILETYPE_NC ||
- streamptr->filetype == FILETYPE_NC2 ||
- streamptr->filetype == FILETYPE_NC4 ||
- streamptr->filetype == FILETYPE_NC4C )
- {
+ switch (streamptr->filetype)
+ {
#ifdef HAVE_LIBNETCDF
+ case FILETYPE_NC:
+ case FILETYPE_NC2:
+ case FILETYPE_NC4:
+ case FILETYPE_NC4C:
+ {
void (*myCdfDefVars)(stream_t *streamptr)
= (void (*)(stream_t *))
namespaceSwitchGet(NSSWITCH_CDF_STREAM_SETUP).func;
myCdfDefVars(streamptr);
-#endif
- }
- else if ( streamptr->filetype == FILETYPE_GRB ||
- streamptr->filetype == FILETYPE_GRB2 )
- {
- gribContainersNew(streamptr);
}
- }
+ break;
+#endif
+ case FILETYPE_GRB:
+ case FILETYPE_GRB2:
+ gribContainersNew(streamptr);
+ break;
+ }
}
@@ -2222,9 +2178,8 @@ void streamGetIndexList ( int nstreams, int * streamIndexList )
int streamInqNvars ( int streamID )
{
- stream_t * streamptr;
- streamptr = ( stream_t * ) reshGetVal ( streamID, &streamOps );
- return ( streamptr->nvars );
+ stream_t *streamptr = reshGetVal(streamID, &streamOps);
+ return streamptr->nvars;
}
@@ -2285,21 +2240,17 @@ void streamPrintP ( void * streamptr, FILE * fp )
fprintf ( fp, "filetype = %d\n", sp->filetype );
fprintf ( fp, "byteorder = %d\n", sp->byteorder );
fprintf ( fp, "fileID = %d\n", sp->fileID );
- fprintf ( fp, "dimgroupID = %d\n", sp->dimgroupID );
fprintf ( fp, "filemode = %d\n", sp->filemode );
fprintf ( fp, "//off_t numvals;\n" );
fprintf ( fp, "filename = %s\n", sp->filename );
fprintf ( fp, "//Record *record;\n" );
fprintf ( fp, "nrecs = %d\n", sp->nrecs );
fprintf ( fp, "nvars = %d\n", sp->nvars );
- fprintf ( fp, "varlocked = %d\n", sp->varlocked );
fprintf ( fp, "//svarinfo_t *vars;\n" );
fprintf ( fp, "varsAllocated = %d\n", sp->varsAllocated );
- fprintf ( fp, "varinit = %d\n", sp->varinit );
fprintf ( fp, "curTsID = %d\n", sp->curTsID );
fprintf ( fp, "rtsteps = %d\n", sp->rtsteps );
fprintf ( fp, "//long ntsteps;\n" );
- fprintf ( fp, "numTimestep = %d\n", sp->numTimestep );
fprintf ( fp, "// tsteps_t *tsteps;\n" );
fprintf ( fp, "tstepsTableSize= %d\n", sp->tstepsTableSize );
fprintf ( fp, "tstepsNextID = %d\n", sp->tstepsNextID );
@@ -2321,9 +2272,6 @@ void streamPrintP ( void * streamptr, FILE * fp )
fprintf ( fp, "have_missval = %d\n", sp->have_missval );
fprintf ( fp, "ztype = %d\n", sp->comptype );
fprintf ( fp, "zlevel = %d\n", sp->complevel );
- fprintf ( fp, "curfile = %d\n", sp->curfile );
- fprintf ( fp, "nfiles = %d\n", sp->nfiles );
- fprintf ( fp, "// char **fnames;\n" );
fprintf ( fp, "// void **gribContainers;\n" );
fprintf ( fp, "vlistIDorig = %d\n", sp->vlistIDorig );
}
diff --git a/libcdi/src/stream_cdf.c b/libcdi/src/stream_cdf.c
index cab9d96..ed7d7f3 100644
--- a/libcdi/src/stream_cdf.c
+++ b/libcdi/src/stream_cdf.c
@@ -542,13 +542,26 @@ int cdfDefDatatype(int datatype, int filetype)
return (xtype);
}
+static inline void *
+resizeBuf(void **buf, size_t *bufSize, size_t reqSize)
+{
+ if (reqSize > *bufSize)
+ {
+ *buf = xrealloc(*buf, reqSize);
+ *bufSize = reqSize;
+ }
+ return *buf;
+}
+
static
void defineAttributes(int vlistID, int varID, int fileID, int ncvarID)
{
int natts, iatt;
int atttype, attlen;
size_t len;
- char attname[1024];
+ char attname[CDI_MAX_NAME+1];
+ void *attBuf = NULL;
+ size_t attBufSize = 0;
vlistInqNatts(vlistID, varID, &natts);
@@ -560,35 +573,30 @@ void defineAttributes(int vlistID, int varID, int fileID, int ncvarID)
if ( atttype == DATATYPE_TXT )
{
- char *atttxt = (char *)xmalloc((size_t)attlen*sizeof(char));
+ size_t attSize = (size_t)attlen*sizeof(char);
+ char *atttxt = (char *)resizeBuf(&attBuf, &attBufSize, attSize);
vlistInqAttTxt(vlistID, varID, attname, attlen, atttxt);
len = (size_t)attlen;
cdf_put_att_text(fileID, ncvarID, attname, len, atttxt);
- free(atttxt);
}
else if ( atttype == DATATYPE_INT16 || atttype == DATATYPE_INT32 )
{
- int *attint = (int *)xmalloc((size_t)attlen*sizeof(int));
+ size_t attSize = (size_t)attlen*sizeof(int);
+ int *attint = (int *)resizeBuf(&attBuf, &attBufSize, attSize);
vlistInqAttInt(vlistID, varID, attname, attlen, &attint[0]);
len = (size_t)attlen;
- if ( atttype == DATATYPE_INT16 )
- cdf_put_att_int(fileID, ncvarID, attname, NC_SHORT, len, attint);
- else
- cdf_put_att_int(fileID, ncvarID, attname, NC_INT, len, attint);
- free(attint);
+ cdf_put_att_int(fileID, ncvarID, attname, atttype == DATATYPE_INT16 ? NC_SHORT : NC_INT, len, attint);
}
else if ( atttype == DATATYPE_FLT32 || atttype == DATATYPE_FLT64 )
{
- double *attflt = (double *)xmalloc((size_t)attlen*sizeof(double));
+ size_t attSize = (size_t)attlen * sizeof(double);
+ double *attflt = (double *)resizeBuf(&attBuf, &attBufSize, attSize);
vlistInqAttFlt(vlistID, varID, attname, attlen, attflt);
len = (size_t)attlen;
- if ( atttype == DATATYPE_FLT32 )
- cdf_put_att_double(fileID, ncvarID, attname, NC_FLOAT, len, attflt);
- else
- cdf_put_att_double(fileID, ncvarID, attname, NC_DOUBLE, len, attflt);
- free(attflt);
+ cdf_put_att_double(fileID, ncvarID, attname, atttype == DATATYPE_FLT32 ? NC_FLOAT : NC_DOUBLE, len, attflt);
}
}
+ free(attBuf);
}
void cdfCopyRecord(stream_t *streamptr2, stream_t *streamptr1)
@@ -786,15 +794,13 @@ void cdf_write_record(stream_t *streamptr, int memtype, const void *data, int nm
void cdfReadRecord(stream_t *streamptr, double *data, int *nmiss)
{
- int levelID, varID, tsID, recID, vrecID;
-
if ( CDI_Debug ) Message("streamID = %d", streamptr->self);
- tsID = streamptr->curTsID;
- vrecID = streamptr->tsteps[tsID].curRecID;
- recID = streamptr->tsteps[tsID].recIDs[vrecID];
- varID = streamptr->tsteps[tsID].records[recID].varID;
- levelID = streamptr->tsteps[tsID].records[recID].levelID;
+ int tsID = streamptr->curTsID;
+ int vrecID = streamptr->tsteps[tsID].curRecID;
+ int recID = streamptr->tsteps[tsID].recIDs[vrecID];
+ int varID = streamptr->tsteps[tsID].records[recID].varID;
+ int levelID = streamptr->tsteps[tsID].records[recID].levelID;
cdfReadVarSliceDP(streamptr, varID, levelID, data, nmiss);
}
@@ -802,16 +808,12 @@ void cdfReadRecord(stream_t *streamptr, double *data, int *nmiss)
static
void cdfDefTimeValue(stream_t *streamptr, int tsID)
{
- int fileID;
- int ncvarid;
- taxis_t *taxis;
-
- fileID = streamptr->fileID;
+ int fileID = streamptr->fileID;
if ( CDI_Debug )
Message("streamID = %d, fileID = %d", streamptr->self, fileID);
- taxis = &streamptr->tsteps[tsID].taxis;
+ taxis_t *taxis = &streamptr->tsteps[tsID].taxis;
if ( streamptr->ncmode == 1 )
{
@@ -824,7 +826,7 @@ void cdfDefTimeValue(stream_t *streamptr, int tsID)
double timevalue = cdiEncodeTimeval(taxis->vdate, taxis->vtime, &streamptr->tsteps[0].taxis);
if ( CDI_Debug ) Message("tsID = %d timevalue = %f", tsID, timevalue);
- ncvarid = streamptr->basetime.ncvarid;
+ int ncvarid = streamptr->basetime.ncvarid;
cdf_put_var1_double(fileID, ncvarid, &index, &timevalue);
if ( taxis->has_bounds )
@@ -1060,9 +1062,7 @@ void cdfDefTime(stream_t* streamptr)
void cdfDefTimestep(stream_t *streamptr, int tsID)
{
- int vlistID;
-
- vlistID = streamptr->vlistID;
+ int vlistID = streamptr->vlistID;
if ( vlistHasTime(vlistID) ) cdfDefTime(streamptr);
@@ -1073,19 +1073,14 @@ static
void cdfDefComplex(stream_t *streamptr, int gridID)
{
char axisname[] = "nc2";
- int index;
int dimID = UNDEFID;
- int gridID0, gridtype0, gridindex;
- int ngrids;
- int fileID;
- int vlistID;
-
- vlistID = streamptr->vlistID;
- fileID = streamptr->fileID;
+ int gridID0, gridtype0;
+ int vlistID = streamptr->vlistID;
+ int fileID = streamptr->fileID;
- ngrids = vlistNgrids(vlistID);
+ int ngrids = vlistNgrids(vlistID);
- for ( index = 0; index < ngrids; index++ )
+ for ( int index = 0; index < ngrids; index++ )
{
if ( streamptr->xdimID[index] != UNDEFID )
{
@@ -1111,7 +1106,7 @@ void cdfDefComplex(stream_t *streamptr, int gridID)
streamptr->ncmode = 2;
}
- gridindex = vlistGridIndex(vlistID, gridID);
+ int gridindex = vlistGridIndex(vlistID, gridID);
streamptr->xdimID[gridindex] = dimID;
}
@@ -3404,7 +3399,7 @@ size_t cdfDoInputDataTransformationDP(size_t valueCount, double *data, bool have
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? missVal
: isMissVal ? data[i] : data[i] * scaleFactor + offset;
}
@@ -3414,7 +3409,7 @@ size_t cdfDoInputDataTransformationDP(size_t valueCount, double *data, bool have
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? missVal
: isMissVal ? data[i] : data[i] + offset;
}
@@ -3424,7 +3419,7 @@ size_t cdfDoInputDataTransformationDP(size_t valueCount, double *data, bool have
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? missVal
: isMissVal ? data[i] : data[i] * scaleFactor;
}
@@ -3434,7 +3429,7 @@ size_t cdfDoInputDataTransformationDP(size_t valueCount, double *data, bool have
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? missVal : data[i];
}
break;
@@ -3503,7 +3498,7 @@ size_t cdfDoInputDataTransformationSP(size_t valueCount, float *data, bool haveM
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? (float)missVal
: isMissVal ? data[i] : (float)(data[i] * scaleFactor + offset);
}
@@ -3513,7 +3508,7 @@ size_t cdfDoInputDataTransformationSP(size_t valueCount, float *data, bool haveM
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? (float)missVal
: isMissVal ? data[i] : (float)(data[i] + offset);
}
@@ -3523,7 +3518,7 @@ size_t cdfDoInputDataTransformationSP(size_t valueCount, float *data, bool haveM
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? (float)missVal
: isMissVal ? data[i] : (float)(data[i] * scaleFactor);
}
@@ -3533,7 +3528,7 @@ size_t cdfDoInputDataTransformationSP(size_t valueCount, float *data, bool haveM
{
int outOfRange = data[i] < validMin || data[i] > validMax;
int isMissVal = DBL_IS_EQUAL(data[i], missVal);
- missValCount += (outOfRange | isMissVal);
+ missValCount += (size_t)(outOfRange | isMissVal);
data[i] = outOfRange ? (float)missVal : data[i];
}
break;
@@ -4220,7 +4215,7 @@ void cdfReadVarSP(stream_t *streamptr, int varID, float *data, int *nmiss)
cdf_get_vara_float(fileID, ncvarid, start, count, data);
- size_t size = (size_t)gridInqSize(gridID)*zaxisInqSize(zaxisID);
+ size_t size = (size_t)gridInqSize(gridID) * (size_t)zaxisInqSize(zaxisID);
double missval = vlistInqVarMissval(vlistID, varID);
const bool haveMissVal = vlistInqVarMissvalUsed(vlistID, varID);
double validRange[2];
@@ -4351,63 +4346,52 @@ void cdfReadVarSliceSP(stream_t *streamptr, int varID, int levelID, float *data,
void cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, const void *data, int nmiss)
{
- int fileID;
- int gridID;
- int zaxisID;
- int xid = UNDEFID, yid = UNDEFID, zid = UNDEFID;
- int ncvarid;
- long nvals;
size_t xsize = 0, ysize = 0;
size_t start[5];
size_t count[5];
- int ndims = 0;
- int idim;
- int tsteptype;
- int gridindex, zaxisindex;
int dimorder[3];
- int swapxy = FALSE;
- int dtype;
- int vlistID;
- extern int CDF_Debug;
+ int xid = UNDEFID, yid = UNDEFID, zid = UNDEFID;
if ( CDI_Debug ) Message("streamID = %d varID = %d", streamptr->self, varID);
- vlistID = streamptr->vlistID;
- fileID = streamptr->fileID;
+ int vlistID = streamptr->vlistID;
+ int fileID = streamptr->fileID;
long ntsteps = streamptr->ntsteps;
if ( CDI_Debug ) Message("ntsteps = %ld", ntsteps);
if ( vlistHasTime(vlistID) ) cdfDefTime(streamptr);
- ncvarid = cdfDefVar(streamptr, varID);
+ int ncvarid = cdfDefVar(streamptr, varID);
- gridID = vlistInqVarGrid(vlistID, varID);
- zaxisID = vlistInqVarZaxis(vlistID, varID);
- tsteptype = vlistInqVarTsteptype(vlistID, varID);
+ int gridID = vlistInqVarGrid(vlistID, varID);
+ int zaxisID = vlistInqVarZaxis(vlistID, varID);
+ int tsteptype = vlistInqVarTsteptype(vlistID, varID);
vlistInqVarDimorder(vlistID, varID, &dimorder);
- gridindex = vlistGridIndex(vlistID, gridID);
if ( gridInqType(gridID) == GRID_TRAJECTORY )
{
cdfWriteGridTraj(streamptr, gridID);
}
else
{
+ int gridindex = vlistGridIndex(vlistID, gridID);
xid = streamptr->xdimID[gridindex];
yid = streamptr->ydimID[gridindex];
}
+ {
+ int zaxisindex = vlistZaxisIndex(vlistID, zaxisID);
+ zid = streamptr->zaxisID[zaxisindex];
+ }
- zaxisindex = vlistZaxisIndex(vlistID, zaxisID);
- zid = streamptr->zaxisID[zaxisindex];
-
- if ( (dimorder[2] == 2 || dimorder[0] == 1) && xid != UNDEFID && yid != UNDEFID ) swapxy = TRUE;
+ int swapxy = (dimorder[2] == 2 || dimorder[0] == 1) && xid != UNDEFID && yid != UNDEFID;
/*
printf("swapxy %d\n", swapxy);
printf("dimorder: %d %d %d\n", dimorder[0], dimorder[1], dimorder[2]);
*/
+ size_t ndims = 0;
if ( tsteptype != TSTEP_CONSTANT )
{
start[ndims] = (size_t)ntsteps - 1;
@@ -4440,14 +4424,14 @@ void cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtyp
}
if ( CDI_Debug )
- for (idim = 0; idim < ndims; idim++)
+ for (size_t idim = 0; idim < ndims; idim++)
Message("dim = %d start = %d count = %d", idim, start[idim], count[idim]);
- dtype = vlistInqVarDatatype(vlistID, varID);
+ int dtype = vlistInqVarDatatype(vlistID, varID);
if ( nmiss > 0 ) cdfDefVarMissval(streamptr, varID, dtype, 1);
- nvals = gridInqSize(gridID);
+ long nvals = gridInqSize(gridID);
cdf_write_var_data(fileID, vlistID, varID, ncvarid, dtype, nvals, xsize, ysize, swapxy, start, count, memtype, data, nmiss);
@@ -4966,23 +4950,6 @@ void printNCvars(ncvar_t *ncvars, int nvars, const char *oname)
}
}
-typedef struct
-{
- int ncvarid;
- char name[CDI_MAX_NAME];
-}
-varinfo_t;
-
-
-static
-int cmpvarname(const void *s1, const void *s2)
-{
- varinfo_t *x = (varinfo_t *) s1;
- varinfo_t *y = (varinfo_t *) s2;
-
- return (strcmp(x->name, y->name));
-}
-
static
void cdfScanVarAttributes(int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
int timedimid, int modelID, int format)
@@ -5985,7 +5952,6 @@ void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
int ltwarn = TRUE;
size_t attlen;
char attname[CDI_MAX_NAME];
- const int attstringlen = 8192; char attstring[8192];
double datt;
for ( ncvarid = 0; ncvarid < nvars; ++ncvarid )
@@ -6443,6 +6409,11 @@ void define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
if ( strcmp(attname, "grid_mapping_name") == 0 )
{
+ enum {
+ attstringlen = 8192,
+ };
+ char attstring[attstringlen];
+
cdfGetAttText(ncvars[ncvarid].ncid, ncvars[ncvarid].gmapid, attname, attstringlen-1, attstring);
strtolower(attstring);
@@ -6693,7 +6664,6 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
int zdimid = UNDEFID;
int zvarid = UNDEFID;
int zsize = 1;
- double *zvar = NULL;
double *lbounds = NULL;
double *ubounds = NULL;
int zaxisType;
@@ -6715,7 +6685,7 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
if ( CDI_Debug ) Message("nlevs = %d", zsize);
- zvar = (double *)xmalloc((size_t)zsize * sizeof (double));
+ double *zvar = (double *)xmalloc((size_t)zsize * sizeof (double));
zaxisType = UNDEFID;
@@ -6835,50 +6805,53 @@ void define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nva
}
}
+struct varinfo
+{
+ int ncvarid;
+ const char *name;
+};
+
+static
+int cmpvarname(const void *s1, const void *s2)
+{
+ const struct varinfo *x = (const struct varinfo *)s1,
+ *y = (const struct varinfo *)s2;
+ return (strcmp(x->name, y->name));
+}
+
/* define all input data variables */
static
void define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID, int *varids, int nvars, int num_ncvars, ncvar_t *ncvars)
{
- int ncid;
- int varID1, varID, ncvarid;
- int code;
- int tableID;
-
if ( streamptr->sortname )
{
- int index;
- varinfo_t **varInfo;
- varInfo = (varinfo_t **)xmalloc((size_t)nvars * sizeof (varinfo_t *));
- varInfo[0] = (varinfo_t *)xmalloc((size_t)nvars * sizeof (varinfo_t));
-
- for ( index = 1; index < nvars; index++ )
- varInfo[index] = varInfo[0] + index;
+ struct varinfo *varInfo
+ = (struct varinfo *)xmalloc((size_t)nvars * sizeof (struct varinfo));
- for ( varID = 0; varID < nvars; varID++ )
+ for ( int varID = 0; varID < nvars; varID++ )
{
- ncvarid = varids[varID];
- varInfo[varID]->ncvarid = ncvarid;
- strcpy(varInfo[varID]->name, ncvars[ncvarid].name);
+ int ncvarid = varids[varID];
+ varInfo[varID].ncvarid = ncvarid;
+ varInfo[varID].name = ncvars[ncvarid].name;
}
- qsort(varInfo[0], (size_t)nvars, sizeof(varinfo_t), cmpvarname);
- for ( varID = 0; varID < nvars; varID++ )
+ qsort(varInfo, (size_t)nvars, sizeof(varInfo[0]), cmpvarname);
+ for ( int varID = 0; varID < nvars; varID++ )
{
- varids[varID] = varInfo[varID]->ncvarid;
+ varids[varID] = varInfo[varID].ncvarid;
}
- free(varInfo[0]);
free(varInfo);
}
- for ( varID1 = 0; varID1 < nvars; varID1++ )
+ for ( int varID1 = 0; varID1 < nvars; varID1++ )
{
int gridID, zaxisID;
- ncvarid = varids[varID1];
+ int ncvarid = varids[varID1];
gridID = ncvars[ncvarid].gridID;
zaxisID = ncvars[ncvarid].zaxisID;
- varID = stream_new_var(streamptr, gridID, zaxisID);
- varID = vlistDefVar(vlistID, gridID, zaxisID, ncvars[ncvarid].tsteptype);
+ stream_new_var(streamptr, gridID, zaxisID);
+ int varID = vlistDefVar(vlistID, gridID, zaxisID, ncvars[ncvarid].tsteptype);
#if defined (HAVE_NETCDF4)
if ( ncvars[ncvarid].deflate )
@@ -6993,10 +6966,10 @@ void define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID,
}
}
- for ( varID = 0; varID < nvars; varID++ )
+ for ( int varID = 0; varID < nvars; varID++ )
{
- ncvarid = varids[varID];
- ncid = ncvars[ncvarid].ncid;
+ int ncvarid = varids[varID];
+ int ncid = ncvars[ncvarid].ncid;
if ( ncvars[ncvarid].natts )
{
@@ -7052,12 +7025,12 @@ void define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID,
}
/* release mem of not freed attributes */
- for ( ncvarid = 0; ncvarid < num_ncvars; ncvarid++ )
+ for ( int ncvarid = 0; ncvarid < num_ncvars; ncvarid++ )
if ( ncvars[ncvarid].atts ) free(ncvars[ncvarid].atts);
if ( varids ) free(varids);
- for ( varID = 0; varID < nvars; varID++ )
+ for ( int varID = 0; varID < nvars; varID++ )
{
if ( vlistInqVarCode(vlistID, varID) == -varID-1 )
{
@@ -7092,12 +7065,12 @@ void define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID,
}
}
- for ( varID = 0; varID < nvars; varID++ )
+ for ( int varID = 0; varID < nvars; varID++ )
{
- instID = vlistInqVarInstitut(vlistID, varID);
- modelID = vlistInqVarModel(vlistID, varID);
- tableID = vlistInqVarTable(vlistID, varID);
- code = vlistInqVarCode(vlistID, varID);
+ int instID = vlistInqVarInstitut(vlistID, varID);
+ int modelID = vlistInqVarModel(vlistID, varID);
+ int tableID = vlistInqVarTable(vlistID, varID);
+ int code = vlistInqVarCode(vlistID, varID);
if ( cdiDefaultTableID != UNDEFID )
{
if ( tableInqParNamePtr(cdiDefaultTableID, code) )
@@ -7130,12 +7103,15 @@ void define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID,
}
static
-void scan_global_attributes(int fileID, int vlistID, stream_t *streamptr, int ngatts, int *instID, int *modelID, int *ucla_les, unsigned char *uuidOfHGrid, unsigned char *uuidOfVGrid, char *gridfile, int *number_of_grid_used, char *fcreftime)
+void scan_global_attributes(int fileID, int vlistID, stream_t *streamptr, int ngatts, int *instID, int *modelID, int *ucla_les, unsigned char *uuidOfHGrid, unsigned char *uuidOfVGrid, char *gridfile, int *number_of_grid_used)
{
nc_type xtype;
size_t attlen;
char attname[CDI_MAX_NAME];
- const int attstringlen = 8192; char attstring[8192];
+ enum {
+ attstringlen = 8192,
+ };
+ char attstring[attstringlen];
int iatt;
for ( iatt = 0; iatt < ngatts; iatt++ )
@@ -7253,9 +7229,8 @@ static
int find_leadtime(int nvars, ncvar_t *ncvars)
{
int leadtime_id = UNDEFID;
- int ncvarid;
- for ( ncvarid = 0; ncvarid < nvars; ncvarid++ )
+ for ( int ncvarid = 0; ncvarid < nvars; ncvarid++ )
{
if ( ncvars[ncvarid].stdname[0] )
{
@@ -7383,12 +7358,10 @@ int cdfInqContents(stream_t *streamptr)
int ndims, nvars, ngatts, unlimdimid;
int ncvarid;
int ncdimid;
- int fileID;
size_t ntsteps;
int timedimid = -1;
int *varids;
int nvarids;
- const int attstringlen = 8192; char attstring[8192];
int time_has_units = FALSE;
int time_has_bounds = FALSE;
int time_climatology = FALSE;
@@ -7404,7 +7377,6 @@ int cdfInqContents(stream_t *streamptr)
int calendar = UNDEFID;
ncdim_t *ncdims;
ncvar_t *ncvars = NULL;
- int vlistID;
int format = 0;
int ucla_les = FALSE;
unsigned char uuidOfHGrid[CDI_UUID_SIZE];
@@ -7418,8 +7390,8 @@ int cdfInqContents(stream_t *streamptr)
gridfile[0] = 0;
fcreftime[0] = 0;
- vlistID = streamptr->vlistID;
- fileID = streamptr->fileID;
+ int vlistID = streamptr->vlistID;
+ int fileID = streamptr->fileID;
if ( CDI_Debug ) Message("streamID = %d, fileID = %d", streamptr->self, fileID);
@@ -7487,7 +7459,7 @@ int cdfInqContents(stream_t *streamptr)
/* scan global attributes */
scan_global_attributes(fileID, vlistID, streamptr, ngatts, &instID, &modelID, &ucla_les,
- uuidOfHGrid, uuidOfVGrid, gridfile, &number_of_grid_used, fcreftime);
+ uuidOfHGrid, uuidOfVGrid, gridfile, &number_of_grid_used);
/* find time dim */
if ( unlimdimid >= 0 )
@@ -7813,6 +7785,11 @@ int cdfInqContents(stream_t *streamptr)
if ( ncvarid != UNDEFID )
if ( ncvars[ncvarid].calendar == TRUE )
{
+ enum {
+ attstringlen = 8192,
+ };
+ char attstring[attstringlen];
+
cdfGetAttText(fileID, ncvarid, "calendar", attstringlen-1, attstring);
strtolower(attstring);
@@ -8106,13 +8083,12 @@ static void cdfDefSource(stream_t *streamptr)
static void cdfDefGlobalAtts(stream_t *streamptr)
{
- int fileID, vlistID;
int natts;
if ( streamptr->globalatts ) return;
- vlistID = streamptr->vlistID;
- fileID = streamptr->fileID;
+ int vlistID = streamptr->vlistID;
+ int fileID = streamptr->fileID;
cdfDefSource(streamptr);
cdfDefInstitut(streamptr);
@@ -8188,31 +8164,31 @@ void cdfInqHistoryString(stream_t *streamptr, char *history)
void cdfDefVars(stream_t *streamptr)
{
- int index, gridID, zaxisID, vlistID;
- int ngrids, nzaxis;
/* int nvars, ncvarid; */
- vlistID = streamptr->vlistID;
+ int vlistID = streamptr->vlistID;
if ( vlistID == UNDEFID )
Error("Internal problem! vlist undefined for streamptr %p", streamptr);
/* nvars = vlistNvars(vlistID); */
- ngrids = vlistNgrids(vlistID);
- nzaxis = vlistNzaxis(vlistID);
+ int ngrids = vlistNgrids(vlistID);
+ int nzaxis = vlistNzaxis(vlistID);
/*
if ( vlistHasTime(vlistID) ) cdfDefTime(streamptr);
*/
- for ( index = 0; index < ngrids; index++ )
- {
- gridID = vlistGrid(vlistID, index);
- cdfDefGrid(streamptr, gridID);
- }
+ if (ngrids > 0)
+ for (size_t index = 0; index < (size_t)ngrids; index++ )
+ {
+ int gridID = vlistGrid(vlistID, (int)index);
+ cdfDefGrid(streamptr, gridID);
+ }
- for ( index = 0; index < nzaxis; index++ )
- {
- zaxisID = vlistZaxis(vlistID, index);
- if ( streamptr->zaxisID[index] == UNDEFID ) cdfDefZaxis(streamptr, zaxisID);
- }
+ if (nzaxis > 0)
+ for (size_t index = 0; index < (size_t)nzaxis; index++ )
+ {
+ int zaxisID = vlistZaxis(vlistID, (int)index);
+ if ( streamptr->zaxisID[index] == UNDEFID ) cdfDefZaxis(streamptr, zaxisID);
+ }
/*
define time first!!!
for (varID = 0; varID < nvars; varID++ )
diff --git a/libcdi/src/stream_cgribex.c b/libcdi/src/stream_cgribex.c
index 767d599..5e8dede 100644
--- a/libcdi/src/stream_cgribex.c
+++ b/libcdi/src/stream_cgribex.c
@@ -521,35 +521,62 @@ compvar_t cgribexVarSet(int param, int level1, int level2, int leveltype, int tr
return (compVar);
}
-static
-int cgribexVarCompare(compvar_t compVar, record_t record, int flag)
+static inline int
+cgribexVarCompare(compvar_t compVar, record_t record, int flag)
{
- compvar_t compVar0;
+ int tstepDiff = (!((flag == 0) & (((compVar.tsteptype == TSTEP_INSTANT)
+ & (record.tsteptype == TSTEP_INSTANT3))
+ |((compVar.tsteptype == TSTEP_INSTANT3)
+ & (record.tsteptype == TSTEP_INSTANT)))))
+ & (compVar.tsteptype != record.tsteptype);
+ int rstatus = (compVar.param != record.param)
+ | (compVar.level1 != record.ilevel)
+ | (compVar.level2 != record.ilevel2)
+ | (compVar.ltype != record.ltype)
+ | tstepDiff;
+ return (rstatus);
+}
+#endif
- compVar0.param = record.param;
- compVar0.level1 = record.ilevel;
- compVar0.level2 = record.ilevel2;
- compVar0.ltype = record.ltype;
- compVar0.tsteptype = record.tsteptype;
+#define gribWarning(text, nrecs, timestep, paramstr, level1, level2) \
+ Warning("Record %2d (id=%s lev1=%d lev2=%d) timestep %d: %s", nrecs, paramstr, level1, level2, timestep, text)
- if ( flag == 0 )
+#if defined (HAVE_LIBCGRIBEX)
+
+static inline void
+cgribexScanTsFixNtsteps(stream_t *streamptr, off_t recpos)
+{
+ if ( streamptr->ntsteps == -1 )
{
- if ( compVar0.tsteptype == TSTEP_INSTANT && compVar.tsteptype == TSTEP_INSTANT3 ) compVar0.tsteptype = TSTEP_INSTANT3;
- if ( compVar0.tsteptype == TSTEP_INSTANT3 && compVar.tsteptype == TSTEP_INSTANT ) compVar0.tsteptype = TSTEP_INSTANT;
- }
+ int tsID = tstepsNewEntry(streamptr);
+ if ( tsID != streamptr->rtsteps )
+ Error("Internal error. tsID = %d", tsID);
- int rstatus = memcmp(&compVar0, &compVar, sizeof(compvar_t));
+ streamptr->tsteps[tsID-1].next = TRUE;
+ streamptr->tsteps[tsID].position = recpos;
+ }
+}
- return (rstatus);
+static inline void
+cgribexScanTsConstAdjust(stream_t *streamptr, taxis_t *taxis)
+{
+ int vlistID = streamptr->vlistID;
+ if ( streamptr->ntsteps == 1 )
+ {
+ if ( taxis->vdate == 0 && taxis->vtime == 0 )
+ {
+ streamptr->ntsteps = 0;
+ for (int varID = 0; varID < streamptr->nvars; varID++ )
+ {
+ vlistDefVarTsteptype(vlistID, varID, TSTEP_CONSTANT);
+ }
+ }
+ }
}
-#endif
-#define gribWarning(text, nrecs, timestep, paramstr, level1, level2) \
- Warning("Record %2d (id=%s lev1=%d lev2=%d) timestep %d: %s", nrecs, paramstr, level1, level2, timestep, text)
int cgribexScanTimestep1(stream_t * streamptr)
{
-#if defined (HAVE_LIBCGRIBEX)
int *isec0, *isec1, *isec2, *isec3, *isec4;
double fsec2[512], fsec3[2], *fsec4 = NULL;
int lmv = 0, iret = 0;
@@ -562,7 +589,6 @@ int cgribexScanTimestep1(stream_t * streamptr)
int level1 = 0, level2 = 0, vdate = 0, vtime = 0;
DateTime datetime, datetime0;
int tsID;
- int varID;
size_t readsize;
unsigned nrecords, recID;
int nrecs_scanned = 0;
@@ -576,7 +602,6 @@ int cgribexScanTimestep1(stream_t * streamptr)
int vlistID;
int comptype;
long unzipsize;
- compvar_t compVar;
char paramstr[32];
extern int cdiSkipRecords;
int nskip = cdiSkipRecords;
@@ -624,7 +649,7 @@ int cgribexScanTimestep1(stream_t * streamptr)
if ( (size_t)recsize > buffersize )
{
buffersize = (size_t)recsize;
- gribbuffer = (unsigned char *) realloc(gribbuffer, buffersize);
+ gribbuffer = (unsigned char *)xrealloc(gribbuffer, buffersize);
}
readsize = (size_t)recsize;
@@ -676,7 +701,7 @@ int cgribexScanTimestep1(stream_t * streamptr)
datetime.date = vdate;
datetime.time = vtime;
- compVar = cgribexVarSet(param, level1, level2, ISEC1_LevelType, ISEC1_TimeRange);
+ compvar_t compVar = cgribexVarSet(param, level1, level2, ISEC1_LevelType, ISEC1_TimeRange);
for ( recID = 0; recID < nrecs; recID++ )
{
@@ -770,30 +795,8 @@ int cgribexScanTimestep1(stream_t * streamptr)
streamptr->record->buffer = gribbuffer;
streamptr->record->buffersize = (size_t)buffersize;
- if ( streamptr->ntsteps == -1 )
- {
- tsID = tstepsNewEntry(streamptr);
- if ( tsID != streamptr->rtsteps )
- Error("Internal error. tsID = %d", tsID);
-
- streamptr->tsteps[tsID-1].next = TRUE;
- streamptr->tsteps[tsID].position = recpos;
- }
-
- if ( streamptr->ntsteps == 1 )
- {
- if ( taxis->vdate == 0 && taxis->vtime == 0 )
- {
- streamptr->ntsteps = 0;
- for ( varID = 0; varID < streamptr->nvars; varID++ )
- {
- vlistDefVarTsteptype(vlistID, varID, TSTEP_CONSTANT);
- }
- }
- }
-#else
- Error("CGRIBEX support not compiled in!");
-#endif
+ cgribexScanTsFixNtsteps(streamptr, recpos);
+ cgribexScanTsConstAdjust(streamptr, taxis);
return (0);
}
@@ -802,7 +805,6 @@ int cgribexScanTimestep1(stream_t * streamptr)
int cgribexScanTimestep2(stream_t * streamptr)
{
int rstatus = 0;
-#if defined (HAVE_LIBCGRIBEX)
int *isec0, *isec1, *isec2, *isec3, *isec4;
double fsec2[512], fsec3[2], *fsec4 = NULL;
int lmv = 0, iret = 0;
@@ -825,7 +827,6 @@ int cgribexScanTimestep2(stream_t * streamptr)
taxis_t *taxis;
int vlistID;
long unzipsize;
- compvar_t compVar;
char paramstr[32];
streamptr->curTsID = 1;
@@ -845,7 +846,7 @@ int cgribexScanTimestep2(stream_t * streamptr)
tsID = streamptr->rtsteps;
if ( tsID != 1 )
- Error("Internal problem! unexpeceted timestep %d", tsID+1);
+ Error("Internal problem! unexpected timestep %d", tsID+1);
taxis = &streamptr->tsteps[tsID].taxis;
@@ -882,7 +883,7 @@ int cgribexScanTimestep2(stream_t * streamptr)
if ( (size_t)recsize > buffersize )
{
buffersize = (size_t)recsize;
- gribbuffer = (unsigned char *) realloc(gribbuffer, buffersize);
+ gribbuffer = (unsigned char *)xrealloc(gribbuffer, buffersize);
}
readsize = (size_t)recsize;
@@ -955,7 +956,7 @@ int cgribexScanTimestep2(stream_t * streamptr)
datetime.date = vdate;
datetime.time = vtime;
- compVar = cgribexVarSet(param, level1, level2, ISEC1_LevelType, ISEC1_TimeRange);
+ compvar_t compVar = cgribexVarSet(param, level1, level2, ISEC1_LevelType, ISEC1_TimeRange);
for ( recID = 0; recID < nrecords; recID++ )
{
@@ -1043,28 +1044,20 @@ int cgribexScanTimestep2(stream_t * streamptr)
streamptr->rtsteps = 2;
- if ( streamptr->ntsteps == -1 )
- {
- tsID = tstepsNewEntry(streamptr);
- if ( tsID != streamptr->rtsteps )
- Error("Internal error. tsID = %d", tsID);
-
- streamptr->tsteps[tsID-1].next = TRUE;
- streamptr->tsteps[tsID].position = recpos;
- }
+ cgribexScanTsFixNtsteps(streamptr, recpos);
streamptr->record->buffer = gribbuffer;
streamptr->record->buffersize = buffersize;
-#endif
return (rstatus);
}
+#endif
+#if defined (HAVE_LIBCGRIBEX)
int cgribexScanTimestep(stream_t * streamptr)
{
int rstatus = 0;
-#if defined (HAVE_LIBCGRIBEX)
double fsec2[512], fsec3[2], *fsec4 = NULL;
int lmv = 0, iret = 0;
long recsize = 0;
@@ -1082,7 +1075,6 @@ int cgribexScanTimestep(stream_t * streamptr)
int rindex, nrecs = 0;
int nrecs_scanned;
long unzipsize;
- compvar_t compVar;
char paramstr[32];
/*
@@ -1219,7 +1211,7 @@ int cgribexScanTimestep(stream_t * streamptr)
datetime.date = vdate;
datetime.time = vtime;
- compVar = cgribexVarSet(param, level1, level2, ISEC1_LevelType, ISEC1_TimeRange);
+ compvar_t compVar = cgribexVarSet(param, level1, level2, ISEC1_LevelType, ISEC1_TimeRange);
for ( vrecID = 0; vrecID < nrecs; vrecID++ )
{
@@ -1321,20 +1313,20 @@ int cgribexScanTimestep(stream_t * streamptr)
}
rstatus = (int)streamptr->ntsteps;
-#endif
return (rstatus);
}
+#endif
#ifdef gribWarning
#undef gribWarning
#endif
+#if defined (HAVE_LIBCGRIBEX)
int cgribexDecode(unsigned char *gribbuffer, int gribsize, double *data, int gridsize,
int unreduced, int *nmiss, double missval)
{
int status = 0;
-#if defined (HAVE_LIBCGRIBEX)
int iret = 0, iword = 0;
int isec0[2], isec1[4096], isec2[4096], isec3[2], isec4[512];
double fsec2[512], fsec3[2];
@@ -1367,12 +1359,11 @@ int cgribexDecode(unsigned char *gribbuffer, int gribsize, double *data, int gri
(*nmiss)++;
}
}
-#else
- Error("CGRIBEX support not compiled in!");
-#endif
return (status);
}
+#endif
+
#if defined (HAVE_LIBCGRIBEX)
static
@@ -1728,19 +1719,19 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
ISEC2_NumLon = nlon;
ISEC2_NumLat = nlat;
- ISEC2_FirstLat = lround(yfirst*1000);
- ISEC2_LastLat = lround(ylast*1000);
+ ISEC2_FirstLat = (int)lround(yfirst*1000);
+ ISEC2_LastLat = (int)lround(ylast*1000);
if ( gridtype == GRID_GAUSSIAN_REDUCED )
{
ISEC2_FirstLon = 0;
- ISEC2_LastLon = lround(1000*(360.-360./(nlat*2)));
- ISEC2_LonIncr = lround(1000*360./(nlat*2));
+ ISEC2_LastLon = (int)lround(1000*(360.-360./(nlat*2)));
+ ISEC2_LonIncr = (int)lround(1000*360./(nlat*2));
}
else
{
- ISEC2_FirstLon = lround(xfirst*1000);
- ISEC2_LastLon = lround(xlast*1000);
- ISEC2_LonIncr = lround(xinc*1000);
+ ISEC2_FirstLon = (int)lround(xfirst*1000);
+ ISEC2_LastLon = (int)lround(xlast*1000);
+ ISEC2_LonIncr = (int)lround(xinc*1000);
}
// if ( fabs(xinc*1000 - ISEC2_LonIncr) > FLT_EPSILON ) ISEC2_LonIncr = 0;
@@ -1753,7 +1744,7 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
}
else
{
- ISEC2_LatIncr = lround(yinc*1000);
+ ISEC2_LatIncr = (int)lround(yinc*1000);
// if ( fabs(yinc*1000 - ISEC2_LatIncr) > FLT_EPSILON ) ISEC2_LatIncr = 0;
if ( ISEC2_LatIncr < 0 ) ISEC2_LatIncr = -ISEC2_LatIncr;
@@ -1772,8 +1763,8 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
if ( gridIsRotated(gridID) )
{
- ISEC2_LatSP = - lround(gridInqYpole(gridID) * 1000);
- ISEC2_LonSP = lround((gridInqXpole(gridID) + 180) * 1000);
+ ISEC2_LatSP = - (int)lround(gridInqYpole(gridID) * 1000);
+ ISEC2_LonSP = (int)lround((gridInqXpole(gridID) + 180) * 1000);
}
/* East -> West */
@@ -1799,13 +1790,13 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
ISEC2_GridType = GRIB1_GTYPE_LCC;
ISEC2_NumLon = xsize;
ISEC2_NumLat = ysize;
- ISEC2_FirstLon = lround(originLon * 1000);
- ISEC2_FirstLat = lround(originLat * 1000);
- ISEC2_Lambert_Lov = lround(lonParY * 1000);
- ISEC2_Lambert_LatS1 = lround(lat1 * 1000);
- ISEC2_Lambert_LatS2 = lround(lat2 * 1000);
- ISEC2_Lambert_dx = lround(xincm);
- ISEC2_Lambert_dy = lround(yincm);
+ ISEC2_FirstLon = (int)lround(originLon * 1000);
+ ISEC2_FirstLat = (int)lround(originLat * 1000);
+ ISEC2_Lambert_Lov = (int)lround(lonParY * 1000);
+ ISEC2_Lambert_LatS1 = (int)lround(lat1 * 1000);
+ ISEC2_Lambert_LatS2 = (int)lround(lat2 * 1000);
+ ISEC2_Lambert_dx = (int)lround(xincm);
+ ISEC2_Lambert_dy = (int)lround(yincm);
ISEC2_Lambert_LatSP = 0;
ISEC2_Lambert_LatSP = 0;
ISEC2_Lambert_ProjFlag = projflag;
@@ -2176,12 +2167,12 @@ void cgribexDefEnsembleVar(int *isec1, int vlistID, int varID)
#endif
+#if defined (HAVE_LIBCGRIBEX)
size_t cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridID, int zaxisID,
int vdate, int vtime, int tsteptype, int numavg,
long datasize, const double *data, int nmiss, unsigned char *gribbuffer, size_t gribbuffersize)
{
size_t nbytes = 0;
-#if defined (HAVE_LIBCGRIBEX)
int gribsize;
int iret = 0, iword = 0;
int isec0[2], isec1[4096], isec2[4096], isec3[2], isec4[512];
@@ -2232,8 +2223,9 @@ size_t cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridI
if ( memtype == MEMTYPE_FLOAT )
{
- for ( int i = 0; i < ISEC2_NumVCP; ++i ) fsec2f[10+i] = fsec2[10+i];
- fsec3f[ 1] = fsec3[ 1];
+ size_t numVCP = ISEC2_NumVCP > 0 ? (size_t)ISEC2_NumVCP : (size_t)0;
+ for ( size_t i = 0; i < numVCP; ++i ) fsec2f[10+i] = (float)fsec2[10+i];
+ fsec3f[ 1] = (float)fsec3[ 1];
}
if ( memtype == MEMTYPE_FLOAT )
@@ -2246,12 +2238,9 @@ size_t cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridI
if ( iret ) Error("Problem during GRIB encode (errno = %d)!", iret);
nbytes = (size_t)iword * sizeof (int);
-#else
- Error("CGRIBEX support not compiled in!");
-#endif
-
return (nbytes);
}
+#endif
/*
* Local Variables:
* c-file-style: "Java"
diff --git a/libcdi/src/stream_ext.c b/libcdi/src/stream_ext.c
index 088e807..a12b556 100644
--- a/libcdi/src/stream_ext.c
+++ b/libcdi/src/stream_ext.c
@@ -411,7 +411,7 @@ int extScanTimestep2(stream_t *streamptr)
tsID = streamptr->rtsteps;
if ( tsID != 1 )
- Error("Internal problem! unexpeceted timestep %d", tsID+1);
+ Error("Internal problem! unexpected timestep %d", tsID+1);
taxis = &streamptr->tsteps[tsID].taxis;
diff --git a/libcdi/src/stream_grb.c b/libcdi/src/stream_grb.c
index 42b03af..a4ef190 100644
--- a/libcdi/src/stream_grb.c
+++ b/libcdi/src/stream_grb.c
@@ -230,7 +230,7 @@ int grbUnzipRecord(unsigned char *gribbuffer, size_t *gribsize)
igribsize = *gribsize;
ogribsize = *gribsize;
- if ( (izip = gribGetZip(igribsize, gribbuffer, &unzipsize)) > 0 )
+ if ( (izip = gribGetZip((long)igribsize, gribbuffer, &unzipsize)) > 0 )
{
zip = izip;
if ( izip == 128 ) /* szip */
@@ -254,7 +254,7 @@ int grbUnzipRecord(unsigned char *gribbuffer, size_t *gribsize)
unzipsize += 100; /* need 0 to 1 bytes for rounding of bds */
- ogribsize = gribUnzip(gribbuffer, unzipsize, itmpbuffer, igribsize);
+ ogribsize = (size_t)gribUnzip(gribbuffer, unzipsize, itmpbuffer, (long)igribsize);
free(itmpbuffer);
@@ -547,6 +547,7 @@ size_t grbEncode(int filetype, int memtype, int varID, int levelID, int vlistID,
#else
Error("GRIB_API support not compiled in!");
(void)gribContainer;
+ (void)comptype;
#endif
diff --git a/libcdi/src/stream_gribapi.c b/libcdi/src/stream_gribapi.c
index 7123ed8..1da92db 100644
--- a/libcdi/src/stream_gribapi.c
+++ b/libcdi/src/stream_gribapi.c
@@ -1511,7 +1511,7 @@ int gribapiScanTimestep2(stream_t * streamptr)
tsID = streamptr->rtsteps;
if ( tsID != 1 )
- Error("Internal problem! unexpeceted timestep %d", tsID+1);
+ Error("Internal problem! unexpected timestep %d", tsID+1);
taxis = &streamptr->tsteps[tsID].taxis;
@@ -3092,11 +3092,10 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
#ifdef HAVE_LIBGRIB_API
size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID,
- int vdate, int vtime, int tsteptype, int numavg,
+ int vdate, int vtime, int tsteptype, int numavg,
long datasize, const double *data, int nmiss, unsigned char **gribbuffer, size_t *gribbuffersize,
int comptype, void *gribContainer)
{
- size_t nbytes = 0;
size_t recsize = 0;
void *dummy = NULL;
int datatype;
@@ -3108,7 +3107,6 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
long bitsPerValue;
long editionNumber = 2;
char name[256];
- grib_handle *gh = NULL;
gribContainer_t *gc = (gribContainer_t *) gribContainer;
// extern unsigned char _grib_template_GRIB2[];
@@ -3120,11 +3118,10 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
vlistInqVarName(vlistID, varID, name);
#if defined(GRIBAPIENCODETEST)
- gh = (grib_handle *) gribHandleNew(editionNumber);
+ grib_handle *gh = (grib_handle *) gribHandleNew(editionNumber);
#else
- gh = gc->gribHandle;
+ grib_handle *gh = gc->gribHandle;
#endif
-
GRIB_CHECK(grib_get_long(gh, "editionNumber", &editionNumber), 0);
if ( editionNumber == 2 )
@@ -3166,15 +3163,15 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
/* Local change: 2013-01-28, FP (DWD) */
/* ---------------------------------- */
- vlist_t *vlistptr;
- vlistptr = vlist_to_pointer(vlistID);
+ vlist_t *vlistptr = vlist_to_pointer(vlistID);
//if (!gc->init)
{
- for (int i=0; i<vlistptr->vars[varID].opt_grib_dbl_nentries; i++)
+ for ( int i=0; i<vlistptr->vars[varID].opt_grib_dbl_nentries; i++ )
{
if ( vlistptr->vars[varID].opt_grib_dbl_update[i] )
{
- vlistptr->vars[varID].opt_grib_dbl_update[i] = FALSE;
+ //DR: Fix for multi-level fields (otherwise only the 1st level is correct)
+ if ( zaxisInqSize(zaxisID)==(levelID+1) ) vlistptr->vars[varID].opt_grib_dbl_update[i] = FALSE;
int ret = my_grib_set_double(gh, vlistptr->vars[varID].opt_grib_dbl_keyword[i],
vlistptr->vars[varID].opt_grib_dbl_val[i]);
if (ret != 0) {
@@ -3185,11 +3182,12 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
GRIB_CHECK(ret, 0);
}
}
- for (int i=0; i<vlistptr->vars[varID].opt_grib_int_nentries; i++)
+ for ( int i=0; i<vlistptr->vars[varID].opt_grib_int_nentries; i++ )
{
if ( vlistptr->vars[varID].opt_grib_int_update[i] )
{
- vlistptr->vars[varID].opt_grib_int_update[i] = FALSE;
+ //DR: Fix for multi-level fields (otherwise only the 1st level is correct)
+ if ( zaxisInqSize(zaxisID)==(levelID+1) ) vlistptr->vars[varID].opt_grib_int_update[i] = FALSE;
int ret = my_grib_set_long(gh, vlistptr->vars[varID].opt_grib_int_keyword[i],
vlistptr->vars[varID].opt_grib_int_val[i]);
if (ret != 0) {
@@ -3226,9 +3224,7 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
gc->init = TRUE;
- nbytes = recsize;
-
- return (nbytes);
+ return (recsize);
}
#endif
diff --git a/libcdi/src/stream_ieg.c b/libcdi/src/stream_ieg.c
index e734dfa..efa4809 100644
--- a/libcdi/src/stream_ieg.c
+++ b/libcdi/src/stream_ieg.c
@@ -241,7 +241,7 @@ int calc_resfac(double xfirst, double xlast, double xinc, double yfirst, double
ifact = ifacarr[j];
for ( i = 0; i < 6; ++i )
{
- if ( fabs(vals[i]*ifact-(lround(vals[i]*ifact))) > FLT_EPSILON ) break;
+ if ( fabs(vals[i]*ifact - round(vals[i]*ifact)) > FLT_EPSILON ) break;
}
if ( i == 6 )
{
@@ -292,12 +292,11 @@ void iegDefGrid(int *gdb, int gridID)
if ( gridtype == GRID_LONLAT || gridtype == GRID_GAUSSIAN )
{
- int nlon, nlat;
double xfirst = 0, xlast = 0, xinc = 0;
double yfirst = 0, ylast = 0, yinc = 0;
- nlon = (int) gridInqXsize(gridID);
- nlat = (int) gridInqYsize(gridID);
+ int nlon = gridInqXsize(gridID),
+ nlat = gridInqYsize(gridID);
if ( nlon == 0 )
{
@@ -336,11 +335,11 @@ void iegDefGrid(int *gdb, int gridID)
IEG_G_NumLon(gdb) = nlon;
IEG_G_NumLat(gdb) = nlat;
- IEG_G_FirstLat(gdb) = lround(yfirst*resfac);
- IEG_G_LastLat(gdb) = lround(ylast*resfac);
- IEG_G_FirstLon(gdb) = lround(xfirst*resfac);
- IEG_G_LastLon(gdb) = lround(xlast*resfac);
- IEG_G_LonIncr(gdb) = lround(xinc*resfac);
+ IEG_G_FirstLat(gdb) = (int)lround(yfirst*resfac);
+ IEG_G_LastLat(gdb) = (int)lround(ylast*resfac);
+ IEG_G_FirstLon(gdb) = (int)lround(xfirst*resfac);
+ IEG_G_LastLon(gdb) = (int)lround(xlast*resfac);
+ IEG_G_LonIncr(gdb) = (int)lround(xinc*resfac);
if ( fabs(xinc*resfac - IEG_G_LonIncr(gdb)) > FLT_EPSILON )
IEG_G_LonIncr(gdb) = 0;
@@ -348,7 +347,7 @@ void iegDefGrid(int *gdb, int gridID)
IEG_G_LatIncr(gdb) = nlat/2;
else
{
- IEG_G_LatIncr(gdb) = lround(yinc*resfac);
+ IEG_G_LatIncr(gdb) = (int)lround(yinc*resfac);
if ( fabs(yinc*resfac - IEG_G_LatIncr(gdb)) > FLT_EPSILON )
IEG_G_LatIncr(gdb) = 0;
@@ -368,8 +367,8 @@ void iegDefGrid(int *gdb, int gridID)
if ( gridIsRotated(gridID) )
{
- IEG_G_LatSP(gdb) = - lround(gridInqYpole(gridID) * resfac);
- IEG_G_LonSP(gdb) = lround((gridInqXpole(gridID) + 180) * resfac);
+ IEG_G_LatSP(gdb) = - (int)lround(gridInqYpole(gridID) * resfac);
+ IEG_G_LonSP(gdb) = (int)lround((gridInqXpole(gridID) + 180) * resfac);
IEG_G_Size(gdb) = 42;
}
else
@@ -997,7 +996,7 @@ int iegScanTimestep2(stream_t *streamptr)
tsID = streamptr->rtsteps;
if ( tsID != 1 )
- Error("Internal problem! unexpeceted timestep %d", tsID+1);
+ Error("Internal problem! unexpected timestep %d", tsID+1);
taxis = &streamptr->tsteps[tsID].taxis;
diff --git a/libcdi/src/stream_record.c b/libcdi/src/stream_record.c
index 861e803..86cc640 100644
--- a/libcdi/src/stream_record.c
+++ b/libcdi/src/stream_record.c
@@ -98,21 +98,16 @@ void cdiInitRecord(stream_t *streamptr)
{
streamptr->record = (Record *) malloc(sizeof(Record));
- streamptr->record->used = 0;
- streamptr->record->nrec = 0;
- streamptr->record->dataread = 1;
streamptr->record->param = 0;
streamptr->record->level = 0;
streamptr->record->date = 0;
streamptr->record->time = 0;
streamptr->record->gridID = 0;
- streamptr->record->zaxisID = 0;
streamptr->record->buffer = NULL;
streamptr->record->buffersize = 0;
streamptr->record->position = 0;
streamptr->record->varID = 0;
streamptr->record->levelID = CDI_UNDEFID;
- streamptr->record->recid = 0;
}
@@ -193,7 +188,6 @@ void streamDefRecord(int streamID, int varID, int levelID)
streamptr->record->date = streamptr->tsteps[tsID].taxis.vdate;
streamptr->record->time = streamptr->tsteps[tsID].taxis.vtime;
streamptr->record->gridID = gridID;
- streamptr->record->zaxisID = zaxisID;
streamptr->record->prec = vlistInqVarDatatype(vlistID, varID);
switch (streamptr->filetype)
diff --git a/libcdi/src/stream_srv.c b/libcdi/src/stream_srv.c
index 25fd4ca..6e2d2e2 100644
--- a/libcdi/src/stream_srv.c
+++ b/libcdi/src/stream_srv.c
@@ -418,7 +418,7 @@ int srvScanTimestep2(stream_t *streamptr)
tsID = streamptr->rtsteps;
if ( tsID != 1 )
- Error("Internal problem! unexpeceted timestep %d", tsID+1);
+ Error("Internal problem! unexpected timestep %d", tsID+1);
taxis = &streamptr->tsteps[tsID].taxis;
diff --git a/libcdi/src/taxis.c b/libcdi/src/taxis.c
index 585e206..ebe1d51 100644
--- a/libcdi/src/taxis.c
+++ b/libcdi/src/taxis.c
@@ -217,13 +217,6 @@ void taxis_copy(taxis_t *taxisptr2, taxis_t *taxisptr1)
}
#endif
-static
-void taxis_check_ptr(const char *caller, taxis_t *taxisptr)
-{
- if ( taxisptr == NULL )
- Errorc("taxis undefined!");
-}
-
/*
@Function taxisCreate
@Title Create a Time axis
@@ -276,7 +269,6 @@ int taxisCreate(int taxistype)
void taxisDestroyKernel(taxis_t *taxisptr)
{
- taxis_check_ptr(__func__, taxisptr);
int id = taxisptr->self;
delete_refcount_string(taxisptr->name);
delete_refcount_string(taxisptr->longname);
@@ -328,8 +320,6 @@ void taxisDefType(int taxisID, int type)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->type != type)
{
taxisptr->type = type;
@@ -355,8 +345,6 @@ void taxisDefVdate(int taxisID, int vdate)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->vdate != vdate)
{
taxisptr->vdate = vdate;
@@ -382,8 +370,6 @@ void taxisDefVtime(int taxisID, int vtime)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->vtime != vtime)
{
taxisptr->vtime = vtime;
@@ -409,8 +395,6 @@ void taxisDefRdate(int taxisID, int rdate)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->rdate != rdate)
{
taxisptr->rdate = rdate;
@@ -436,8 +420,6 @@ void taxisDefRtime(int taxisID, int rtime)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->rtime != rtime)
{
taxisptr->rtime = rtime;
@@ -463,8 +445,6 @@ void taxisDefFdate(int taxisID, int fdate)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->fdate != fdate)
{
taxisptr->fdate = fdate;
@@ -490,8 +470,6 @@ void taxisDefFtime(int taxisID, int ftime)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->ftime != ftime)
{
taxisptr->ftime = ftime;
@@ -519,8 +497,6 @@ void taxisDefCalendar(int taxisID, int calendar)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->calendar != calendar)
{
taxisptr->calendar = calendar;
@@ -533,8 +509,6 @@ void taxisDefTunit(int taxisID, int unit)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->unit != unit)
{
taxisptr->unit = unit;
@@ -547,8 +521,6 @@ void taxisDefForecastTunit(int taxisID, int unit)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->fc_unit != unit)
{
taxisptr->fc_unit = unit;
@@ -561,8 +533,6 @@ void taxisDefForecastPeriod(int taxisID, double fc_period)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->fc_period != fc_period)
{
taxisptr->fc_period = fc_period;
@@ -575,8 +545,6 @@ void taxisDefNumavg(int taxisID, int numavg)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->numavg != numavg)
{
taxisptr->numavg = numavg;
@@ -592,8 +560,6 @@ int taxisInqType(int taxisID)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->type);
}
@@ -602,8 +568,6 @@ int taxisHasBounds(int taxisID)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->has_bounds);
}
@@ -612,8 +576,6 @@ void taxisDeleteBounds(int taxisID)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->has_bounds != FALSE)
{
taxisptr->has_bounds = FALSE;
@@ -627,9 +589,6 @@ void taxisCopyTimestep(int taxisID2, int taxisID1)
taxis_t *taxisptr1 = (taxis_t *)reshGetVal(taxisID1, &taxisOps),
*taxisptr2 = (taxis_t *)reshGetVal(taxisID2, &taxisOps);
- taxis_check_ptr(__func__, taxisptr1);
- taxis_check_ptr(__func__, taxisptr2);
-
reshLock();
taxisptr2->rdate = taxisptr1->rdate;
@@ -676,8 +635,6 @@ int taxisInqVdate(int taxisID)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->vdate);
}
@@ -686,8 +643,6 @@ void taxisInqVdateBounds(int taxisID, int *vdate_lb, int *vdate_ub)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
*vdate_lb = taxisptr->vdate_lb;
*vdate_ub = taxisptr->vdate_ub;
}
@@ -697,8 +652,6 @@ void taxisDefVdateBounds(int taxisID, int vdate_lb, int vdate_ub)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->vdate_lb != vdate_lb
|| taxisptr->vdate_ub != vdate_ub
|| taxisptr->has_bounds != TRUE)
@@ -730,8 +683,6 @@ int taxisInqVtime(int taxisID)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->vtime);
}
@@ -740,8 +691,6 @@ void taxisInqVtimeBounds(int taxisID, int *vtime_lb, int *vtime_ub)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
*vtime_lb = taxisptr->vtime_lb;
*vtime_ub = taxisptr->vtime_ub;
}
@@ -751,8 +700,6 @@ void taxisDefVtimeBounds(int taxisID, int vtime_lb, int vtime_ub)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
if (taxisptr->vtime_lb != vtime_lb
|| taxisptr->vtime_ub != vtime_ub
|| taxisptr->has_bounds != TRUE)
@@ -782,9 +729,7 @@ The function @func{taxisInqRdate} returns the reference date of a Time axis.
*/
int taxisInqRdate(int taxisID)
{
- taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
-
- taxis_check_ptr(__func__, taxisptr);
+ taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
if ( taxisptr->rdate == -1 )
{
@@ -814,9 +759,7 @@ The function @func{taxisInqRtime} returns the reference time of a Time axis.
*/
int taxisInqRtime(int taxisID)
{
- taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
-
- taxis_check_ptr(__func__, taxisptr);
+ taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
if ( taxisptr->rdate == -1 )
{
@@ -846,9 +789,7 @@ The function @func{taxisInqFdate} returns the forecast reference date of a Time
*/
int taxisInqFdate(int taxisID)
{
- taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
-
- taxis_check_ptr(__func__, taxisptr);
+ taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
if ( taxisptr->fdate == -1 )
{
@@ -877,9 +818,7 @@ The function @func{taxisInqFtime} returns the forecast reference time of a Time
*/
int taxisInqFtime(int taxisID)
{
- taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
-
- taxis_check_ptr(__func__, taxisptr);
+ taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
if ( taxisptr->fdate == -1 )
{
@@ -913,8 +852,6 @@ int taxisInqCalendar(int taxisID)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->calendar);
}
@@ -923,8 +860,6 @@ int taxisInqTunit(int taxisID)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->unit);
}
@@ -933,8 +868,6 @@ int taxisInqForecastTunit(int taxisID)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->fc_unit);
}
@@ -943,8 +876,6 @@ double taxisInqForecastPeriod(int taxisID)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->fc_period);
}
@@ -953,8 +884,6 @@ int taxisInqNumavg(int taxisID)
{
taxis_t *taxisptr = ( taxis_t * ) reshGetVal ( taxisID, &taxisOps );
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr->numavg);
}
@@ -963,8 +892,6 @@ taxis_t *taxisPtr(int taxisID)
{
taxis_t *taxisptr = (taxis_t *)reshGetVal(taxisID, &taxisOps);
- taxis_check_ptr(__func__, taxisptr);
-
return (taxisptr);
}
@@ -973,7 +900,6 @@ ptaxisDefName(taxis_t *taxisptr, const char *name)
{
if (name)
{
- taxis_check_ptr(__func__, taxisptr);
size_t len = strlen(name);
delete_refcount_string(taxisptr->name);
char *taxisname = taxisptr->name = new_refcount_string(len);
@@ -986,7 +912,6 @@ ptaxisDefLongname(taxis_t *taxisptr, const char *longname)
{
if (longname)
{
- taxis_check_ptr(__func__, taxisptr);
size_t len = strlen(longname);
delete_refcount_string(taxisptr->longname);
char *taxislongname = taxisptr->longname = new_refcount_string(len);
@@ -1269,6 +1194,7 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
else if ( timeunit == TUNIT_MONTH )
{
vdate = (int) timevalue*100;
+ vdate += 1;
vtime = 0;
}
else if ( timeunit == TUNIT_YEAR )
@@ -1285,6 +1211,7 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time)
}
vdate = (int) timevalue*10000;
+ vdate += 101;
vtime = 0;
}
else
@@ -1482,8 +1409,6 @@ taxisPrintKernel(taxis_t * taxisptr, FILE * fp)
int vdate_lb, vdate_ub;
int vtime_lb, vtime_ub;
- taxis_check_ptr ( __func__, taxisptr );
-
taxisInqVdateBounds ( taxisptr->self, &vdate_lb, &vdate_ub);
taxisInqVtimeBounds ( taxisptr->self, &vtime_lb, &vtime_ub);
@@ -1670,8 +1595,8 @@ taxisPack(void * voidP, void * packBuffer, int packBufferSize, int * packBufferP
intBuffer[idx++] = taxisP->vtime_lb;
intBuffer[idx++] = taxisP->vdate_ub;
intBuffer[idx++] = taxisP->vtime_ub;
- intBuffer[idx++] = taxisP->name ? strlen(taxisP->name) : 0;
- intBuffer[idx++] = taxisP->longname ? strlen(taxisP->longname) : 0;
+ intBuffer[idx++] = taxisP->name ? (int)strlen(taxisP->name) : 0;
+ intBuffer[idx++] = taxisP->longname ? (int)strlen(taxisP->longname) : 0;
serializePack(intBuffer, taxisNint, DATATYPE_INT,
packBuffer, packBufferSize, packBufferPos, context);
diff --git a/libcdi/src/varscan.c b/libcdi/src/varscan.c
index e3ab47c..2747e7e 100644
--- a/libcdi/src/varscan.c
+++ b/libcdi/src/varscan.c
@@ -447,7 +447,7 @@ void cdi_generate_vars(stream_t *streamptr)
{
int varID, gridID, zaxisID;
int instID, modelID, tableID;
- int param, zaxistype, ltype1, ltype2, lindex;
+ int param, zaxistype, ltype1, ltype2;
int prec;
int tsteptype;
int timave, timaccu;
@@ -701,7 +701,6 @@ void cdi_generate_vars(stream_t *streamptr)
/*
for ( levelID = 0; levelID < nlevels; levelID++ )
{
- lindex = vartable[varid].levelTable[levelID].lindex;
printf("%d %d %d %d %d\n", varID, levelID,
vartable[varid].levelTable[levelID].lindex,
vartable[varid].levelTable[levelID].recID,
@@ -1028,7 +1027,7 @@ void varDefTable(int varID, int tableID)
void varDefEnsembleInfo(int varID, int ens_idx, int ens_count, int forecast_type)
{
if ( vartable[varID].ensdata == NULL )
- vartable[varID].ensdata = (ensinfo_t *) malloc( sizeof( ensinfo_t ) );
+ vartable[varID].ensdata = (ensinfo_t *)xmalloc( sizeof( ensinfo_t ) );
vartable[varID].ensdata->ens_index = ens_idx;
vartable[varID].ensdata->ens_count = ens_count;
diff --git a/libcdi/src/vlist.c b/libcdi/src/vlist.c
index c86934c..579b877 100644
--- a/libcdi/src/vlist.c
+++ b/libcdi/src/vlist.c
@@ -76,7 +76,7 @@ static int vlistTxCode ( void );
#if !defined(__cplusplus)
const
#endif
-resOps vlist_ops = {
+resOps vlistOps = {
(valCompareFunc)vlist_compare,
(valDestroyFunc)vlist_delete,
(valPrintFunc)vlistPrintKernel
@@ -89,7 +89,7 @@ resOps vlist_ops = {
vlist_t *vlist_to_pointer(int vlistID)
{
VLIST_INIT();
- return (vlist_t*) reshGetVal(vlistID, &vlist_ops );
+ return (vlist_t*) reshGetVal(vlistID, &vlistOps );
}
static
@@ -117,11 +117,11 @@ vlist_t *vlist_new_entry(cdiResH resH)
vlist_t *vlistptr = (vlist_t*) xmalloc(sizeof(vlist_t));
vlist_init_entry(vlistptr);
if (resH == CDI_UNDEFID)
- vlistptr->self = reshPut(vlistptr, &vlist_ops);
+ vlistptr->self = reshPut(vlistptr, &vlistOps);
else
{
vlistptr->self = resH;
- reshReplace(resH, vlistptr, &vlist_ops);
+ reshReplace(resH, vlistptr, &vlistOps);
}
return (vlistptr);
}
@@ -133,7 +133,7 @@ void vlist_delete_entry(vlist_t *vlistptr)
idx = vlistptr->self;
- reshRemove(idx, &vlist_ops );
+ reshRemove(idx, &vlistOps );
free(vlistptr);
@@ -162,24 +162,14 @@ void vlist_copy(vlist_t *vlistptr2, vlist_t *vlistptr1)
vlistptr2->self = vlistID2;
}
-static
-void vlist_check_ptr(const char *caller, vlist_t *vlistptr)
-{
- if ( vlistptr == NULL )
- Errorc("vlist undefined!");
-}
-
-
void vlist_lock(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if ( !vlistptr->locked )
{
vlistptr->locked = 1;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -188,12 +178,10 @@ void vlist_unlock(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if ( vlistptr->locked )
{
vlistptr->locked = 0;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -235,8 +223,6 @@ int vlistCreate(void)
static void
vlist_delete(vlist_t *vlistptr)
{
- vlist_check_ptr(__func__, vlistptr);
-
int vlistID = vlistptr->self;
vlistDelAtts(vlistID, CDI_GLOBAL);
@@ -314,9 +300,6 @@ void vlistCopy(int vlistID2, int vlistID1)
vlistptr1 = vlist_to_pointer(vlistID1);
vlistptr2 = vlist_to_pointer(vlistID2);
- vlist_check_ptr(__func__, vlistptr1);
- vlist_check_ptr(__func__, vlistptr2);
-
var_t *vlist2vars = vlistptr2->vars;
vlist_copy(vlistptr2, vlistptr1);
@@ -411,15 +394,8 @@ The function @func{vlistDuplicate} duplicates the variable list from vlistID1.
*/
int vlistDuplicate(int vlistID)
{
- int vlistIDnew;
- vlist_t *vlistptr = vlist_to_pointer(vlistID);
-
- vlist_check_ptr(__func__, vlistptr);
-
- vlistIDnew = vlistCreate();
-
+ int vlistIDnew = vlistCreate();
vlistCopy(vlistIDnew, vlistID);
-
return (vlistIDnew);
}
@@ -451,9 +427,6 @@ int vlist_generate_zaxis(int vlistID, int zaxistype, int nlevels, const double *
int zaxisglobdefined = 0;
int has_bounds = FALSE;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
-
- vlist_check_ptr(__func__, vlistptr);
-
int zaxisdefined = 0;
int nzaxis = vlistptr->nzaxis;
@@ -539,10 +512,6 @@ void vlistCopyFlag(int vlistID2, int vlistID1)
{
vlist_t *vlistptr1 = vlist_to_pointer(vlistID1),
*vlistptr2 = vlist_to_pointer(vlistID2);
-
- vlist_check_ptr(__func__, vlistptr1);
- vlist_check_ptr(__func__, vlistptr2);
-
vlist_copy(vlistptr2, vlistptr1);
vlistCopyVarAtts(vlistID1, CDI_GLOBAL, vlistID2, CDI_GLOBAL);
@@ -742,9 +711,6 @@ void vlistCat(int vlistID2, int vlistID1)
vlist_t *vlistptr1 = vlist_to_pointer(vlistID1),
*vlistptr2 = vlist_to_pointer(vlistID2);
- vlist_check_ptr(__func__, vlistptr1);
- vlist_check_ptr(__func__, vlistptr2);
-
int nvars1 = vlistptr1->nvars;
int nvars2 = vlistptr2->nvars;
int nvars = nvars1 + nvars2;
@@ -857,9 +823,6 @@ void vlistMerge(int vlistID2, int vlistID1)
vlist_t *vlistptr1 = vlist_to_pointer(vlistID1),
*vlistptr2 = vlist_to_pointer(vlistID2);
- vlist_check_ptr(__func__, vlistptr1);
- vlist_check_ptr(__func__, vlistptr2);
-
int nvars1 = vlistptr1->nvars;
int nvars2 = vlistptr2->nvars;
@@ -990,9 +953,6 @@ The function @func{vlistNvars} returns the number of variables in the variable l
int vlistNvars(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
-
- vlist_check_ptr(__func__, vlistptr);
-
return (vlistptr->nvars);
}
@@ -1002,8 +962,6 @@ int vlistNrecs(int vlistID)
int nrecs = 0;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
for ( int varID = 0; varID < vlistptr->nvars; varID++ )
nrecs += zaxisInqSize(vlistptr->vars[varID].zaxisID);
@@ -1016,8 +974,6 @@ int vlistNumber(int vlistID)
int number, number2, datatype;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
datatype = vlistptr->vars[0].datatype;
if ( datatype== DATATYPE_CPX32 || datatype == DATATYPE_CPX64 )
number = CDI_COMP;
@@ -1062,8 +1018,6 @@ int vlistNgrids(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
return (vlistptr->ngrids);
}
@@ -1087,8 +1041,6 @@ int vlistNzaxis(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
return (vlistptr->nzaxis);
}
@@ -1097,12 +1049,10 @@ void vlistDefNtsteps(int vlistID, int nts)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if (vlistptr->ntsteps != nts)
{
vlistptr->ntsteps = nts;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1111,9 +1061,7 @@ int vlistNtsteps(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
- return (vlistptr->ntsteps);
+ return (int)vlistptr->ntsteps;
}
static void
@@ -1121,8 +1069,6 @@ vlistPrintKernel(vlist_t *vlistptr, FILE * fp )
{
char paramstr[32];
- vlist_check_ptr(__func__, vlistptr);
-
fprintf ( fp, "#\n# vlistID %d\n#\n", vlistptr->self);
int nvars = vlistptr->nvars;
@@ -1207,7 +1153,6 @@ void vlistPrint(int vlistID)
{
if ( vlistID == CDI_UNDEFID ) return;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
vlistPrintKernel(vlistptr, stdout);
}
@@ -1229,12 +1174,10 @@ void vlistDefTaxis(int vlistID, int taxisID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if (vlistptr->taxisID != taxisID)
{
vlistptr->taxisID = taxisID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1258,8 +1201,6 @@ int vlistInqTaxis(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
return (vlistptr->taxisID);
}
@@ -1268,12 +1209,10 @@ void vlistDefTable(int vlistID, int tableID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if (vlistptr->tableID != tableID)
{
vlistptr->tableID = tableID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1282,8 +1221,6 @@ int vlistInqTable(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
return (vlistptr->tableID);
}
@@ -1292,12 +1229,10 @@ void vlistDefInstitut(int vlistID, int instID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if (vlistptr->instID != instID)
{
vlistptr->instID = instID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1306,8 +1241,6 @@ int vlistInqInstitut(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
int instID = vlistptr->instID;
if ( instID == CDI_UNDEFID )
@@ -1331,12 +1264,10 @@ void vlistDefModel(int vlistID, int modelID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if (vlistptr->modelID != modelID)
{
vlistptr->modelID = modelID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1345,8 +1276,6 @@ int vlistInqModel(int vlistID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
int modelID = vlistptr->modelID;
if ( modelID == CDI_UNDEFID )
@@ -1372,8 +1301,6 @@ int vlistGridsizeMax(int vlistID)
int gridsizemax = 0;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
for ( int index = 0 ; index < vlistptr->ngrids ; index++ )
{
int gridID = vlistptr->gridIDs[index];
@@ -1390,8 +1317,6 @@ int vlistGrid(int vlistID, int index)
int gridID = CDI_UNDEFID;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if ( index < vlistptr->ngrids && index >= 0 )
gridID = vlistptr->gridIDs[index];
@@ -1404,8 +1329,6 @@ int vlistGridIndex(int vlistID, int gridID)
int index;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
for ( index = 0 ; index < vlistptr->ngrids ; index++ )
if ( gridID == vlistptr->gridIDs[index] ) break;
@@ -1419,8 +1342,6 @@ void vlistChangeGridIndex(int vlistID, int index, int gridID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
int gridIDold = vlistptr->gridIDs[index];
if (gridIDold != gridID)
{
@@ -1430,7 +1351,7 @@ void vlistChangeGridIndex(int vlistID, int index, int gridID)
for ( int varID = 0; varID < nvars; varID++ )
if ( vlistptr->vars[varID].gridID == gridIDold )
vlistptr->vars[varID].gridID = gridID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1439,8 +1360,6 @@ void vlistChangeGrid(int vlistID, int gridID1, int gridID2)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if (gridID1 != gridID2)
{
int ngrids = vlistptr->ngrids;
@@ -1456,7 +1375,7 @@ void vlistChangeGrid(int vlistID, int gridID1, int gridID2)
for ( int varID = 0; varID < nvars; varID++ )
if ( vlistptr->vars[varID].gridID == gridID1 )
vlistptr->vars[varID].gridID = gridID2;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1466,8 +1385,6 @@ int vlistZaxis(int vlistID, int index)
int zaxisID = CDI_UNDEFID;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
if ( index < vlistptr->nzaxis && index >= 0 )
zaxisID = vlistptr->zaxisIDs[index];
@@ -1478,8 +1395,6 @@ int vlistZaxisIndex(int vlistID, int zaxisID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
int index;
for ( index = 0 ; index < vlistptr->nzaxis ; index++ )
if ( zaxisID == vlistptr->zaxisIDs[index] ) break;
@@ -1494,8 +1409,6 @@ void vlistChangeZaxisIndex(int vlistID, int index, int zaxisID)
{
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
int zaxisIDold = vlistptr->zaxisIDs[index];
if (zaxisIDold != zaxisID)
{
@@ -1516,7 +1429,7 @@ void vlistChangeZaxisIndex(int vlistID, int index, int zaxisID)
vlistptr->vars[varID].levinfo[levID] = DEFAULT_LEVINFO(levID);
}
}
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1526,8 +1439,6 @@ void vlistChangeZaxis(int vlistID, int zaxisID1, int zaxisID2)
int nlevs1 = zaxisInqSize(zaxisID1), nlevs2 = zaxisInqSize(zaxisID2);
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
int nzaxis = vlistptr->nzaxis;
for ( int index = 0; index < nzaxis; index++ )
{
@@ -1554,7 +1465,7 @@ void vlistChangeZaxis(int vlistID, int zaxisID1, int zaxisID2)
vlistptr->vars[varID].levinfo[levID] = DEFAULT_LEVINFO(levID);
}
}
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -1563,8 +1474,6 @@ int vlistHasTime(int vlistID)
int hastime = FALSE;
vlist_t *vlistptr = vlist_to_pointer(vlistID);
- vlist_check_ptr(__func__, vlistptr);
-
for ( int varID = 0; varID < vlistptr->nvars; varID++ )
if ( vlistptr->vars[varID].tsteptype != TSTEP_CONSTANT )
{
@@ -1576,7 +1485,7 @@ int vlistHasTime(int vlistID)
}
enum {
- vlist_nints=7,
+ vlist_nints=6,
};
static int
@@ -1592,6 +1501,7 @@ int vlistGetSizeP ( void * vlistptr, void *context)
int txsize, varID;
vlist_t *p = (vlist_t*) vlistptr;
txsize = serializeGetSize(vlist_nints, DATATYPE_INT, context);
+ txsize += serializeGetSize(1, DATATYPE_LONG, context);
txsize += vlistAttsGetSize(p, CDI_GLOBAL, context);
for ( varID = 0; varID < p->nvars; varID++ )
txsize += vlistVarGetPackSize(p, varID, context);
@@ -1607,12 +1517,13 @@ void vlistPackP ( void * vlistptr, void * buf, int size, int *position,
vlist_t *p = (vlist_t*) vlistptr;
tempbuf[0] = p->self;
tempbuf[1] = p->nvars;
- tempbuf[2] = p->ntsteps;
- tempbuf[3] = p->taxisID;
- tempbuf[4] = p->tableID;
- tempbuf[5] = p->instID;
- tempbuf[6] = p->modelID;
+ tempbuf[2] = p->taxisID;
+ tempbuf[3] = p->tableID;
+ tempbuf[4] = p->instID;
+ tempbuf[5] = p->modelID;
serializePack(tempbuf, vlist_nints, DATATYPE_INT, buf, size, position, context);
+ serializePack(&p->ntsteps, 1, DATATYPE_LONG, buf, size, position, context);
+
vlistAttsPack(p, CDI_GLOBAL, buf, size, position, context);
for ( varID = 0; varID < p->nvars; varID++ )
{
@@ -1625,17 +1536,19 @@ void vlistUnpack(char * buf, int size, int *position, int originNamespace,
{
int tempbuf[vlist_nints];
serializeUnpack(buf, size, position, tempbuf, vlist_nints, DATATYPE_INT, context);
+ int nvars = tempbuf[1];
int targetID = namespaceAdaptKey(tempbuf[0], originNamespace);
vlist_t *p = vlist_new_entry(force_id?targetID:CDI_UNDEFID);
xassert(!force_id || p->self == targetID);
if (!force_id)
targetID = p->self;
- p->taxisID = namespaceAdaptKey(tempbuf[3], originNamespace);
- p->tableID = tempbuf[4];
- p->instID = namespaceAdaptKey(tempbuf[5], originNamespace);
- p->modelID = namespaceAdaptKey(tempbuf[6], originNamespace);
+ p->taxisID = namespaceAdaptKey(tempbuf[2], originNamespace);
+ p->tableID = tempbuf[3];
+ p->instID = namespaceAdaptKey(tempbuf[4], originNamespace);
+ p->modelID = namespaceAdaptKey(tempbuf[5], originNamespace);
+ serializeUnpack(buf, size, position, &p->ntsteps, 1, DATATYPE_LONG, context);
vlistAttsUnpack(targetID, CDI_GLOBAL, buf, size, position, context);
- for (int varID = 0; varID < tempbuf[1]; varID++ )
+ for (int varID = 0; varID < nvars; varID++ )
vlistVarUnpack(targetID, buf, size, position, originNamespace, context);
}
diff --git a/libcdi/src/vlist.h b/libcdi/src/vlist.h
index b18e9c1..fa0b878 100644
--- a/libcdi/src/vlist.h
+++ b/libcdi/src/vlist.h
@@ -133,7 +133,7 @@ typedef struct
int nvars; /* number of variables */
int ngrids;
int nzaxis;
- int ntsteps;
+ long ntsteps;
int taxisID;
int tableID;
int instID;
@@ -215,6 +215,12 @@ extern int cdiNAdditionalGRIBKeys;
extern char* cdiAdditionalGRIBKeys[];
#endif
+extern
+#ifndef __cplusplus
+const
+#endif
+resOps vlistOps;
+
#endif /* _VLIST_H */
/*
* Local Variables:
diff --git a/libcdi/src/vlist_att.c b/libcdi/src/vlist_att.c
index e5ecbd5..8419631 100644
--- a/libcdi/src/vlist_att.c
+++ b/libcdi/src/vlist_att.c
@@ -41,13 +41,13 @@ cdi_att_t *find_att(cdi_atts_t *attsp, const char *name)
if ( attsp->nelems == 0 ) return NULL;
size_t slen = strlen(name);
+ if ( slen > CDI_MAX_NAME ) slen = CDI_MAX_NAME;
cdi_att_t *atts = attsp->value;
- for (size_t attid = 0; attid < attsp->nelems; attid++)
+ for ( size_t attid = 0; attid < attsp->nelems; attid++ )
{
cdi_att_t *attp = atts + attid;
- if (attp->namesz == slen
- && memcmp(attp->name, name, slen) == 0)
+ if ( attp->namesz == slen && memcmp(attp->name, name, slen) == 0 )
return (attp); /* Normal return */
}
@@ -69,6 +69,7 @@ cdi_att_t *new_att(cdi_atts_t *attsp, const char *name)
attsp->nelems++;
slen = strlen(name);
+ if ( slen > CDI_MAX_NAME ) slen = CDI_MAX_NAME;
attp->name = (char *) malloc(slen+1);
memcpy(attp->name, name, slen+1);
diff --git a/libcdi/src/vlist_var.c b/libcdi/src/vlist_var.c
index 60cf0b5..432d457 100644
--- a/libcdi/src/vlist_var.c
+++ b/libcdi/src/vlist_var.c
@@ -15,12 +15,6 @@
#include "serialize.h"
#include "error.h"
-extern
-#if !defined(__cplusplus)
-const
-#endif
-resOps vlist_ops;
-
static
void vlistvarInitEntry(int vlistID, int varID)
{
@@ -210,7 +204,7 @@ int vlistDefVar(int vlistID, int gridID, int zaxisID, int tsteptype)
vlistAdd2ZaxisIDs(vlistptr, zaxisID);
vlistptr->vars[varID].param = cdiEncodeParam(-(varID + 1), 255, 255);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
return (varID);
}
@@ -253,7 +247,7 @@ void vlistDefVarParam(int vlistID, int varID, int param)
if (vlistptr->vars[varID].param != param)
{
vlistptr->vars[varID].param = param;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -285,7 +279,7 @@ void vlistDefVarCode(int vlistID, int varID, int code)
if (vlistptr->vars[varID].param != newParam)
{
vlistptr->vars[varID].param = newParam;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -756,7 +750,7 @@ void vlistDefVarDatatype(int vlistID, int varID, int datatype)
case DATATYPE_INT32: vlistptr->vars[varID].missval = -INT_MAX; break;
case DATATYPE_UINT32: vlistptr->vars[varID].missval = UINT_MAX; break;
}
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -767,7 +761,7 @@ void vlistDefVarInstitut(int vlistID, int varID, int instID)
if (vlistptr->vars[varID].instID != instID)
{
vlistptr->vars[varID].instID = instID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -785,7 +779,7 @@ void vlistDefVarModel(int vlistID, int varID, int modelID)
if (vlistptr->vars[varID].modelID != modelID)
{
vlistptr->vars[varID].modelID = modelID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -811,7 +805,7 @@ void vlistDefVarTable(int vlistID, int varID, int tableID)
int pnum, pcat, pdis;
cdiDecodeParam(param, &pnum, &pcat, &pdis);
vlistptr->vars[varID].param = cdiEncodeParam(pnum, tablenum, pdis);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -852,7 +846,7 @@ void vlistDefVarName(int vlistID, int varID, const char *name)
}
vlistptr->vars[varID].name = strdupx(name);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -886,7 +880,7 @@ void vlistDefVarLongname(int vlistID, int varID, const char *longname)
}
vlistptr->vars[varID].longname = strdupx(longname);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -920,7 +914,7 @@ void vlistDefVarStdname(int vlistID, int varID, const char *stdname)
}
vlistptr->vars[varID].stdname = strdupx(stdname);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -954,7 +948,7 @@ void vlistDefVarUnits(int vlistID, int varID, const char *units)
}
vlistptr->vars[varID].units = strdupx(units);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1039,7 +1033,7 @@ void vlistDefVarExtra(int vlistID, int varID, const char *extra)
}
vlistptr->vars[varID].extra = strdupx(extra);
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1104,7 +1098,7 @@ void vlistDefVarValidrange(int vlistID, int varID, const double *validrange)
vlistptr->vars[varID].validrange[0] = validrange[0];
vlistptr->vars[varID].validrange[1] = validrange[1];
vlistptr->vars[varID].lvalidrange = TRUE;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -1137,7 +1131,7 @@ void vlistDefVarScalefactor(int vlistID, int varID, double scalefactor)
if ( IS_NOT_EQUAL(vlistptr->vars[varID].scalefactor, scalefactor) )
{
vlistptr->vars[varID].scalefactor = scalefactor;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1151,7 +1145,7 @@ void vlistDefVarAddoffset(int vlistID, int varID, double addoffset)
if ( IS_NOT_EQUAL(vlistptr->vars[varID].addoffset, addoffset))
{
vlistptr->vars[varID].addoffset = addoffset;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1162,7 +1156,7 @@ void vlistDefVarTsteptype(int vlistID, int varID, int tsteptype)
if (vlistptr->vars[varID].tsteptype != tsteptype)
{
vlistptr->vars[varID].tsteptype = tsteptype;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1180,7 +1174,7 @@ void vlistDefVarTimave(int vlistID, int varID, int timave)
if (vlistptr->vars[varID].timave != timave)
{
vlistptr->vars[varID].timave = timave;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1198,7 +1192,7 @@ void vlistDefVarTimaccu(int vlistID, int varID, int timaccu)
if (vlistptr->vars[varID].timaccu != timaccu)
{
vlistptr->vars[varID].timaccu = timaccu;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1216,7 +1210,7 @@ void vlistDefVarTypeOfGeneratingProcess(int vlistID, int varID, int typeOfGenera
if (vlistptr->vars[varID].typeOfGeneratingProcess != typeOfGeneratingProcess)
{
vlistptr->vars[varID].typeOfGeneratingProcess = typeOfGeneratingProcess;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1235,7 +1229,7 @@ void vlistDefVarProductDefinitionTemplate(int vlistID, int varID, int productDef
if (vlistptr->vars[varID].productDefinitionTemplate != productDefinitionTemplate)
{
vlistptr->vars[varID].productDefinitionTemplate = productDefinitionTemplate;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1255,7 +1249,7 @@ void vlistDestroyVarName(int vlistID, int varID)
{
free(vlistptr->vars[varID].name);
vlistptr->vars[varID].name = NULL;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1268,7 +1262,7 @@ void vlistDestroyVarLongname(int vlistID, int varID)
{
free(vlistptr->vars[varID].longname);
vlistptr->vars[varID].longname = NULL;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1281,7 +1275,7 @@ void vlistDestroyVarStdname(int vlistID, int varID)
{
free(vlistptr->vars[varID].stdname);
vlistptr->vars[varID].stdname = NULL;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1294,7 +1288,7 @@ void vlistDestroyVarUnits(int vlistID, int varID)
{
free(vlistptr->vars[varID].units);
vlistptr->vars[varID].units = NULL;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1332,7 +1326,7 @@ void vlistDefFlag(int vlistID, int varID, int levID, int flag)
}
}
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -1430,7 +1424,7 @@ void vlistDefIndex(int vlistID, int varID, int levelID, int index)
else
return;
vlistptr->vars[varID].levinfo[levelID].index = index;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -1478,7 +1472,7 @@ void vlistChangeVarZaxis(int vlistID, int varID, int zaxisID)
vlistAdd2ZaxisIDs(vlistptr, zaxisID);
vlistptr->vars[varID].zaxisID = zaxisID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -1504,7 +1498,7 @@ void vlistChangeVarGrid(int vlistID, int varID, int gridID)
vlistAdd2GridIDs(vlistptr, gridID);
vlistptr->vars[varID].gridID = gridID;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -1517,7 +1511,7 @@ void vlistDefVarCompType(int vlistID, int varID, int comptype)
if (vlistptr->vars[varID].comptype != comptype)
{
vlistptr->vars[varID].comptype = comptype;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1541,7 +1535,7 @@ void vlistDefVarCompLevel(int vlistID, int varID, int complevel)
if (vlistptr->vars[varID].complevel != complevel)
{
vlistptr->vars[varID].complevel = complevel;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1565,7 +1559,7 @@ void vlistDefVarChunkType(int vlistID, int varID, int chunktype)
if (vlistptr->vars[varID].chunktype != chunktype)
{
vlistptr->vars[varID].chunktype = chunktype;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
@@ -1631,7 +1625,7 @@ void vlistDefVarXYZ(int vlistID, int varID, int xyz)
assert(xyz == 123 || xyz == 312 || xyz == 231 || xyz == 321 || xyz == 132 || xyz == 213);
vlistptr->vars[varID].xyz = xyz;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -1670,7 +1664,7 @@ void vlistDefVarEnsemble(int vlistID, int varID, int ensID, int ensCount, int fo
vlistptr->vars[varID].ensdata->ens_index = ensID;
vlistptr->vars[varID].ensdata->ens_count = ensCount;
vlistptr->vars[varID].ensdata->forecast_init_type = forecast_type;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
@@ -1729,7 +1723,12 @@ void vlistDefVarIntKey(int vlistID, int varID, const char *name, int value)
Error("Internal error, name undefined!");
}
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
+#else
+ (void)vlistID;
+ (void)varID;
+ (void)name;
+ (void)value;
#endif
}
@@ -1765,7 +1764,12 @@ void vlistDefVarDblKey(int vlistID, int varID, const char *name, double value)
Error("Internal error, name undefined!");
}
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
+#else
+ (void)vlistID;
+ (void)varID;
+ (void)name;
+ (void)value;
#endif
}
@@ -1795,6 +1799,8 @@ void cdiDefAdditionalKey(const char *name)
cdiAdditionalGRIBKeys[idx] = strdupx(name);
else
Error("Internal error!");
+#else
+ (void)name;
#endif
}
@@ -1816,6 +1822,10 @@ int vlistHasVarKey(int vlistID, int varID, const char* name)
if ( strcmp(name, vlistptr->vars[varID].opt_grib_int_keyword[i]) == 0 )
return 1;
}
+#else
+ (void)vlistID;
+ (void)varID;
+ (void)name;
#endif
return 0;
}
@@ -1831,6 +1841,10 @@ double vlistInqVarDblKey(int vlistID, int varID, const char* name)
for (int i=0; i<vlistptr->vars[varID].opt_grib_dbl_nentries; i++)
if ( strcmp(name, vlistptr->vars[varID].opt_grib_dbl_keyword[i]) == 0 )
return vlistptr->vars[varID].opt_grib_dbl_val[i];
+#else
+ (void)vlistID;
+ (void)varID;
+ (void)name;
#endif
return value;
}
@@ -1847,6 +1861,10 @@ int vlistInqVarIntKey(int vlistID, int varID, const char* name)
for (int i=0; i<vlistptr->vars[varID].opt_grib_int_nentries; i++)
if ( strcmp(name, vlistptr->vars[varID].opt_grib_int_keyword[i]) == 0 )
return vlistptr->vars[varID].opt_grib_int_val[i];
+#else
+ (void)vlistID;
+ (void)varID;
+ (void)name;
#endif
return (int) value;
}
@@ -1861,7 +1879,7 @@ void vlistDefVarIOrank(int vlistID, int varID, int iorank)
if (vlistptr->vars[varID].iorank != iorank)
{
vlistptr->vars[varID].iorank = iorank;
- reshSetStatus(vlistID, &vlist_ops, RESH_DESYNC_IN_USE);
+ reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE);
}
}
diff --git a/libcdi/src/zaxis.c b/libcdi/src/zaxis.c
index e39aa20..16dd437 100644
--- a/libcdi/src/zaxis.c
+++ b/libcdi/src/zaxis.c
@@ -172,15 +172,6 @@ void zaxis_copy(zaxis_t *zaxisptr2, zaxis_t *zaxisptr1)
zaxisptr2->self = zaxisID2;
}
-static
-void zaxisCheckPtr(const char *caller, int zaxisID, zaxis_t *zaxisptr)
-{
- if ( zaxisptr == NULL )
- Errorc("zaxis %d undefined!", zaxisID);
-}
-
-#define zaxis_check_ptr(zaxisID, zaxisptr) zaxisCheckPtr(__func__, zaxisID, zaxisptr)
-
int zaxisSize(void)
{
return reshCountType ( &zaxisOps );
@@ -348,8 +339,6 @@ void zaxisDefName(int zaxisID, const char *name)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( name )
{
strncpy(zaxisptr->name, name, CDI_MAX_NAME - 1);
@@ -376,8 +365,6 @@ void zaxisDefLongname(int zaxisID, const char *longname)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( longname )
{
strncpy(zaxisptr->longname, longname, CDI_MAX_NAME - 1);
@@ -404,8 +391,6 @@ void zaxisDefUnits(int zaxisID, const char *units)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( units )
{
strncpy(zaxisptr->units, units, CDI_MAX_NAME - 1);
@@ -436,9 +421,6 @@ The function @func{zaxisInqName} returns the name of a Z-axis.
void zaxisInqName(int zaxisID, char *name)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
strcpy(name, zaxisptr->name);
}
@@ -464,9 +446,6 @@ The function @func{zaxisInqLongname} returns the longname of a Z-axis.
void zaxisInqLongname(int zaxisID, char *longname)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
strcpy(longname, zaxisptr->longname);
}
@@ -492,9 +471,6 @@ The function @func{zaxisInqUnits} returns the units of a Z-axis.
void zaxisInqUnits(int zaxisID, char *units)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
strcpy(units, zaxisptr->units);
}
@@ -502,9 +478,6 @@ void zaxisInqUnits(int zaxisID, char *units)
void zaxisInqStdname(int zaxisID, char *stdname)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
strcpy(stdname, zaxisptr->stdname);
}
@@ -513,8 +486,6 @@ void zaxisDefPrec(int zaxisID, int prec)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if (zaxisptr->prec != prec)
{
zaxisptr->prec = prec;
@@ -527,8 +498,6 @@ int zaxisInqPrec(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->prec);
}
@@ -537,8 +506,6 @@ void zaxisDefPositive(int zaxisID, int positive)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if (zaxisptr->positive != positive)
{
zaxisptr->positive = (unsigned char)positive;
@@ -551,8 +518,6 @@ int zaxisInqPositive(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->positive);
}
@@ -561,8 +526,6 @@ void zaxisDefLtype(int zaxisID, int ltype)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if (zaxisptr->ltype != ltype)
{
zaxisptr->ltype = ltype;
@@ -575,8 +538,6 @@ int zaxisInqLtype(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->ltype);
}
@@ -585,8 +546,6 @@ void zaxisDefLtype2(int zaxisID, int ltype2)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if (zaxisptr->ltype2 != ltype2)
{
zaxisptr->ltype2 = ltype2;
@@ -599,8 +558,6 @@ int zaxisInqLtype2(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->ltype2);
}
@@ -622,8 +579,6 @@ void zaxisDefLevels(int zaxisID, const double *levels)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
int size = zaxisptr->size;
double *vals = zaxisptr->vals;
@@ -652,8 +607,6 @@ void zaxisDefLevel(int zaxisID, int levelID, double level)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( levelID >= 0 && levelID < zaxisptr->size )
zaxisptr->vals[levelID] = level;
reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE);
@@ -664,8 +617,6 @@ void zaxisDefNlevRef(int zaxisID, const int nhlev)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if (zaxisptr->nhlev != nhlev)
{
zaxisptr->nhlev = nhlev;
@@ -678,8 +629,6 @@ int zaxisInqNlevRef(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->nhlev);
}
@@ -701,8 +650,6 @@ void zaxisDefNumber(int zaxisID, const int number)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if (zaxisptr->number != number)
{
zaxisptr->number = number;
@@ -729,8 +676,6 @@ int zaxisInqNumber(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->number);
}
@@ -752,8 +697,6 @@ void zaxisDefUUID(int zaxisID, const unsigned char uuid[CDI_UUID_SIZE])
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
memcpy(zaxisptr->uuid, uuid, CDI_UUID_SIZE);
reshSetStatus(zaxisID, &zaxisOps, RESH_DESYNC_IN_USE);
}
@@ -776,9 +719,6 @@ The function @func{zaxisInqUUID} returns the UUID to a generalized Z-axis.
void zaxisInqUUID(int zaxisID, unsigned char uuid[CDI_UUID_SIZE])
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
memcpy(uuid, zaxisptr->uuid, CDI_UUID_SIZE);
}
@@ -803,8 +743,6 @@ double zaxisInqLevel(int zaxisID, int levelID)
double level = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( levelID >= 0 && levelID < zaxisptr->size )
level = zaxisptr->vals[levelID];
@@ -816,8 +754,6 @@ double zaxisInqLbound(int zaxisID, int index)
double level = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisptr->lbounds )
if ( index >= 0 && index < zaxisptr->size )
level = zaxisptr->lbounds[index];
@@ -831,8 +767,6 @@ double zaxisInqUbound(int zaxisID, int index)
double level = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisptr->ubounds )
if ( index >= 0 && index < zaxisptr->size )
level = zaxisptr->ubounds[index];
@@ -844,9 +778,6 @@ double zaxisInqUbound(int zaxisID, int index)
const double *zaxisInqLevelsPtr(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return ( zaxisptr->vals );
}
@@ -870,9 +801,6 @@ The function @func{zaxisInqLevels} returns all levels of a Z-axis.
void zaxisInqLevels(int zaxisID, double *levels)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
int size = zaxisptr->size;
for (int i = 0; i < size; i++ )
levels[i] = zaxisptr->vals[i];
@@ -884,8 +812,6 @@ int zaxisInqLbounds(int zaxisID, double *lbounds)
int size = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisptr->lbounds )
{
size = zaxisptr->size;
@@ -904,8 +830,6 @@ int zaxisInqUbounds(int zaxisID, double *ubounds)
int size = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisptr->ubounds )
{
size = zaxisptr->size;
@@ -924,8 +848,6 @@ int zaxisInqWeights(int zaxisID, double *weights)
int size = 0;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisptr->weights )
{
size = zaxisptr->size;
@@ -944,8 +866,6 @@ int zaxisInqLevelID(int zaxisID, double level)
int levelID = CDI_UNDEFID;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
int size = zaxisptr->size;
for ( int i = 0; i < size; i++ )
if ( fabs(level-zaxisptr->vals[i]) < DBL_EPSILON )
@@ -985,9 +905,6 @@ The valid CDI Z-axis types are @func{ZAXIS_GENERIC}, @func{ZAXIS_SURFACE},
int zaxisInqType(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->type);
}
@@ -1010,12 +927,7 @@ The function @func{zaxisInqSize} returns the size of a Z-axis.
int zaxisInqSize(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
- int size = zaxisptr->size;
-
- return (size);
+ return (zaxisptr->size);
}
@@ -1023,8 +935,6 @@ void cdiCheckZaxis(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisInqType(zaxisID) == ZAXIS_GENERIC )
{
int size = zaxisptr->size;
@@ -1061,8 +971,6 @@ void zaxisDefVct(int zaxisID, int size, const double *vct)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
if ( zaxisptr->vct == 0 )
{
zaxisptr->vctsize = size;
@@ -1079,9 +987,6 @@ void zaxisDefVct(int zaxisID, int size, const double *vct)
void zaxisInqVct(int zaxisID, double *vct)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
memcpy(vct, zaxisptr->vct, (size_t)zaxisptr->vctsize * sizeof (double));
}
@@ -1089,9 +994,6 @@ void zaxisInqVct(int zaxisID, double *vct)
int zaxisInqVctSize(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->vctsize);
}
@@ -1099,9 +1001,6 @@ int zaxisInqVctSize(int zaxisID)
const double *zaxisInqVctPtr(int zaxisID)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
return (zaxisptr->vct);
}
@@ -1110,8 +1009,6 @@ void zaxisDefLbounds(int zaxisID, const double *lbounds)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
size_t size = (size_t)zaxisptr->size;
if ( CDI_Debug )
@@ -1130,8 +1027,6 @@ void zaxisDefUbounds(int zaxisID, const double *ubounds)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
size_t size = (size_t)zaxisptr->size;
if ( CDI_Debug )
@@ -1150,8 +1045,6 @@ void zaxisDefWeights(int zaxisID, const double *weights)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
size_t size = (size_t)zaxisptr->size;
if ( CDI_Debug )
@@ -1169,9 +1062,6 @@ void zaxisDefWeights(int zaxisID, const double *weights)
void zaxisChangeType(int zaxisID, int zaxistype)
{
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
-
- zaxis_check_ptr(zaxisID, zaxisptr);
-
zaxisptr->type = zaxistype;
}
@@ -1181,7 +1071,6 @@ void zaxisResize(int zaxisID, int size)
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
xassert(size >= 0);
- zaxis_check_ptr(zaxisID, zaxisptr);
zaxisptr->size = size;
@@ -1195,8 +1084,6 @@ int zaxisDuplicate(int zaxisID)
int zaxisIDnew;
zaxis_t *zaxisptr = reshGetVal(zaxisID, &zaxisOps);
- zaxis_check_ptr(zaxisID, zaxisptr);
-
int zaxistype = zaxisInqType(zaxisID);
int zaxissize = zaxisInqSize(zaxisID);
@@ -1472,7 +1359,6 @@ zaxisTxCode ( void )
}
enum { zaxisNint = 8,
- zaxisNstrings = 4,
vals = 1 << 0,
lbounds = 1 << 1,
ubounds = 1 << 2,
@@ -1481,6 +1367,8 @@ enum { zaxisNint = 8,
zaxisHasUUIDFlag = 1 << 5,
};
+#define ZAXIS_STR_SERIALIZE { zaxisP->name, zaxisP->longname, \
+ zaxisP->stdname, zaxisP->units }
static
int zaxisGetMemberMask ( zaxis_t * zaxisP )
@@ -1529,9 +1417,14 @@ zaxisGetPackSize(void * voidP, void *context)
+ serializeGetSize(1, DATATYPE_UINT32, context);
}
- packBufferSize += serializeGetSize(zaxisNstrings * CDI_MAX_NAME, DATATYPE_TXT, context)
- + serializeGetSize(1, DATATYPE_UINT32, context)
- + serializeGetSize(1, DATATYPE_UCHAR, context);
+ {
+ const char *strTab[] = ZAXIS_STR_SERIALIZE;
+ size_t numStr = sizeof (strTab) / sizeof (strTab[0]);
+ packBufferSize
+ += serializeStrTabGetPackSize(strTab, (int)numStr, context);
+ }
+
+ packBufferSize += serializeGetSize(1, DATATYPE_UCHAR, context);
if (!cdiUUIDIsNull(zaxisP->uuid))
packBufferSize += serializeGetSize(CDI_UUID_SIZE, DATATYPE_UCHAR, context);
@@ -1547,7 +1440,6 @@ zaxisUnpack(char * unpackBuffer, int unpackBufferSize,
{
int intBuffer[zaxisNint], memberMask;
uint32_t d;
- char charBuffer[zaxisNstrings * CDI_MAX_NAME];
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
intBuffer, zaxisNint, DATATYPE_INT, context);
@@ -1635,17 +1527,12 @@ zaxisUnpack(char * unpackBuffer, int unpackBufferSize,
xassert(cdiCheckSum(DATATYPE_FLT64, size, zaxisP->vct) == d);
}
- serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
- charBuffer, zaxisNstrings * CDI_MAX_NAME, DATATYPE_TXT, context);
- serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
- &d, 1, DATATYPE_UINT32, context);
-
- xassert(d == cdiCheckSum(DATATYPE_TXT, zaxisNstrings * CDI_MAX_NAME, charBuffer));
-
- memcpy ( zaxisP->name, &charBuffer[CDI_MAX_NAME * 0], CDI_MAX_NAME );
- memcpy ( zaxisP->longname, &charBuffer[CDI_MAX_NAME * 1], CDI_MAX_NAME );
- memcpy ( zaxisP->stdname, &charBuffer[CDI_MAX_NAME * 2], CDI_MAX_NAME );
- memcpy ( zaxisP->units, &charBuffer[CDI_MAX_NAME * 3], CDI_MAX_NAME );
+ {
+ char *strTab[] = ZAXIS_STR_SERIALIZE;
+ int numStr = sizeof (strTab) / sizeof (strTab[0]);
+ serializeStrTabUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
+ strTab, numStr, context);
+ }
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&zaxisP->positive, 1, DATATYPE_UCHAR, context);
@@ -1664,7 +1551,6 @@ zaxisPack(void * voidP, void * packBuffer, int packBufferSize,
int intBuffer[zaxisNint];
int memberMask;
uint32_t d;
- char charBuffer[zaxisNstrings * CDI_MAX_NAME];
intBuffer[0] = zaxisP->self;
intBuffer[1] = zaxisP->prec;
@@ -1735,16 +1621,12 @@ zaxisPack(void * voidP, void * packBuffer, int packBufferSize,
packBuffer, packBufferSize, packBufferPos, context);
}
- memcpy ( &charBuffer[CDI_MAX_NAME * 0], zaxisP->name, CDI_MAX_NAME );
- memcpy ( &charBuffer[CDI_MAX_NAME * 1], zaxisP->longname, CDI_MAX_NAME );
- memcpy ( &charBuffer[CDI_MAX_NAME * 2], zaxisP->stdname, CDI_MAX_NAME );
- memcpy ( &charBuffer[CDI_MAX_NAME * 3], zaxisP->units, CDI_MAX_NAME );
-
- serializePack(charBuffer, zaxisNstrings * CDI_MAX_NAME, DATATYPE_TXT,
- packBuffer, packBufferSize, packBufferPos, context);
- d = cdiCheckSum(DATATYPE_TXT, zaxisNstrings * CDI_MAX_NAME, charBuffer);
- serializePack(&d, 1, DATATYPE_UINT32,
- packBuffer, packBufferSize, packBufferPos, context);
+ {
+ const char *strTab[] = ZAXIS_STR_SERIALIZE;
+ int numStr = sizeof (strTab) / sizeof (strTab[0]);
+ serializeStrTabPack(strTab, numStr,
+ packBuffer, packBufferSize, packBufferPos, context);
+ }
serializePack(&zaxisP->positive, 1, DATATYPE_UCHAR,
packBuffer, packBufferSize, packBufferPos, context);
@@ -1760,6 +1642,9 @@ void zaxisGetIndexList ( int nzaxis, int * zaxisResHs )
{
reshGetResHListOfType ( nzaxis, zaxisResHs, &zaxisOps );
}
+
+#undef ZAXIS_STR_SERIALIZE
+
/*
* Local Variables:
* c-file-style: "Java"
diff --git a/libcdi/tests/Makefile.in b/libcdi/tests/Makefile.in
index f08ea25..fb5a73d 100644
--- a/libcdi/tests/Makefile.in
+++ b/libcdi/tests/Makefile.in
@@ -110,6 +110,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
$(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \
$(top_srcdir)/m4/acx_check_strptr_convert.m4 \
+ $(top_srcdir)/m4/acx_execinfo.m4 \
$(top_srcdir)/m4/acx_lang_other_suffix_conftest.m4 \
$(top_srcdir)/m4/acx_options.m4 \
$(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \
diff --git a/libcdi/tests/deco2d_model.c b/libcdi/tests/deco2d_model.c
index e5b2e4d..c75902e 100644
--- a/libcdi/tests/deco2d_model.c
+++ b/libcdi/tests/deco2d_model.c
@@ -31,6 +31,7 @@ typedef int MPI_Comm;
#include "pio_write.h"
#include "simple_model_helper.h"
+#include "create_uuid.h"
enum {
ntfiles = 2,
@@ -57,15 +58,11 @@ modelRegionCompute(double region[], int nlev, int nlat, int nlon,
for (unsigned j = 0; j < n; ++j)
for (unsigned i = 0; i < m; ++i)
region[k * kstride + j * jstride + i]
- = sign_flat(round((cos(2.0 * M_PI
- * (lons[(i + is + (unsigned)tsID)
- %(unsigned)nlon] - lons[0])
- / (lons[nlon-1] - lons[0]))
- * sin(2.0 * M_PI
- * (lats[(j + js + k + ks)%(unsigned)nlat]
- - lats[0])
- / (lats[nlat-1] - lats[0]))
- ) * mscale)) * mrscale;
+ = dg_wobble((lons[(i + is + (unsigned)tsID)%(unsigned)nlon] - lons[0])
+ / (lons[nlon-1] - lons[0]),
+ (lats[(j + js + k + ks)%(unsigned)nlat] - lats[0])
+ / (lats[nlat-1] - lats[0]),
+ mscale, mrscale);
}
#ifdef USE_MPI
@@ -149,12 +146,21 @@ modelRun(struct model_config setup, MPI_Comm comm)
lats[i] = ((double)(i * 180))/nlat - 90.0;
gridDefXvals ( gridID, lons );
gridDefYvals ( gridID, lats );
-
+ {
+ unsigned char uuid[CDI_UUID_SIZE];
+ if (rank == 0)
+ create_uuid(uuid);
+#if USE_MPI
+ MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm);
+#endif
+ gridDefUUID(gridID, uuid);
+ }
levs = xmalloc((size_t)setup.max_nlev * sizeof (levs[0]));
- for (i = 0; i < setup.max_nlev; ++i)
- levs[i] = 101300.0
- - 3940.3 * (exp(1.3579 * (double)(i)/(setup.max_nlev - 1)) - 1.0);
-
+ {
+ double lscale = 1.0/(double)(setup.max_nlev - 1);
+ for (i = 0; i < setup.max_nlev; ++i)
+ levs[i] = 101300.0 - 13000.0 * expm1(2.173 * (double)i * lscale);
+ }
vlistID = vlistCreate ();
varDesc = xmalloc((size_t)nVars * sizeof (varDesc[0]));
@@ -181,9 +187,23 @@ modelRun(struct model_config setup, MPI_Comm comm)
varDesc[varIdx].zaxisID = varDesc[i].zaxisID;
goto zaxisIDset;
}
- varDesc[varIdx].zaxisID
- = zaxisCreate(ZAXIS_PRESSURE, varDesc[varIdx].nlev);
- zaxisDefLevels(varDesc[varIdx].zaxisID, levs);
+ if (varLevs == 1)
+ varDesc[varIdx].zaxisID = zaxisCreate(ZAXIS_SURFACE, 1);
+ else
+ {
+ varDesc[varIdx].zaxisID
+ = zaxisCreate(ZAXIS_PRESSURE, varDesc[varIdx].nlev);
+ zaxisDefLevels(varDesc[varIdx].zaxisID, levs);
+ }
+ {
+ unsigned char uuid[16];
+ if (rank == 0)
+ create_uuid(uuid);
+#if USE_MPI
+ MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm);
+#endif
+ zaxisDefUUID(varDesc[varIdx].zaxisID, uuid);
+ }
zaxisIDset:
varDesc[varIdx].id
= vlistDefVar(vlistID, gridID, varDesc[varIdx].zaxisID, TIME_VARIABLE);
diff --git a/libcdi/tests/simple_model.c b/libcdi/tests/simple_model.c
index 774f342..079433b 100644
--- a/libcdi/tests/simple_model.c
+++ b/libcdi/tests/simple_model.c
@@ -51,11 +51,10 @@ modelRegionCompute(double region[], size_t offset, size_t len,
int j = (int)(global_pos % (size_t)(nlon * nlat) / (size_t)nlon);
int i = (int)(global_pos % (size_t)nlon);
region[local_pos]
- = sign_flat(round((cos(2.0 * M_PI * (lons[(i + tsID)%nlon] - lons[0])
- / (lons[nlon-1] - lons[0]))
- * sin(2.0 * M_PI * (lats[(j + k)%nlat] - lats[0])
- / (lats[nlat-1] - lats[0]))
- ) * mscale)) * mrscale;
+ = dg_wobble((lons[(i + tsID)%nlon] - lons[0])
+ / (lons[nlon-1] - lons[0]),
+ (lats[(j + k)%nlat] - lats[0])
+ / (lats[nlat-1] - lats[0]), mscale, mrscale);
}
}
@@ -125,10 +124,11 @@ modelRun(struct model_config setup, MPI_Comm comm)
gridDefUUID(gridID, uuid);
}
levs = xmalloc((size_t)setup.max_nlev * sizeof (levs[0]));
- for (i = 0; i < setup.max_nlev; ++i)
- levs[i] = 101300.0
- - 3940.3 * (exp(1.3579 * (double)(i)/(setup.max_nlev - 1)) - 1.0);
-
+ {
+ double lscale = 1.0/(double)(setup.max_nlev - 1);
+ for (i = 0; i < setup.max_nlev; ++i)
+ levs[i] = 101300.0 - 13000.0 * expm1(2.173 * (double)i * lscale);
+ }
vlistID = vlistCreate ();
varDesc = xmalloc((size_t)nVars * sizeof (varDesc[0]));
@@ -184,14 +184,12 @@ modelRun(struct model_config setup, MPI_Comm comm)
(int32_t)varDesc[varIdx].size }, comm_size, rank);
int start = range.first;
int chunkSize = range.size;
- fprintf(stderr, "%d: start=%d, chunkSize = %d\n", rank,
- start, chunkSize);
- Xt_idxlist idxlist
- = xt_idxstripes_new(&(struct Xt_stripe){ .start = start,
- .nstrides = chunkSize, .stride = 1 }, 1);
- varDesc[varIdx].start = start;
- varDesc[varIdx].chunkSize = chunkSize;
- varDesc[varIdx].partDesc = idxlist;
+ Xt_idxlist idxlist
+ = xt_idxstripes_new(&(struct Xt_stripe){ .start = start,
+ .nstrides = chunkSize, .stride = 1 }, 1);
+ varDesc[varIdx].start = start;
+ varDesc[varIdx].chunkSize = chunkSize;
+ varDesc[varIdx].partDesc = idxlist;
}
#endif
varDesc[varIdx].code = 129 + varIdx;
diff --git a/libcdi/tests/simple_model_helper.h b/libcdi/tests/simple_model_helper.h
index d74c215..b7509e8 100644
--- a/libcdi/tests/simple_model_helper.h
+++ b/libcdi/tests/simple_model_helper.h
@@ -6,6 +6,7 @@
#endif
#include <inttypes.h>
+#include <math.h>
#include <time.h>
void
@@ -19,6 +20,15 @@ sign_flat(double v)
return v;
}
+/* data generator function */
+static inline double
+dg_wobble(double frac_x, double frac_y, double mscale, double mrscale)
+{
+ double r = sign_flat(round((cos(2.0 * M_PI * frac_x)
+ * sin(2.0 * M_PI * frac_y)) * mscale)) * mrscale;
+ return r;
+}
+
time_t
cditime2time_t(int date, int timeofday);
void
diff --git a/libcdi/tests/test_cdf_read.c b/libcdi/tests/test_cdf_read.c
index d73abe8..167158c 100644
--- a/libcdi/tests/test_cdf_read.c
+++ b/libcdi/tests/test_cdf_read.c
@@ -8,6 +8,9 @@
#include "cdi.h"
+static void
+printAtts(int vlistID);
+
int main(int argc, const char **argv)
{
const char *fname = "test.nc";
@@ -30,11 +33,13 @@ int main(int argc, const char **argv)
size_t bufSize = 0;
size_t allNmissSum = 0;
+ printAtts(vlistID);
+
for (int tsID = 0; streamInqTimestep(streamID, tsID); ++tsID)
{
for (size_t varID = 0; varID < nVars; ++varID)
{
- size_t memSize = (size_t)vlistInqVarSize(vlistID, varID)
+ size_t memSize = (size_t)vlistInqVarSize(vlistID, (int)varID)
* sizeof (double);
int nmiss;
if (memSize > bufSize)
@@ -58,6 +63,111 @@ int main(int argc, const char **argv)
return EXIT_SUCCESS;
}
+static void
+printAtts(int vlistID)
+{
+ size_t nVars = (size_t)vlistNvars(vlistID);
+ static const char globDesc[] = "global",
+ varDescPrefix[] = "variable ";
+ size_t digitsPerInt = 9;
+ size_t bufSize = digitsPerInt + sizeof (varDescPrefix);
+ void *restrict buf = malloc(bufSize);
+ if (!buf)
+ {
+ perror("attribute buffer resize failed");
+ exit(EXIT_FAILURE);
+ }
+ for (size_t varIdx = 0; varIdx <= nVars; ++varIdx)
+ {
+ int nAtts, attType, attLen;
+ char attName[CDI_MAX_NAME + 1];
+ int varID = (int)varIdx - 1;
+ vlistInqNatts(vlistID, varID, &nAtts);
+ for (size_t attIdx = 0; attIdx < (size_t)nAtts; attIdx++ )
+ {
+ int rc = vlistInqAtt(vlistID, varID, (int)attIdx,
+ attName, &attType, &attLen);
+ {
+ const char *varDesc = varIdx > 0
+ ? (sprintf(buf, "%s%d", varDescPrefix,
+ vlistInqVarCode(vlistID, varID)), buf)
+ : globDesc;
+ printf("%s attribute \"%s\", value: ",
+ varDesc, attName);
+ }
+ if (attLen < 0)
+ goto attGetFail;
+ size_t elemSize = 0;
+ switch (attType)
+ {
+ case DATATYPE_TXT:
+ elemSize = 1;
+ break;
+ case DATATYPE_FLT:
+ elemSize = sizeof (double);
+ break;
+ case DATATYPE_INT:
+ elemSize = sizeof (int);
+ break;
+ }
+
+ size_t attSize = elemSize * ((size_t)attLen + 1);
+ if (attSize > bufSize)
+ {
+ if (!(buf = realloc(buf, attSize)))
+ {
+ perror("attribute buffer resize failed");
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ switch (attType)
+ {
+ case DATATYPE_TXT:
+ rc = vlistInqAttTxt(vlistID, (int)varID, attName,
+ attLen, buf);
+ if (rc == CDI_NOERR)
+ printf("\"%.*s\"", attLen, (char *)buf);
+ break;
+ case DATATYPE_FLT:
+ rc = vlistInqAttFlt(vlistID, (int)varID, attName,
+ attLen + 1, buf);
+ if (rc == CDI_NOERR && attLen)
+ {
+ const double *restrict dp = buf;
+ printf("%10g", dp[0]);
+ for (size_t i = 1; i < (size_t)attLen; ++i)
+ printf(", %10g", dp[i]);
+ }
+ break;
+ case DATATYPE_INT:
+ rc = vlistInqAttInt(vlistID, (int)varID, attName,
+ attLen + 1, buf);
+ if (rc == CDI_NOERR && attLen)
+ {
+ const int *restrict ip = buf;
+ printf("%d", ip[0]);
+ for (size_t i = 1; i < (size_t)attLen; ++i)
+ printf(", %d", ip[i]);
+ }
+ break;
+ }
+
+ if (rc == CDI_NOERR)
+ {
+ putchar('\n');
+ }
+ else
+ {
+ attGetFail:
+ puts("error retrieving value");
+ }
+ }
+ }
+ free(buf);
+}
+
+
/*
* Local Variables:
* c-file-style: "Java"
diff --git a/libcdi/tests/test_cdf_transformation.in b/libcdi/tests/test_cdf_transformation.in
index 5200dd8..3a3e36a 100644
--- a/libcdi/tests/test_cdf_transformation.in
+++ b/libcdi/tests/test_cdf_transformation.in
@@ -18,6 +18,11 @@ if [ "$missValueCount" -ne 1 ]; then
echo "Mismatch in expected number of missing values!" >&2
exit 1
fi
+if ! echo "$digest" | grep 'variable 1 attribute "CDI Text Attribute test, created by", value: "CDI test_cdf_write"' >/dev/null; then
+ echo "Expected attribute not found" >&2
+ exit 1
+fi
+
#
# Local Variables:
# mode: sh
diff --git a/libcdi/tests/test_cdf_write.c b/libcdi/tests/test_cdf_write.c
index d7c3634..b3f4fff 100644
--- a/libcdi/tests/test_cdf_write.c
+++ b/libcdi/tests/test_cdf_write.c
@@ -27,7 +27,7 @@ int main(int argc, const char **argv)
{
/* todo: handle optional arguments here to increase test coverage */
const char *fname = "test.nc";
- if (argc)
+ if (argc > 1)
fname = argv[1];
int streamID = streamOpenWrite(fname, FILETYPE_NC);
@@ -73,6 +73,11 @@ int main(int argc, const char **argv)
int vlistID = vlistCreate();
int varID = vlistDefVar(vlistID, gridID, zaxisID, TSTEP_INSTANT);
vlistDefVarMissval(vlistID, varID, missValue);
+ {
+ static const char creatorText[] = "CDI test_cdf_write";
+ vlistDefAttTxt(vlistID, varID, "CDI Text Attribute test, created by",
+ sizeof (creatorText) - 1, creatorText);
+ }
int taxisID = taxisCreate(TAXIS_ABSOLUTE);
vlistDefTaxis(vlistID, taxisID);
diff --git a/libcdi/tests/test_resource_copy.c b/libcdi/tests/test_resource_copy.c
index e8a6c88..c0a4f89 100644
--- a/libcdi/tests/test_resource_copy.c
+++ b/libcdi/tests/test_resource_copy.c
@@ -21,8 +21,6 @@
typedef int MPI_Comm;
#endif
-extern void arrayDestroy ( void );
-
enum {
DOUBLE_PRECISION = 8,
nlon = 12,
diff --git a/m4/._ax_pthread.m4 b/m4/._ax_pthread.m4
deleted file mode 100644
index 77b299d..0000000
Binary files a/m4/._ax_pthread.m4 and /dev/null differ
diff --git a/m4/acx_options.m4 b/m4/acx_options.m4
index 37f61fa..a5eefc3 100644
--- a/m4/acx_options.m4
+++ b/m4/acx_options.m4
@@ -135,10 +135,12 @@ AC_SUBST([HDF5_INCLUDE])
AC_SUBST([HDF5_LIBS])
# ----------------------------------------------------------------------
# Compile application with netcdf
-ENABLE_NETCDF=no
NETCDF_ROOT=''
NETCDF_INCLUDE=''
NETCDF_LIBS=''
+ENABLE_NETCDF=no
+ENABLE_NC2=no
+ENABLE_NC4=no
AC_ARG_WITH([netcdf],
[AS_HELP_STRING([--with-netcdf=<yes|no|directory> (default=no)],[location of netcdf library (lib and include subdirs)])],
[AS_CASE(["$with_netcdf"],
@@ -156,10 +158,12 @@ AC_ARG_WITH([netcdf],
[AC_MSG_CHECKING([netcdf's nc2 support])
AS_IF([test "x$($NC_CONFIG --has-nc2)" = "xyes"],
[AC_DEFINE([HAVE_NETCDF2],[1],[Define to 1 for NETCDF2 support])
+ ENABLE_NC2=yes
AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])
AC_MSG_CHECKING([netcdf's nc4 support])
AS_IF([test "x$($NC_CONFIG --has-nc4)" = "xyes"],
[AC_DEFINE([HAVE_NETCDF4],[1],[Define to 1 for NETCDF4 support])
+ ENABLE_NC4=yes
AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])],
[AS_ECHO([Could not find nc-config! go on with default configuration])])],
[*],[AS_IF([test -d "$with_netcdf"],
@@ -185,16 +189,20 @@ AC_ARG_WITH([netcdf],
[AC_MSG_CHECKING([netcdf's nc2 support])
AS_IF([test "x$($NC_CONFIG --has-nc2)" = "xyes"],
[AC_DEFINE([HAVE_NETCDF2],[1],[Define to 1 for NETCDF2 support])
+ ENABLE_NC2=yes
AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])
AC_MSG_CHECKING([netcdf's nc4 support])
AS_IF([test "x$($NC_CONFIG --has-nc4)" = "xyes"],
[AC_DEFINE([HAVE_NETCDF4],[1],[Define to 1 for NETCDF4 support])
+ ENABLE_NC4=yes
AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])],
[AC_MSG_RESULT([Could not find nc-config! go on with default configuration])])],
[AC_MSG_NOTICE([$with_netcdf is not a directory! NETCDF suppressed])])])],
[AC_MSG_CHECKING([for NETCDF library])
AC_MSG_RESULT([suppressed])])
AC_SUBST([ENABLE_NETCDF])
+AC_SUBST([ENABLE_NC2])
+AC_SUBST([ENABLE_NC4])
AC_SUBST([NETCDF_ROOT])
AC_SUBST([NETCDF_INCLUDE])
AC_SUBST([NETCDF_LIBS])
@@ -228,6 +236,7 @@ AC_SUBST([JASPER_LIBS])
# Compile application with GRIB_API library (for GRIB2 support)
GRIB_API_INCLUDE=''
GRIB_API_LIBS=''
+ENABLE_GRIBAPI=no
AC_ARG_WITH([grib_api],
[AS_HELP_STRING([--with-grib_api=<yes|no|directory>],
[library for grib2 compression; if a directory is given, it will be used as a value for --with-jasper-root])],
@@ -237,7 +246,8 @@ AC_ARG_WITH([grib_api],
[yes],[AC_CHECK_HEADERS([grib_api.h])
AC_SEARCH_LIBS([grib_get_message],
[grib_api],
- [AC_DEFINE([HAVE_LIBGRIB_API],[1],[GRIB_API library is present if defined to 1])],
+ [AC_DEFINE([HAVE_LIBGRIB_API],[1],[GRIB_API library is present if defined to 1])
+ ENABLE_GRIBAPI=yes],
[AC_MSG_ERROR([Could not link to grib_api library])])],
[*],[GRIB_API_ROOT=$with_grib_api
AS_IF([test -d "$GRIB_API_ROOT"],
@@ -246,7 +256,8 @@ AC_ARG_WITH([grib_api],
AC_CHECK_HEADERS([grib_api.h])
AC_SEARCH_LIBS([grib_get_message],
[grib_api],
- [AC_DEFINE([HAVE_LIBGRIB_API],[1],[GRIB_API library is present if defined to 1])],
+ [AC_DEFINE([HAVE_LIBGRIB_API],[1],[GRIB_API library is present if defined to 1])
+ ENABLE_GRIBAPI=yes],
[AC_MSG_ERROR([Could not link to grib_api library])])
GRIB_API_LIBS=" -L$GRIB_API_ROOT/lib -lgrib_api"
GRIB_API_INCLUDE=" -I$GRIB_API_ROOT/include"],
@@ -255,6 +266,7 @@ AC_ARG_WITH([grib_api],
AC_MSG_RESULT([suppressed])])
AC_SUBST([GRIB_API_INCLUDE])
AC_SUBST([GRIB_API_LIBS])
+AC_SUBST([ENABLE_GRIBAPI])
# ----------------------------------------------------------------------
# Enable GRIB support
AC_MSG_CHECKING([for GRIB support])
@@ -513,3 +525,7 @@ AC_ARG_ENABLE([all-static],
AC_MSG_RESULT([$enable_all_static])
AM_CONDITIONAL([ENABLE_ALL_STATIC],[test x$enable_all_static = 'xyes'])
])
+dnl
+dnl Local Variables:
+dnl mode: autoconf
+dnl End:
diff --git a/src/Adisit.c b/src/Adisit.c
index ccc4656..adc0c8e 100644
--- a/src/Adisit.c
+++ b/src/Adisit.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Arith.c b/src/Arith.c
index b64a962..7dae0b8 100644
--- a/src/Arith.c
+++ b/src/Arith.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Arithc.c b/src/Arithc.c
index abd255c..822779b 100644
--- a/src/Arithc.c
+++ b/src/Arithc.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Arithdays.c b/src/Arithdays.c
index 999c7a5..4d31bda 100644
--- a/src/Arithdays.c
+++ b/src/Arithdays.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Arithlat.c b/src/Arithlat.c
index 32fb17f..d30275f 100644
--- a/src/Arithlat.c
+++ b/src/Arithlat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/CDIread.c b/src/CDIread.c
index e5a0ee1..67d8332 100644
--- a/src/CDIread.c
+++ b/src/CDIread.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/CDItest.c b/src/CDItest.c
index 6c012d2..479cb2e 100644
--- a/src/CDItest.c
+++ b/src/CDItest.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/CDIwrite.c b/src/CDIwrite.c
index 3870a2b..4cdb5fc 100644
--- a/src/CDIwrite.c
+++ b/src/CDIwrite.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -20,6 +20,7 @@
#include "cdo.h"
#include "cdo_int.h"
#include "pstream.h"
+#include "grid.h"
static
@@ -97,7 +98,7 @@ void *CDIwrite(void *argument)
int tsID, varID, levelID;
int gridsize, i;
int vlistID;
- int gridID = -1, zaxisID, taxisID;
+ int zaxisID, taxisID;
int vdate, vtime, julday;
int filetype = -1, datatype = -1;
int irun, nruns = 1;
@@ -144,7 +145,7 @@ void *CDIwrite(void *argument)
if ( ntimesteps <= 0 ) ntimesteps = 1;
if ( nvars <= 0 ) nvars = 1;
- gridID = cdoDefineGrid(gridfile);
+ int gridID = cdoDefineGrid(gridfile);
gridsize = gridInqSize(gridID);
if ( nlevs == 1 )
@@ -164,7 +165,33 @@ void *CDIwrite(void *argument)
cdoPrint("nlevs : %d", nlevs);
cdoPrint("ntimesteps : %d", ntimesteps);
cdoPrint("nvars : %d", nvars);
- }
+ }
+
+ double *array = (double*) malloc(gridsize*sizeof(double));
+ double *xvals = (double*) malloc(gridsize*sizeof(double));
+ double *yvals = (double*) malloc(gridsize*sizeof(double));
+
+ int gridID2 = gridID;
+ if ( gridInqType(gridID) == GRID_GME ) gridID2 = gridToUnstructured(gridID, 0);
+
+ if ( gridInqType(gridID) != GRID_UNSTRUCTURED && gridInqType(gridID) != GRID_CURVILINEAR )
+ gridID2 = gridToCurvilinear(gridID, 0);
+
+ gridInqXvals(gridID2, xvals);
+ gridInqYvals(gridID2, yvals);
+
+ /* Convert lat/lon units if required */
+ char units[CDI_MAX_NAME];
+ gridInqXunits(gridID2, units);
+ grid_to_radian(units, gridsize, xvals, "grid center lon");
+ gridInqYunits(gridID2, units);
+ grid_to_radian(units, gridsize, yvals, "grid center lat");
+
+ for ( i = 0; i < gridsize; i++ )
+ array[i] = 2 - cos(acos(cos(xvals[i]) * cos(yvals[i]))/1.2);
+
+ free(xvals);
+ free(yvals);
vars = (double ***) malloc(nvars*sizeof(double **));
for ( varID = 0; varID < nvars; varID++ )
@@ -174,7 +201,8 @@ void *CDIwrite(void *argument)
{
vars[varID][levelID] = (double*) malloc(gridsize*sizeof(double));
for ( i = 0; i < gridsize; ++i )
- vars[varID][levelID][i] = varID + rand()/(RAND_MAX+1.0);
+ vars[varID][levelID][i] = varID + array[i]*(levelID+1);
+ // vars[varID][levelID][i] = varID + rand()/(RAND_MAX+1.0);
}
}
@@ -272,6 +300,8 @@ void *CDIwrite(void *argument)
}
free(vars);
+ free(array);
+
if ( farray ) free(farray);
cdoFinish();
diff --git a/src/Cat.c b/src/Cat.c
index 56a4e1a..ba5e6c5 100644
--- a/src/Cat.c
+++ b/src/Cat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Change.c b/src/Change.c
index 7f1fa37..b2ee482 100644
--- a/src/Change.c
+++ b/src/Change.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Change_e5slm.c b/src/Change_e5slm.c
index 6c5acb6..182ac3b 100644
--- a/src/Change_e5slm.c
+++ b/src/Change_e5slm.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Cloudlayer.c b/src/Cloudlayer.c
index 3cd2b9c..368b786 100644
--- a/src/Cloudlayer.c
+++ b/src/Cloudlayer.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Collgrid.c b/src/Collgrid.c
index a904873..9f41da4 100644
--- a/src/Collgrid.c
+++ b/src/Collgrid.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Command.c b/src/Command.c
index ff9a708..6f011b5 100644
--- a/src/Command.c
+++ b/src/Command.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Comp.c b/src/Comp.c
index 1233752..713dc51 100644
--- a/src/Comp.c
+++ b/src/Comp.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Compc.c b/src/Compc.c
index aedab51..e0e4ec3 100644
--- a/src/Compc.c
+++ b/src/Compc.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Complextorect.c b/src/Complextorect.c
index e52a71c..f1bbe06 100644
--- a/src/Complextorect.c
+++ b/src/Complextorect.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Cond.c b/src/Cond.c
index 07e8df7..e182385 100644
--- a/src/Cond.c
+++ b/src/Cond.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Cond2.c b/src/Cond2.c
index a71be1c..76484b3 100644
--- a/src/Cond2.c
+++ b/src/Cond2.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Condc.c b/src/Condc.c
index ae42e22..ad0bf01 100644
--- a/src/Condc.c
+++ b/src/Condc.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Consecstat.c b/src/Consecstat.c
index e55486c..a7a3207 100644
--- a/src/Consecstat.c
+++ b/src/Consecstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Copy.c b/src/Copy.c
index 33a3066..c77ddad 100644
--- a/src/Copy.c
+++ b/src/Copy.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Deltime.c b/src/Deltime.c
index 3daf522..d753e86 100644
--- a/src/Deltime.c
+++ b/src/Deltime.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Derivepar.c b/src/Derivepar.c
index 047c6d1..e72f882 100644
--- a/src/Derivepar.c
+++ b/src/Derivepar.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2007-2012 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2007-2012 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.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
diff --git a/src/Detrend.c b/src/Detrend.c
index a57fb37..0c900a0 100644
--- a/src/Detrend.c
+++ b/src/Detrend.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Diff.c b/src/Diff.c
index b10f337..2cc813c 100644
--- a/src/Diff.c
+++ b/src/Diff.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Distgrid.c b/src/Distgrid.c
index d0af9c4..63da588 100644
--- a/src/Distgrid.c
+++ b/src/Distgrid.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Duplicate.c b/src/Duplicate.c
index 2f533e9..a6951a8 100644
--- a/src/Duplicate.c
+++ b/src/Duplicate.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/EOFs.c b/src/EOFs.c
index e0ccac1..11c96cf 100644
--- a/src/EOFs.c
+++ b/src/EOFs.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Echam5ini.c b/src/Echam5ini.c
index de983ed..b86ddad 100644
--- a/src/Echam5ini.c
+++ b/src/Echam5ini.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Enlarge.c b/src/Enlarge.c
index ebd5b80..5e2a424 100644
--- a/src/Enlarge.c
+++ b/src/Enlarge.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Enlargegrid.c b/src/Enlargegrid.c
index ab6f3a0..efd8fcb 100644
--- a/src/Enlargegrid.c
+++ b/src/Enlargegrid.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Ensstat.c b/src/Ensstat.c
index 6cc8374..71fd226 100644
--- a/src/Ensstat.c
+++ b/src/Ensstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Ensstat3.c b/src/Ensstat3.c
index 4c2c7e2..fd14e87 100644
--- a/src/Ensstat3.c
+++ b/src/Ensstat3.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Ensval.c b/src/Ensval.c
index 41d6a24..dd5f180 100644
--- a/src/Ensval.c
+++ b/src/Ensval.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Eof3d.c b/src/Eof3d.c
index 3639e6a..016f87a 100644
--- a/src/Eof3d.c
+++ b/src/Eof3d.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Eofcoeff.c b/src/Eofcoeff.c
index fb7a7a9..283e2ec 100644
--- a/src/Eofcoeff.c
+++ b/src/Eofcoeff.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Eofcoeff3d.c b/src/Eofcoeff3d.c
index 2711e9d..5c32ece 100644
--- a/src/Eofcoeff3d.c
+++ b/src/Eofcoeff3d.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Exprf.c b/src/Exprf.c
index 2cb1d71..fee67ff 100644
--- a/src/Exprf.c
+++ b/src/Exprf.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/FC.c b/src/FC.c
index bde23dd..7b3b966 100644
--- a/src/FC.c
+++ b/src/FC.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Filedes.c b/src/Filedes.c
index ed8828a..cd2af09 100644
--- a/src/Filedes.c
+++ b/src/Filedes.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Fillmiss.c b/src/Fillmiss.c
index 48e1685..96a6c3e 100644
--- a/src/Fillmiss.c
+++ b/src/Fillmiss.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Filter.c b/src/Filter.c
index 6a84930..7238773 100644
--- a/src/Filter.c
+++ b/src/Filter.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Fldrms.c b/src/Fldrms.c
index 092dfc0..4cf3aba 100644
--- a/src/Fldrms.c
+++ b/src/Fldrms.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Fldstat.c b/src/Fldstat.c
index 5b8a77d..1adf609 100644
--- a/src/Fldstat.c
+++ b/src/Fldstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Fldstat2.c b/src/Fldstat2.c
index ccaabe5..ca1ea03 100644
--- a/src/Fldstat2.c
+++ b/src/Fldstat2.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Fourier.c b/src/Fourier.c
index 7ef2d4a..3634dd2 100644
--- a/src/Fourier.c
+++ b/src/Fourier.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Gengrid.c b/src/Gengrid.c
index 49612f8..3935371 100644
--- a/src/Gengrid.c
+++ b/src/Gengrid.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Gradsdes.c b/src/Gradsdes.c
index ab55478..2516040 100644
--- a/src/Gradsdes.c
+++ b/src/Gradsdes.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -31,6 +31,8 @@
#include "cdo_int.h"
#include "pstream.h"
#include "grid.h"
+//#include <string.h> // necessary for compatability? GNU basename
+#include "libgen.h" // posix basename POSIX.1-2001
/*
@@ -934,68 +936,6 @@ void write_map_grib1(const char *ctlfile, int map_version, int nrecords, int *in
}
-/*
- * Remove file extension:
- * -------------------------------------------------
- * Remove file extension if it is the expected one
- * Do nothing otherwise
- */
-static
-void rm_ext(char *file, const char *ext)
-{
- // length of filename
- int namelen = (int) strlen(file);
- // length of the original file extension
- int extlen = (int) strlen(ext);
-
- // delete original extension if it is the expected one
- if ( strcmp(&file[namelen-extlen], ext) == 0 )
- file[namelen-extlen] = 0;
-}
-
-
-/*
- * Return the filetype extension
- * for a given filetype (int)
- * TODO this general function should be somewhere else
- */
-static
-const char *filetypeext(int filetype)
-{
- switch ( filetype )
- {
- case FILETYPE_GRB:
- case FILETYPE_GRB2: return (".grb"); break;
- case FILETYPE_NC:
- case FILETYPE_NC2:
- case FILETYPE_NC4:
- case FILETYPE_NC4C: return (".nc"); break;
- case FILETYPE_SRV: return (".srv"); break;
- case FILETYPE_EXT: return (".ext"); break;
- case FILETYPE_IEG: return (".ieg"); break;
- default: return ("");
- }
-}
-
-
-/*
- * Replace or just add file extension:
- * -------------------------------------------------
- * Replace file extension with new one
- * or just add the new file extension
- * if the original extension is not the expected one
- */
-static
-void repl_filetypeext(char *file, const char *oldext, const char *newext)
-{
- // delete original extension if it is the expected one
- rm_ext(file, oldext);
-
- // add new file extension
- strcat(file, newext);
-}
-
-
static
void write_map_grib2(const char *ctlfile, int map_version, int nrecords, int *intnum, float *fltnum, off_t *bignum)
{
@@ -1019,9 +959,8 @@ void *Gradsdes(void *argument)
int taxisID, nrecs;
int vdate, vtime;
const char *datfile;
- char ctlfile[1024], *pctlfile;
- char idxfile[1024], *pidxfile;
- int len;
+ char ctlfile[1024];
+ char idxfile[1024];
char varname[CDI_MAX_NAME];
FILE *gdp;
int yrev = FALSE;
@@ -1037,7 +976,7 @@ void *Gradsdes(void *argument)
char Time[30], Incr[10] = {"1mn"}, *IncrKey[] = {"mn","hr","dy","mo","yr"};
int isd, imn, ihh, iyy, imm, idd;
int isds = 0, imns = 0, ihhs = 0, iyys = 0, imms = 0, idds = 0;
- int isd0 = 0, imn0 = 0, ihh0 = 0, iyy0 = 0, imm0 = 0, idd0 = 0;
+ int imn0 = 0, ihh0 = 0, iyy0 = 0, imm0 = 0, idd0 = 0;
int idmn, idhh, idmm, idyy, iddd;
int dt=1, iik=0, mdt = 0;
int gridsize = 0;
@@ -1063,6 +1002,12 @@ void *Gradsdes(void *argument)
operatorID = cdoOperatorID();
+ strcpy(ctlfile, cdoStreamName(0)->args);
+ char relpath_sign = '^';
+ if ( ctlfile[0] == '/' )
+ relpath_sign = '\0';
+ datfile = cdoStreamName(0)->args;
+
if ( cdoStreamName(0)->args[0] == '-' )
cdoAbort("This operator does not work with pipes!");
@@ -1198,7 +1143,6 @@ void *Gradsdes(void *argument)
}
/* ctl file name */
- strcpy(ctlfile, cdoStreamName(0)->args);
repl_filetypeext(ctlfile, filetypeext(filetype), ".ctl");
/* open ctl file*/
@@ -1212,59 +1156,39 @@ void *Gradsdes(void *argument)
#endif
/* DSET */
- datfile = cdoStreamName(0)->args;
- if ( datfile[0] == '/' )
- fprintf(gdp, "DSET %s\n", datfile);
- else
- {
- datfile = strrchr(datfile, '/');
- if ( datfile == 0 ) datfile = cdoStreamName(0)->args;
- else datfile++;
- fprintf(gdp, "DSET ^%s\n", datfile);
- }
+ if ( relpath_sign )
+ datfile = basename((char *) datfile);
+ fprintf(gdp, "DSET %c%s\n", relpath_sign, datfile);
/*
* DTYPE Print file type
- * INDEX Print filename of the control file .ctl
+ * INDEX Print filename of the control/index file .ctl/.idx
*/
- if ( filetype == FILETYPE_GRB )
+ if ( filetype == FILETYPE_GRB || filetype == FILETYPE_GRB2 )
{
- fprintf(gdp, "DTYPE GRIB\n");
- pctlfile = ctlfile;
- repl_filetypeext(pctlfile, ".ctl", ".gmp");
+ strcpy(idxfile, ctlfile);
+ char *pidxfile = idxfile;
- if ( datfile[0] == '/' )
- fprintf(gdp, "INDEX %s\n", pctlfile);
- else
+ // print GRIB[12] file type
+ // generate the index file
+ if ( filetype == FILETYPE_GRB )
{
- pctlfile = strrchr(pctlfile, '/');
- if ( pctlfile == 0 ) pctlfile = ctlfile;
- else pctlfile++;
- fprintf(gdp, "INDEX ^%s\n", pctlfile);
+ fprintf(gdp, "DTYPE GRIB\n");
+ repl_filetypeext(idxfile, ".ctl", ".gmp");
+ write_map_grib1(idxfile, map_version, nrecords, intnum, fltnum, bignum);
}
-
- gridsize = vlistGridsizeMax(vlistID);
- array = (double*) malloc(gridsize*sizeof(double));
- }
- else if ( filetype == FILETYPE_GRB2 )
- {
- fprintf(gdp, "DTYPE GRIB2\n");
-
- strcpy(idxfile, ctlfile);
- pidxfile = idxfile;
- repl_filetypeext(pidxfile, ".ctl", ".idx");
-
- if ( datfile[0] == '/' )
- fprintf(gdp, "INDEX %s\n", pidxfile);
- else
+ else if ( filetype == FILETYPE_GRB2 )
{
- pidxfile = strrchr(pidxfile, '/');
- if ( pidxfile == 0 ) pidxfile = idxfile;
- else pidxfile++;
- fprintf(gdp, "INDEX ^%s\n", pidxfile);
+ fprintf(gdp, "DTYPE GRIB2\n");
+ repl_filetypeext(pidxfile, ".ctl", ".idx");
+ // TODO: write_map_grib2();
}
+ // print file name of index file
+ if ( relpath_sign )
+ pidxfile = basename((char *) pidxfile);
+ fprintf(gdp, "INDEX %c%s\n", relpath_sign, pidxfile);
gridsize = vlistGridsizeMax(vlistID);
array = (double*) malloc(gridsize*sizeof(double));
@@ -1470,7 +1394,6 @@ void *Gradsdes(void *argument)
/* INDEX file */
if ( filetype == FILETYPE_GRB )
{
- write_map_grib1(ctlfile, map_version, nrecords, intnum, fltnum, bignum);
}
if ( filetype == FILETYPE_GRB2 )
{
diff --git a/src/Gridboxstat.c b/src/Gridboxstat.c
index 0c52ab3..6e774e8 100644
--- a/src/Gridboxstat.c
+++ b/src/Gridboxstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Gridcell.c b/src/Gridcell.c
index 883b5cd..f5ca490 100644
--- a/src/Gridcell.c
+++ b/src/Gridcell.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Gridsearch.c b/src/Gridsearch.c
index ab56a1d..14b9ba7 100644
--- a/src/Gridsearch.c
+++ b/src/Gridsearch.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Harmonic.c b/src/Harmonic.c
index ab66f38..2e104a1 100644
--- a/src/Harmonic.c
+++ b/src/Harmonic.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Hi.c b/src/Hi.c
old mode 100755
new mode 100644
diff --git a/src/Histogram.c b/src/Histogram.c
index d009520..fbc8c56 100644
--- a/src/Histogram.c
+++ b/src/Histogram.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Importamsr.c b/src/Importamsr.c
index 4d42244..019ac87 100644
--- a/src/Importamsr.c
+++ b/src/Importamsr.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Importbinary.c b/src/Importbinary.c
index db4607c..995926f 100644
--- a/src/Importbinary.c
+++ b/src/Importbinary.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Importcmsaf.c b/src/Importcmsaf.c
index 50941c2..f13af84 100644
--- a/src/Importcmsaf.c
+++ b/src/Importcmsaf.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -98,8 +98,7 @@ void print_filter(hid_t dset_id, char *varname)
}
static
-void get_grid_info(double c0, double re, int *nrxp, int *nryp,
- double *r0p, double *s0p, double *cp)
+void get_grid_info(double c0, double re, int *nrxp, int *nryp, double *r0p, double *s0p, double *cp)
{
const double pi = M_PI;
double git, phi, s90;
@@ -108,7 +107,7 @@ void get_grid_info(double c0, double re, int *nrxp, int *nryp,
git=2.*pi*re*cos(pi/6.)/c0;
/* number of longitude pixels */
- nrx=2*lround(0.5*git);
+ nrx=2*(int)lround(0.5*git);
/* central index in longitude */
r0=nrx/2+0.5;
@@ -475,8 +474,8 @@ int read_geolocation(hid_t loc_id, int nx, int ny, int lprojtype)
H5Gclose(grp_id);
/* check region */
- xsize = lround((region.xmax-region.xmin)/region.dx);
- ysize = lround((region.ymax-region.ymin)/region.dy);
+ xsize = (int)lround((region.xmax-region.xmin)/region.dx);
+ ysize = (int)lround((region.ymax-region.ymin)/region.dy);
if ( cdoVerbose ) cdoPrint(" Size: xsize=%d ysize=%d", xsize, ysize);
@@ -495,8 +494,8 @@ int read_geolocation(hid_t loc_id, int nx, int ny, int lprojtype)
cdoPrint(" Corrected region: xmin=%g xmax=%g ymin=%g ymax=%g dx=%g dy=%g",
region.xmin, region.xmax, region.ymin, region.ymax, region.dx, region.dy);
- xsize = lround((region.xmax-region.xmin)/region.dx);
- ysize = lround((region.ymax-region.ymin)/region.dy);
+ xsize = (int)lround((region.xmax-region.xmin)/region.dx);
+ ysize = (int)lround((region.ymax-region.ymin)/region.dy);
if ( cdoVerbose ) cdoPrint(" Corrected size: xsize=%d ysize=%d", xsize, ysize);
}
@@ -512,8 +511,8 @@ int read_geolocation(hid_t loc_id, int nx, int ny, int lprojtype)
cdoPrint(" Corrected region: xmin=%g xmax=%g ymin=%g ymax=%g dx=%g dy=%g",
region.xmin, region.xmax, region.ymin, region.ymax, region.dx, region.dy);
- xsize = lround((region.xmax-region.xmin)/region.dx);
- ysize = lround((region.ymax-region.ymin)/region.dy);
+ xsize = (int)lround((region.xmax-region.xmin)/region.dx);
+ ysize = (int)lround((region.ymax-region.ymin)/region.dy);
if ( cdoVerbose ) cdoPrint(" Corrected size: xsize=%d ysize=%d", xsize, ysize);
}
@@ -736,8 +735,8 @@ int read_region(hid_t loc_id, int nx, int ny)
dx = (xmax-xmin) / nx;
dy = (ymax-ymin) / ny;
/*
- xsize = lround((region.xmax-region.xmin)/region.dx);
- ysize = lround((region.ymax-region.ymin)/region.dy);
+ xsize = (int)lround((region.xmax-region.xmin)/region.dx);
+ ysize = (int)lround((region.ymax-region.ymin)/region.dy);
if ( cdoVerbose ) cdoPrint(" Size: xsize=%d ysize=%d", xsize, ysize);
*/
diff --git a/src/Importobs.c b/src/Importobs.c
index eed08da..5176e2f 100644
--- a/src/Importobs.c
+++ b/src/Importobs.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Info.c b/src/Info.c
index b58ca16..e86193f 100644
--- a/src/Info.c
+++ b/src/Info.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Input.c b/src/Input.c
index 5f12b2b..d544352 100644
--- a/src/Input.c
+++ b/src/Input.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Intgrid.c b/src/Intgrid.c
index 837847e..f86a3f4 100644
--- a/src/Intgrid.c
+++ b/src/Intgrid.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Intgridtraj.c b/src/Intgridtraj.c
index 847a5e9..2d95a8d 100644
--- a/src/Intgridtraj.c
+++ b/src/Intgridtraj.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Intlevel.c b/src/Intlevel.c
index f9dfac9..e9ad253 100644
--- a/src/Intlevel.c
+++ b/src/Intlevel.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Intlevel3d.c b/src/Intlevel3d.c
index 8b0ff5f..faf59db 100644
--- a/src/Intlevel3d.c
+++ b/src/Intlevel3d.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -203,7 +203,7 @@ void *Intlevel3d(void *argument)
double *lonIn, *latIn, *lonOut, *latOut;
int zaxisID1 = -1, zaxisID3;
- int gridID, zaxisID;
+ int gridID3 = -1, gridID, zaxisID;
int nlevi, nlevo, nlevel = 0, maxlev;
int lup, ldown;
int **varnmiss = NULL;
@@ -292,6 +292,7 @@ void *Intlevel3d(void *argument)
nvars = vlistNvars(vlistID2);
if (nvars != 1) cdoAbort("Only one single variable is allowed!");
gridID = vlistInqVarGrid(vlistID2, varID);
+ gridID3 = gridID;
zaxisID = vlistInqVarZaxis(vlistID2, varID);
gridsize = gridInqSize(gridID);
nlevel = zaxisInqSize(zaxisID);
@@ -321,14 +322,14 @@ void *Intlevel3d(void *argument)
/* Missing values are not allowed for coordinate variables */
if ( 0 != zlevels_in_miss )
- cdoAbort("Input vertical coordinate variables are not allowd to contian missing values.");
+ cdoAbort("Input vertical coordinate variables are not allowd to contain missing values.");
else
{
if ( cdoVerbose ) cdoPrint("Input vertical coordinate has no missing values.");
}
if ( 0 != zlevels_out_miss )
- cdoAbort("Output vertical coordinate variables are not allowd to contian missing values.");
+ cdoAbort("Output vertical coordinate variables are not allowd to contain missing values.");
else
{
if ( cdoVerbose ) cdoPrint("Output vertical coordinate has no missing values.");
@@ -448,7 +449,7 @@ void *Intlevel3d(void *argument)
if ( zaxisID1 == vlistZaxis(vlistID1, i) )
vlistChangeZaxisIndex(vlistID3, i, zaxisID3);
/* add the vertical output field to the output stream */
- int oz3dvarID = vlistDefVar(vlistID3,0,zaxisID3,TSTEP_INSTANT);
+ int oz3dvarID = vlistDefVar(vlistID3, gridID3, zaxisID3, TSTEP_INSTANT);
{
char str[256];
str[0] = 0;
@@ -456,7 +457,7 @@ void *Intlevel3d(void *argument)
vlistDefVarName(vlistID3,oz3dvarID,str);
str[0] = 0;
vlistInqVarLongname(vlistID2,0,str);
- if ( str[0] ) vlistDefVarLongname(vlistID3,zaxisID1, str);
+ if ( str[0] ) vlistDefVarLongname(vlistID3,oz3dvarID, str);
str[0] = 0;
vlistInqVarUnits(vlistID2,0, str);
if ( str[0] ) vlistDefVarUnits(vlistID3,oz3dvarID, str);
@@ -473,7 +474,7 @@ void *Intlevel3d(void *argument)
varinterp = (int*) malloc(nvars*sizeof(int)); /* marker for variables to be interpolated */
/* by default no variable should be interpolated */
- for (i = 0; i < nvars;i++)
+ for ( i = 0; i < nvars; i++ )
varinterp[varID] = FALSE;
for ( varID = 0; varID < nvars; varID++ )
@@ -492,7 +493,7 @@ void *Intlevel3d(void *argument)
* * have the same number of horizontal grid points (i.e. same gridSize) like the two vertical coordinates
* * are NOT the output vertical coordinates itself
*/
- if ( zaxisID == zaxisID1 && varID != oz3dvarID && gridsize == gridSize)
+ if ( zaxisID == zaxisID1 && varID != oz3dvarID && gridsize == gridSize )
{
nlonIn = gridInqXsize(gridID);
nlatIn = gridInqYsize(gridID);
@@ -600,6 +601,7 @@ void *Intlevel3d(void *argument)
}
}
}
+
/* copy output z coordinate to output stream */
nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID3, oz3dvarID));
for ( levelID = 0; levelID < nlevel; levelID++ )
diff --git a/src/Intntime.c b/src/Intntime.c
index f8554b3..8e211df 100644
--- a/src/Intntime.c
+++ b/src/Intntime.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -142,9 +142,8 @@ void *Intntime(void *argument)
for ( it = 1; it < numts; it++ )
{
- double seconds;
- seconds = it * juldate_to_seconds(juldate_sub(juldate2, juldate1)) / numts;
- juldate = juldate_add_seconds(lround(seconds), juldate1);
+ double seconds = it * juldate_to_seconds(juldate_sub(juldate2, juldate1)) / numts;
+ juldate = juldate_add_seconds((int)lround(seconds), juldate1);
juldate_decode(calendar, juldate, &vdate, &vtime);
diff --git a/src/Inttime.c b/src/Inttime.c
index 62114e2..5497a6c 100644
--- a/src/Inttime.c
+++ b/src/Inttime.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Intyear.c b/src/Intyear.c
index 6069101..4ab00b6 100644
--- a/src/Intyear.c
+++ b/src/Intyear.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Invert.c b/src/Invert.c
index 7583309..61ab9fe 100644
--- a/src/Invert.c
+++ b/src/Invert.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Invertlev.c b/src/Invertlev.c
index ea5713c..7418a6e 100644
--- a/src/Invertlev.c
+++ b/src/Invertlev.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Isosurface.c b/src/Isosurface.c
index 0297511..2b1f201 100644
--- a/src/Isosurface.c
+++ b/src/Isosurface.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Kvl.c b/src/Kvl.c
index 26cb43f..113ec86 100644
--- a/src/Kvl.c
+++ b/src/Kvl.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Log.c b/src/Log.c
index c320abb..911542f 100644
--- a/src/Log.c
+++ b/src/Log.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Makefile.in b/src/Makefile.in
index 8d46b8f..76f099b 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -430,7 +430,10 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
ENABLE_DATA = @ENABLE_DATA@
ENABLE_EXTRA = @ENABLE_EXTRA@
ENABLE_GRIB = @ENABLE_GRIB@
+ENABLE_GRIBAPI = @ENABLE_GRIBAPI@
ENABLE_IEG = @ENABLE_IEG@
+ENABLE_NC2 = @ENABLE_NC2@
+ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NETCDF = @ENABLE_NETCDF@
ENABLE_SERVICE = @ENABLE_SERVICE@
EXEEXT = @EXEEXT@
diff --git a/src/Maskbox.c b/src/Maskbox.c
index c2b0d1a..7afdf96 100644
--- a/src/Maskbox.c
+++ b/src/Maskbox.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Mastrfu.c b/src/Mastrfu.c
index 8bf6b01..69eba4a 100644
--- a/src/Mastrfu.c
+++ b/src/Mastrfu.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Math.c b/src/Math.c
index 7a99a82..599913f 100644
--- a/src/Math.c
+++ b/src/Math.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Merge.c b/src/Merge.c
index 5fd7058..d158fa1 100644
--- a/src/Merge.c
+++ b/src/Merge.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Mergegrid.c b/src/Mergegrid.c
index 33bb324..827e3d7 100644
--- a/src/Mergegrid.c
+++ b/src/Mergegrid.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Mergetime.c b/src/Mergetime.c
index 3d09547..69bc8ef 100644
--- a/src/Mergetime.c
+++ b/src/Mergetime.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Merstat.c b/src/Merstat.c
index 9e53884..0334d16 100644
--- a/src/Merstat.c
+++ b/src/Merstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Monarith.c b/src/Monarith.c
index 7c29718..d4583ef 100644
--- a/src/Monarith.c
+++ b/src/Monarith.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Mrotuv.c b/src/Mrotuv.c
index e459678..76577ce 100644
--- a/src/Mrotuv.c
+++ b/src/Mrotuv.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Mrotuvb.c b/src/Mrotuvb.c
index 7f95af4..f573d6b 100644
--- a/src/Mrotuvb.c
+++ b/src/Mrotuvb.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Ninfo.c b/src/Ninfo.c
index 04a670d..a896776 100644
--- a/src/Ninfo.c
+++ b/src/Ninfo.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Nmltest.c b/src/Nmltest.c
index f70fd73..b5c2a8a 100644
--- a/src/Nmltest.c
+++ b/src/Nmltest.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Output.c b/src/Output.c
index 04c257d..9216d55 100644
--- a/src/Output.c
+++ b/src/Output.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Outputgmt.c b/src/Outputgmt.c
index 7a4189e..8161147 100644
--- a/src/Outputgmt.c
+++ b/src/Outputgmt.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -146,6 +146,21 @@ int intersect(double pix, double piy, double pjx, double pjy,
}
static
+int check_ncorner(int ncorner, const double *lon_bounds, const double *lat_bounds)
+{
+ int ncorner_new = ncorner;
+ int k;
+
+ for ( k=ncorner-1; k>0; --k )
+ if ( IS_NOT_EQUAL(lon_bounds[k], lon_bounds[k-1]) ||
+ IS_NOT_EQUAL(lat_bounds[k], lat_bounds[k-1]) ) break;
+
+ if ( k < ncorner-1 ) ncorner_new = k+1;
+
+ return ncorner_new;
+}
+
+static
void verify_grid(int gridtype, int gridsize, int ncorner,
double *grid_center_lon, double *grid_center_lat,
double *grid_corner_lon, double *grid_corner_lat)
@@ -212,19 +227,24 @@ void verify_grid(int gridtype, int gridsize, int ncorner,
if ( nout == 1 )
{
fprintf(stdout,"\n CENTER IS OUT OF BOUNDS");
- fprintf(stdout,"\n :");
+ fprintf(stdout,"\n :");
for ( k = 0; k < ncorner; k++ )
- fprintf(stdout, " Corner %2i : ", k);
- fprintf(stdout,"\n Number Index center_lon center_lat area*10^6 :");
+ fprintf(stdout, " Corner %2i : ", k+1);
+ fprintf(stdout,"\n Number Index center_lon center_lat area*10^6 :");
for ( k = 0; k < ncorner; k++ )
- fprintf(stdout, " lon_%2.2i lat_%2.2i : ", k, k);
+ fprintf(stdout, " lon_%2.2i lat_%2.2i : ", k+1, k+1);
fprintf(stdout, "\n");
}
area = PolygonArea(ncorner+1, lon_bounds, lat_bounds,lat);
- fprintf(stdout, " %6i %6i %9.4f %9.4f %10.5f :",
+ fprintf(stdout, " %6i %6i %9.4f %9.4f %9.5f :",
nout, i+1, lon, lat, area*pow(10,6));
- for ( k = 0; k < ncorner; k++ )
- fprintf(stdout, " %9.4f %9.4f : ", lon_bounds[k], lat_bounds[k]);
+
+ int ncorner_new = check_ncorner(ncorner, lon_bounds, lat_bounds);
+
+ for ( k = 0; k < ncorner_new; k++ )
+ fprintf(stdout, "%9.4f %9.4f : ", lon_bounds[k], lat_bounds[k]);
+ for ( k = ncorner_new; k < ncorner; k++ )
+ fprintf(stdout, " ---- ---- : ");
fprintf(stdout, "\n");
}
}
@@ -261,17 +281,23 @@ void verify_grid(int gridtype, int gridsize, int ncorner,
{
if ( nout == 1 )
{
- fprintf(stdout,"\n :");
+ fprintf(stdout,"\n :");
for ( k = 0; k < ncorner; k++ )
- fprintf(stdout, " Corner %2i : ", k);
- fprintf(stdout,"\n Number Index center_lon center_lat :");
+ fprintf(stdout, " Corner %2i : ", k+1);
+ fprintf(stdout,"\n Number Index center_lon center_lat :");
for ( k = 0; k < ncorner; k++ )
- fprintf(stdout, " lon_%2.2i lat_%2.2i : ", k, k);
+ fprintf(stdout, " lon_%2.2i lat_%2.2i : ", k+1, k+1);
fprintf(stdout, "\n");
}
- fprintf(stdout, "%6i %6i %9.4f %9.4f :", nout, i+1, lon, lat);
- for ( k = 0; k < ncorner; k++ )
- fprintf(stdout, " %9.4f %9.4f : ", lon_bounds[k], lat_bounds[k]);
+ fprintf(stdout, " %6i %6i %9.4f %9.4f :", nout, i+1, lon, lat);
+
+ int ncorner_new = check_ncorner(ncorner, lon_bounds, lat_bounds);
+
+ for ( k = 0; k < ncorner_new; k++ )
+ fprintf(stdout, "%9.4f %9.4f : ", lon_bounds[k], lat_bounds[k]);
+ for ( k = ncorner_new; k < ncorner; k++ )
+ fprintf(stdout, " ---- ---- : ");
+
fprintf(stdout, "\n");
}
}
@@ -571,7 +597,7 @@ void *Outputgmt(void *argument)
int nmiss;
int nlon, nlat, nalloc;
int nlev, lzon = FALSE, lmer = FALSE, lhov = FALSE;
- int gridcorners = 0, ic;
+ int ncorner = 0, ic;
int status;
int lgrid_gen_bounds = FALSE, luse_grid_corner = FALSE;
int zaxisID, taxisID;
@@ -702,9 +728,9 @@ void *Outputgmt(void *argument)
}
if ( gridInqType(gridID) == GRID_UNSTRUCTURED )
- gridcorners = gridInqNvertex(gridID);
+ ncorner = gridInqNvertex(gridID);
else
- gridcorners = 4;
+ ncorner = 4;
grid_is_circular = gridIsCircular(gridID);
@@ -755,8 +781,8 @@ void *Outputgmt(void *argument)
if ( luse_grid_corner )
{
- if ( gridcorners == 0 ) cdoAbort("grid corner missing!");
- nalloc = gridcorners*gridsize;
+ if ( ncorner == 0 ) cdoAbort("grid corner missing!");
+ nalloc = ncorner*gridsize;
grid_corner_lat = (double*) realloc(grid_corner_lat, nalloc*sizeof(double));
grid_corner_lon = (double*) realloc(grid_corner_lon, nalloc*sizeof(double));
@@ -782,8 +808,8 @@ void *Outputgmt(void *argument)
/* Note: using units from latitude instead from bounds */
- grid_to_degree(units, gridcorners*gridsize, grid_corner_lon, "grid corner lon");
- grid_to_degree(units, gridcorners*gridsize, grid_corner_lat, "grid corner lat");
+ grid_to_degree(units, ncorner*gridsize, grid_corner_lon, "grid corner lon");
+ grid_to_degree(units, ncorner*gridsize, grid_corner_lat, "grid corner lat");
if ( zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL) )
{
@@ -825,7 +851,7 @@ void *Outputgmt(void *argument)
}
if ( operatorID == GRIDVERIFY )
- verify_grid(gridInqType(gridID), gridsize, gridcorners,
+ verify_grid(gridInqType(gridID), gridsize, ncorner,
grid_center_lon, grid_center_lat,
grid_corner_lon, grid_corner_lat);
@@ -1195,11 +1221,13 @@ void *Outputgmt(void *argument)
}
else
{
- for ( ic = 0; ic < gridcorners; ic++ )
- fprintf(stdout, " %g %g\n",
- grid_corner_lon[i*gridcorners+ic], grid_corner_lat[i*gridcorners+ic]);
- fprintf(stdout, " %g %g\n",
- grid_corner_lon[i*gridcorners], grid_corner_lat[i*gridcorners]);
+ const double *lon_bounds = grid_corner_lon+i*ncorner;
+ const double *lat_bounds = grid_corner_lat+i*ncorner;
+ int ncorner_new = check_ncorner(ncorner, lon_bounds, lat_bounds);
+
+ for ( ic = 0; ic < ncorner_new; ic++ )
+ fprintf(stdout, " %g %g\n", lon_bounds[ic], lat_bounds[ic]);
+ fprintf(stdout, " %g %g\n", lon_bounds[0], lat_bounds[0]);
}
}
fprintf(stdout, "\n");
diff --git a/src/Pack.c b/src/Pack.c
index 8b6e783..ee8693c 100644
--- a/src/Pack.c
+++ b/src/Pack.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Pinfo.c b/src/Pinfo.c
index e096792..7f5a700 100644
--- a/src/Pinfo.c
+++ b/src/Pinfo.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Pressure.c b/src/Pressure.c
index 089ab1d..fb0397f 100644
--- a/src/Pressure.c
+++ b/src/Pressure.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Regres.c b/src/Regres.c
index 3364921..4ebe37a 100644
--- a/src/Regres.c
+++ b/src/Regres.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Remap.c b/src/Remap.c
index f4a3fc6..7a8fc3d 100644
--- a/src/Remap.c
+++ b/src/Remap.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Remapeta.c b/src/Remapeta.c
index 300ebd8..142cf63 100644
--- a/src/Remapeta.c
+++ b/src/Remapeta.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2007-2012 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2007-2012 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.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
diff --git a/src/Replace.c b/src/Replace.c
index 61f8404..7b14d52 100644
--- a/src/Replace.c
+++ b/src/Replace.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Replacevalues.c b/src/Replacevalues.c
index ee0e504..f5b780a 100644
--- a/src/Replacevalues.c
+++ b/src/Replacevalues.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Rhopot.c b/src/Rhopot.c
index 2c59f33..0df33d7 100644
--- a/src/Rhopot.c
+++ b/src/Rhopot.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Rotuv.c b/src/Rotuv.c
index 94cee5a..ca09d25 100644
--- a/src/Rotuv.c
+++ b/src/Rotuv.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Runstat.c b/src/Runstat.c
index 2ed860e..a4b9884 100644
--- a/src/Runstat.c
+++ b/src/Runstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -59,7 +59,7 @@ void datetime_avg_dtinfo(int calendar, int ndates, dtinfo_t *dtinfo)
juldate2 = juldate_encode(calendar, vdate, vtime);
seconds = juldate_to_seconds(juldate_sub(juldate2, juldate1)) / 2;
- juldatem = juldate_add_seconds(lround(seconds), juldate1);
+ juldatem = juldate_add_seconds((int)lround(seconds), juldate1);
juldate_decode(calendar, juldatem, &vdate, &vtime);
}
else
@@ -100,7 +100,7 @@ void datetime_avg(int calendar, int ndates, datetime_t *datetime)
juldate2 = juldate_encode(calendar, vdate, vtime);
seconds = juldate_to_seconds(juldate_sub(juldate2, juldate1)) / 2;
- juldatem = juldate_add_seconds(lround(seconds), juldate1);
+ juldatem = juldate_add_seconds((int)lround(seconds), juldate1);
juldate_decode(calendar, juldatem, &vdate, &vtime);
}
else
diff --git a/src/SSOpar.c b/src/SSOpar.c
index a29af35..b0df78b 100644
--- a/src/SSOpar.c
+++ b/src/SSOpar.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2012-2012 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2012-2012 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.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
diff --git a/src/Seasstat.c b/src/Seasstat.c
index 9c5ebdc..b30c6f7 100644
--- a/src/Seasstat.c
+++ b/src/Seasstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Selbox.c b/src/Selbox.c
index e650600..01f5232 100644
--- a/src/Selbox.c
+++ b/src/Selbox.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Select.c b/src/Select.c
index a34b57e..8062e85 100644
--- a/src/Select.c
+++ b/src/Select.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Seloperator.c b/src/Seloperator.c
index bed0735..a44deaa 100644
--- a/src/Seloperator.c
+++ b/src/Seloperator.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Selrec.c b/src/Selrec.c
index 305936e..07f32ee 100644
--- a/src/Selrec.c
+++ b/src/Selrec.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Seltime.c b/src/Seltime.c
index 79cba16..553f1ec 100644
--- a/src/Seltime.c
+++ b/src/Seltime.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Selvar.c b/src/Selvar.c
index db98b7c..7dc6bb4 100644
--- a/src/Selvar.c
+++ b/src/Selvar.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Set.c b/src/Set.c
index 53278c8..1b4c310 100644
--- a/src/Set.c
+++ b/src/Set.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Setbox.c b/src/Setbox.c
index 6a73dc9..08eba38 100644
--- a/src/Setbox.c
+++ b/src/Setbox.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Setgatt.c b/src/Setgatt.c
index ad4154b..f1fabe1 100644
--- a/src/Setgatt.c
+++ b/src/Setgatt.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Setgrid.c b/src/Setgrid.c
index 488947f..969f04e 100644
--- a/src/Setgrid.c
+++ b/src/Setgrid.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -321,14 +321,13 @@ void *Setgrid(void *argument)
gridsize = gridInqSize(gridID1);
if ( gridsize == masksize )
{
- int *mask;
- mask = (int*) malloc(masksize*sizeof(int));
+ int *mask = (int*) malloc(masksize*sizeof(int));
for ( i = 0; i < masksize; i++ )
{
if ( gridmask[i] < 0 || gridmask[i] > 255 )
mask[i] = 0;
else
- mask[i] = lround(gridmask[i]);
+ mask[i] = (int)lround(gridmask[i]);
}
gridID2 = gridDuplicate(gridID1);
gridDefMask(gridID2, mask);
diff --git a/src/Sethalo.c b/src/Sethalo.c
index fef8dc1..12faa20 100644
--- a/src/Sethalo.c
+++ b/src/Sethalo.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Setmiss.c b/src/Setmiss.c
index 90970df..40a72aa 100644
--- a/src/Setmiss.c
+++ b/src/Setmiss.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Setpartab.c b/src/Setpartab.c
index 3f5ea98..bcbcbd4 100644
--- a/src/Setpartab.c
+++ b/src/Setpartab.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Setrcaname.c b/src/Setrcaname.c
index 649321d..e84afcf 100644
--- a/src/Setrcaname.c
+++ b/src/Setrcaname.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Settime.c b/src/Settime.c
index 6464805..ba0153a 100644
--- a/src/Settime.c
+++ b/src/Settime.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Setzaxis.c b/src/Setzaxis.c
index aedb277..f1de10f 100644
--- a/src/Setzaxis.c
+++ b/src/Setzaxis.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Showinfo.c b/src/Showinfo.c
index 7a155ea..55c2af6 100644
--- a/src/Showinfo.c
+++ b/src/Showinfo.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Sinfo.c b/src/Sinfo.c
index 841d7b7..340c18d 100644
--- a/src/Sinfo.c
+++ b/src/Sinfo.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Smooth9.c b/src/Smooth9.c
index f6d9080..e134af5 100644
--- a/src/Smooth9.c
+++ b/src/Smooth9.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Sort.c b/src/Sort.c
index 5b53e7e..b5fcaa3 100644
--- a/src/Sort.c
+++ b/src/Sort.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Sorttimestamp.c b/src/Sorttimestamp.c
index 0875ae4..e90f17e 100644
--- a/src/Sorttimestamp.c
+++ b/src/Sorttimestamp.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Specinfo.c b/src/Specinfo.c
index 222d9c2..726eeb7 100644
--- a/src/Specinfo.c
+++ b/src/Specinfo.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -135,12 +135,9 @@ static int nlat2nlon(int nlat)
int ngp2ntr(int ngp)
{
- int ntr, nlatl, nlonl;
-
- ntr = lround(sqrt(0.25+ngp)-1.5);
- nlatl = ntr2nlat_linear(ntr);
- nlonl = compnlon(nlatl);
- nlatl = nlonl/2;
+ int ntr = (int)lround(sqrt(0.25+ngp)-1.5);
+ int nlonl = compnlon(ntr2nlat_linear(ntr));
+ int nlatl = nlonl/2;
ntr = (2*nlatl-1)/2;
diff --git a/src/Spectral.c b/src/Spectral.c
index 8c1382e..bc3e4ec 100644
--- a/src/Spectral.c
+++ b/src/Spectral.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Spectrum.c b/src/Spectrum.c
index b3b7c8f..710e417 100644
--- a/src/Spectrum.c
+++ b/src/Spectrum.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Split.c b/src/Split.c
index e493eb4..28a91f1 100644
--- a/src/Split.c
+++ b/src/Split.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Splitrec.c b/src/Splitrec.c
index 35a7bb2..96d8097 100644
--- a/src/Splitrec.c
+++ b/src/Splitrec.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Splitsel.c b/src/Splitsel.c
index 2c770c4..141e14e 100644
--- a/src/Splitsel.c
+++ b/src/Splitsel.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Splittime.c b/src/Splittime.c
index 9448876..b6c4ce6 100644
--- a/src/Splittime.c
+++ b/src/Splittime.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Splityear.c b/src/Splityear.c
index 5d4ac40..cc4b129 100644
--- a/src/Splityear.c
+++ b/src/Splityear.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Subtrend.c b/src/Subtrend.c
index e30c5da..5a85b8a 100644
--- a/src/Subtrend.c
+++ b/src/Subtrend.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Tee.c b/src/Tee.c
index 568eeee..7dbf48a 100644
--- a/src/Tee.c
+++ b/src/Tee.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Templates.c b/src/Templates.c
index 60e6885..b159d35 100644
--- a/src/Templates.c
+++ b/src/Templates.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Test.c b/src/Test.c
index 4083116..5205160 100644
--- a/src/Test.c
+++ b/src/Test.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Tests.c b/src/Tests.c
index f0ae377..231c223 100644
--- a/src/Tests.c
+++ b/src/Tests.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Timselstat.c b/src/Timselstat.c
index 9a49500..e3c3e81 100644
--- a/src/Timselstat.c
+++ b/src/Timselstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Timsort.c b/src/Timsort.c
index 5483ed1..b93ed2d 100644
--- a/src/Timsort.c
+++ b/src/Timsort.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Timstat.c b/src/Timstat.c
index 0a0bff8..5743e4c 100644
--- a/src/Timstat.c
+++ b/src/Timstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Timstat2.c b/src/Timstat2.c
index 2995429..415988d 100644
--- a/src/Timstat2.c
+++ b/src/Timstat2.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Timstat3.c b/src/Timstat3.c
index 3d4e005..feadd27 100644
--- a/src/Timstat3.c
+++ b/src/Timstat3.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Tinfo.c b/src/Tinfo.c
index b7a3c1e..03fbe98 100644
--- a/src/Tinfo.c
+++ b/src/Tinfo.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2007-2012 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2007-2012 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Tocomplex.c b/src/Tocomplex.c
index 398710b..05fe39a 100644
--- a/src/Tocomplex.c
+++ b/src/Tocomplex.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Transpose.c b/src/Transpose.c
index 1f1761d..d2477b0 100644
--- a/src/Transpose.c
+++ b/src/Transpose.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Trend.c b/src/Trend.c
index e422196..c517564 100644
--- a/src/Trend.c
+++ b/src/Trend.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Trms.c b/src/Trms.c
index d5c95ca..b7c5aee 100644
--- a/src/Trms.c
+++ b/src/Trms.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Tstepcount.c b/src/Tstepcount.c
index 4cb7bf1..99aac1c 100644
--- a/src/Tstepcount.c
+++ b/src/Tstepcount.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Vardup.c b/src/Vardup.c
index ef115a0..b13774b 100644
--- a/src/Vardup.c
+++ b/src/Vardup.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Vargen.c b/src/Vargen.c
index d7062fa..a7bc13d 100644
--- a/src/Vargen.c
+++ b/src/Vargen.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Varrms.c b/src/Varrms.c
index 8a274b6..cafc24a 100644
--- a/src/Varrms.c
+++ b/src/Varrms.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Vertint.c b/src/Vertint.c
index 10c982e..e0fd401 100644
--- a/src/Vertint.c
+++ b/src/Vertint.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Vertstat.c b/src/Vertstat.c
index 117c280..e041f93 100644
--- a/src/Vertstat.c
+++ b/src/Vertstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Vertwind.c b/src/Vertwind.c
index e88f4fc..43c54da 100644
--- a/src/Vertwind.c
+++ b/src/Vertwind.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Wct.c b/src/Wct.c
old mode 100755
new mode 100644
diff --git a/src/Wind.c b/src/Wind.c
index 5a0a2e7..058d86b 100644
--- a/src/Wind.c
+++ b/src/Wind.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Writegrid.c b/src/Writegrid.c
index fe49e98..74d28c7 100644
--- a/src/Writegrid.c
+++ b/src/Writegrid.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Writerandom.c b/src/Writerandom.c
index 506afdb..2006175 100644
--- a/src/Writerandom.c
+++ b/src/Writerandom.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/YAR.c b/src/YAR.c
index d685a5f..eb9d798 100644
--- a/src/YAR.c
+++ b/src/YAR.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Ydayarith.c b/src/Ydayarith.c
index 9bce4e4..ffeb64b 100644
--- a/src/Ydayarith.c
+++ b/src/Ydayarith.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Ydaystat.c b/src/Ydaystat.c
index 83ccc63..8319f6e 100644
--- a/src/Ydaystat.c
+++ b/src/Ydaystat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Yearmonstat.c b/src/Yearmonstat.c
index 870d4be..da49d9f 100644
--- a/src/Yearmonstat.c
+++ b/src/Yearmonstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Yhourarith.c b/src/Yhourarith.c
index 2ac4ce5..fbdecde 100644
--- a/src/Yhourarith.c
+++ b/src/Yhourarith.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Yhourstat.c b/src/Yhourstat.c
index b1ac1a4..13ca224 100644
--- a/src/Yhourstat.c
+++ b/src/Yhourstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Ymonarith.c b/src/Ymonarith.c
index ded19c3..9a997d2 100644
--- a/src/Ymonarith.c
+++ b/src/Ymonarith.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Ymonstat.c b/src/Ymonstat.c
index b701456..4731598 100644
--- a/src/Ymonstat.c
+++ b/src/Ymonstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Yseasstat.c b/src/Yseasstat.c
index c9b4a15..64b16d5 100644
--- a/src/Yseasstat.c
+++ b/src/Yseasstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/Zonstat.c b/src/Zonstat.c
index 8d0c021..e91e707 100644
--- a/src/Zonstat.c
+++ b/src/Zonstat.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.1
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/cdo.c b/src/cdo.c
index a2a99e8..6c153d4 100644
--- a/src/cdo.c
+++ b/src/cdo.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -71,7 +71,7 @@ extern char *CDO_optarg;
# define VERSION "0.0.1"
#endif
-char CDO_Version[] = "Climate Data Operators version "VERSION" (http://code.zmaw.de/projects/cdo)";
+char CDO_Version[] = "Climate Data Operators version "VERSION" (https://code.zmaw.de/projects/cdo)";
char *Progname;
@@ -228,6 +228,7 @@ void cdo_usage(void)
fprintf(stderr, " -L Lock IO (sequential access)\n");
fprintf(stderr, " -M Switch to indicate that the I/O streams have missing values\n");
fprintf(stderr, " -m <missval> Set the default missing value (default: %g)\n", cdiInqMissval());
+ fprintf(stderr, " --no_warnings Inhibit warning messages\n");
fprintf(stderr, " -O Overwrite existing output file, if checked\n");
#if defined(_OPENMP)
fprintf(stderr, " -P <nthreads> Set number of OpenMP threads\n");
@@ -261,9 +262,9 @@ void cdo_usage(void)
fprintf(stderr, "\n");
fprintf(stderr, " CDO version %s, Copyright (C) 2003-2014 Uwe Schulzweida\n", VERSION);
- // fprintf(stderr, " Available from <http://code.zmaw.de/projects/cdo>\n");
+ // fprintf(stderr, " Available from <https://code.zmaw.de/projects/cdo>\n");
fprintf(stderr, " This is free software and comes with ABSOLUTELY NO WARRANTY\n");
- fprintf(stderr, " Report bugs to <http://code.zmaw.de/projects/cdo>\n");
+ fprintf(stderr, " Report bugs to <https://code.zmaw.de/projects/cdo>\n");
}
static
@@ -1129,6 +1130,7 @@ int parse_options_long(int argc, char *argv[])
{ "hdr_pad", required_argument, &lnetcdf_hdr_pad, 1 },
{ "use_fftw", required_argument, &luse_fftw, 1 },
{ "remap_genweights", required_argument, &lremap_genweights, 1 },
+ { "no_warnings", no_argument, &_Verbose, 0 },
{ "format", required_argument, NULL, 'f' },
{ "help", no_argument, NULL, 'h' },
{ "history", no_argument, NULL, 'H' },
diff --git a/src/cdo.h b/src/cdo.h
index e2f9023..5d9035f 100644
--- a/src/cdo.h
+++ b/src/cdo.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -85,55 +85,5 @@ extern char **cdoVarnames;
int cdo_omp_get_thread_num(void);
-void cdiOpenError(int cdiErrno, const char *fmt, const char *path);
-void cdoAbort(const char *fmt, ...);
-void cdoWarning(const char *fmt, ...);
-void cdoPrint(const char *fmt, ...);
-
-int timer_new(const char *text);
-void timer_report(void);
-void timer_start(int it);
-void timer_stop(int it);
-double timer_val(int it);
-
-
-void operatorInputArg(const char *enter);
-int operatorArgc(void);
-char **operatorArgv(void);
-void operatorCheckArgc(int numargs);
-
-const argument_t *cdoStreamName(int cnt);
-
-void cdoInitialize(void *argument);
-void cdoFinish(void);
-
-int cdoStreamNumber(void);
-int cdoStreamCnt(void);
-int cdoOperatorAdd(const char *name, int func, int intval, const char *enter);
-int cdoOperatorID(void);
-int cdoOperatorF1(int operID);
-int cdoOperatorF2(int operID);
-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);
-
-int vlistInqNWPV(int vlistID, int varID);
-int vlistIsSzipped(int vlistID);
-
-void cdoGenFileSuffix(char *filesuffix, size_t maxlen, int filetype, int vlistID, const char *refname);
-
-void writeNCgrid(const char *gridfile, int gridID, int *imask);
-void defineZaxis(const char *zaxisarg);
-void cdiDefTableID(int tableID);
-
-int gridFromName(const char *gridname);
-int zaxisFromName(const char *zaxisname);
#endif /* _CDO_H */
diff --git a/src/cdo_getopt.c b/src/cdo_getopt.c
index b7e8b04..729d825 100644
--- a/src/cdo_getopt.c
+++ b/src/cdo_getopt.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/cdo_getopt.h b/src/cdo_getopt.h
index c9a8619..c688656 100644
--- a/src/cdo_getopt.h
+++ b/src/cdo_getopt.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/cdo_int.h b/src/cdo_int.h
index bfdbbf2..e09f378 100644
--- a/src/cdo_int.h
+++ b/src/cdo_int.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/cdo_pthread.c b/src/cdo_pthread.c
index d4f6d60..42d3fae 100644
--- a/src/cdo_pthread.c
+++ b/src/cdo_pthread.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/cdo_vlist.c b/src/cdo_vlist.c
index e56cd61..4dcebe7 100644
--- a/src/cdo_vlist.c
+++ b/src/cdo_vlist.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/clipping/area.c b/src/clipping/area.c
index d350e98..fa3da63 100644
--- a/src/clipping/area.c
+++ b/src/clipping/area.c
@@ -42,7 +42,13 @@
#include "ensure_array_size.h"
// area tolerance (10 m^2 = 0.0001 km^2)
-const double area_tol = 0.02*0.02; // 20m*20m
+// const double area_tol = 0.02*0.02; // 20m*20m
+
+// an area of 20m x 20m on the Earth Surface is equivalent to an area on the unit sphere:
+
+double area_tol () {
+ return 0.02 / EarthRadius;
+}
static inline double scalar_product(double a[], double b[]);
@@ -60,16 +66,16 @@ double cell_approx_area ( struct grid_cell cell ) {
/* adopted from Robert.G. Chamberlain and William.H. Duquette */
int m, M;
- double SUM = 0.0;
- double area;
+ // double SUM = 0.0;
+ double area = 0.0;
M = cell.num_corners;
for ( m = 0; m < M; m++ )
- SUM += ( cell.coordinates_x[(m+2)%M] - cell.coordinates_x[m] ) *
- sin(cell.coordinates_y[(m+1)%M]);
+ area += ( cell.coordinates_x[m] - cell.coordinates_x[(m+2)%M] ) *
+ sin(cell.coordinates_y[(m+1)%M]);
- area = -EarthRadius2 * SUM;
+ // area = EarthRadius2 * SUM;
return area;
}
@@ -153,7 +159,8 @@ double triangle_area ( struct grid_cell cell ) {
here for a unit sphere: */
- return MAX(( a1+a2+a3-M_PI ) * EarthRadius * EarthRadius, 0.0);
+ // return MAX(( a1+a2+a3-M_PI ) * EarthRadius * EarthRadius, 0.0);
+ return MAX( (a1+a2+a3-M_PI) , 0.0 );
}
/* ----------------------------------- */
@@ -233,7 +240,8 @@ double cell_area ( struct grid_cell cell ) {
area += a[m];
}
- return MAX(area * EarthRadius * EarthRadius, 0.0);
+ // return MAX(area * EarthRadius * EarthRadius, 0.0);
+ return MAX(area,0.0);
}
/* ----------------------------------- */
@@ -276,7 +284,7 @@ double girards_area ( struct grid_cell cell ) {
/* Area on Sphere with radius EarthRadius */
- area *= EarthRadius * EarthRadius;
+ // area *= EarthRadius * EarthRadius;
free ( theta );
@@ -381,7 +389,8 @@ double cell3d_area( struct grid_cell cell ) {
break;
}
- return area * EarthRadius * EarthRadius;
+ // return area * EarthRadius * EarthRadius;
+ return area;
}
/** area of a spherical triangle based on L'Huilier's Theorem
@@ -598,7 +607,8 @@ double pole_area ( struct grid_cell cell ) {
abort_message("ERROR: unsupported edge type\n", __FILE__, __LINE__);
}
}
- return fabs(area * EarthRadius * EarthRadius);
+ // return fabs(area) * EarthRadius * EarthRadius;
+ return fabs(area);
}
/*
@@ -621,11 +631,11 @@ double huiliers_area(struct grid_cell cell) {
if (cell.num_corners == 3 && !lat_flag)
return fabs(tri_area(cell.coordinates_xyz + 0*3,
cell.coordinates_xyz + 1*3,
- cell.coordinates_xyz + 2*3) *
- EarthRadius * EarthRadius);
+ cell.coordinates_xyz + 2*3));
+ // * EarthRadius * EarthRadius;
// sum areas around cell
- double sum = 0.0;
+ double area = 0.0;
for (int i = 2; i < cell.num_corners; ++i) {
@@ -641,12 +651,12 @@ double huiliers_area(struct grid_cell cell) {
double scalar_base = scalar_product(norm, cell.coordinates_xyz + 0*3);
if (scalar_base > 0)
- sum += tmp_area;
+ area += tmp_area;
else
- sum -= tmp_area;
+ area -= tmp_area;
}
- // if there is at least on latitude circle edge
+ // if there is at least one latitude circle edge
if (lat_flag) {
for (int i = 0; i < cell.num_corners; ++i) {
@@ -655,17 +665,17 @@ double huiliers_area(struct grid_cell cell) {
int i_ = (i+1)%cell.num_corners;
- sum += lat_edge_correction(cell.coordinates_xyz + 0 * 3,
- cell.coordinates_xyz + i * 3,
- cell.coordinates_xyz + i_ * 3,
- cell.coordinates_x[i],
- cell.coordinates_x[i_]);
+ area += lat_edge_correction(cell.coordinates_xyz + 0 * 3,
+ cell.coordinates_xyz + i * 3,
+ cell.coordinates_xyz + i_ * 3,
+ cell.coordinates_x[i],
+ cell.coordinates_x[i_]);
}
}
}
- // return area
- return fabs(sum * EarthRadius * EarthRadius);
+ return fabs(area);
+ // return fabs(area) * EarthRadius * EarthRadius;
}
/* ----------------------------------- */
diff --git a/src/clipping/area.h b/src/clipping/area.h
index e81e51c..3c0cd39 100644
--- a/src/clipping/area.h
+++ b/src/clipping/area.h
@@ -42,9 +42,9 @@
*
**/
-extern const double area_tol;
+double area_tol();
-/** \brief Calculate the area of a cell on a sphere
+/** \brief Calculate the area of a cell on a unit sphere
*
* Taken from:
*
@@ -98,7 +98,7 @@ extern const double area_tol;
double cell_approx_area ( struct grid_cell cell );
-/** \brief Calculate the area of a triangle on a sphere
+/** \brief Calculate the area of a triangle on a unit sphere
*
* Adopted from the ICON code, mo_base_geometry.f90
* provided by Luis Kornblueh, MPI-M.
@@ -132,7 +132,7 @@ double cell_approx_area ( struct grid_cell cell );
double triangle_area ( struct grid_cell cell );
-/** \brief Calculate the area of a cell on a sphere
+/** \brief Calculate the area of a cell on a unit sphere
*
* Generalized version of triangle_area
*
@@ -161,7 +161,7 @@ double triangle_area ( struct grid_cell cell );
double cell_area ( struct grid_cell cell );
-/** \brief Calculate the area of a cell on a sphere
+/** \brief Calculate the area of a cell on a unit sphere
*
* Following M. Bevis and G. Cambareri, 1987: Computing the Area
* of a Spherical Polygon of Arbitray Shape. Math. Geology,
@@ -203,7 +203,7 @@ double cell_area ( struct grid_cell cell );
**/
double girards_area ( struct grid_cell cell );
-/** \brief Calculate the area of a cell in a 3d plane
+/** \brief Calculate the area of a cell in a 3d plane on a unit sphere
*
* see http://geomalgorithms.com/a01-_area.html
*
@@ -221,7 +221,7 @@ double girards_area ( struct grid_cell cell );
double cell3d_area( struct grid_cell cell );
-/** \brief Calculate the area of a cell on a sphere
+/** \brief Calculate the area of a cell on a unit sphere
*
* based on:
*
@@ -239,7 +239,7 @@ double cell3d_area( struct grid_cell cell );
double pole_area ( struct grid_cell cell );
/**
- * \brief Area calculation taken from ESMF based on L'Huilier's Theorem
+ * \brief Area calculation on a unit sphere taken from ESMF based on L'Huilier's Theorem
*
* (http://mathworld.wolfram.com/LHuiliersTheorem.html)\n
* (http://mathforum.org/library/drmath/view/65316.html)\n
diff --git a/src/clipping/clipping.c b/src/clipping/clipping.c
index 2f8cd8c..286cc90 100644
--- a/src/clipping/clipping.c
+++ b/src/clipping/clipping.c
@@ -154,25 +154,13 @@ void compute_concave_overlap_areas (unsigned N,
abort_message("ERROR: missing target point coordinates "
"(x_coordinates == NULL || y_coordinates == NULL)",
__FILE__, __LINE__);
- /*
+
struct grid_cell target_partial_cell =
{.coordinates_x = (double[3]){-1},
.coordinates_y = (double[3]){-1},
.coordinates_xyz = (double[3*3]){-1},
.edge_type = (enum edge_type[3]) {GREAT_CIRCLE},
.num_corners = 3};
- */
- double coordinates_x[3] = {-1, -1, -1};
- double coordinates_y[3] = {-1, -1, -1};
- double coordinates_xyz[9] = {-1, -1, -1};
- enum edge_type edge_types[3] = {GREAT_CIRCLE, GREAT_CIRCLE, GREAT_CIRCLE};
- struct grid_cell target_partial_cell =
- {.coordinates_x = coordinates_x,
- .coordinates_y = coordinates_y,
- .coordinates_xyz = coordinates_xyz,
- .edge_type = edge_types,
- .num_corners = 3};
-
static struct grid_cell * overlap_buffer = NULL;
static unsigned overlap_buffer_size = 0;
@@ -461,9 +449,6 @@ static void get_edge_middle_point(double a[3], double b[3],
};
}
-//static struct grid_cell curr_target_cell;
-//static struct grid_cell curr_source_cell;
-
/**
* cell clipping using Sutherland–Hodgman algorithm;
*/
@@ -879,22 +864,22 @@ static void copy_point_list(struct point_list in, struct point_list * out) {
if (curr == NULL) return;
- struct point_list_element * xnew = get_free_point_list_element(out);
- out->first = xnew;
- *xnew = *curr;
+ struct point_list_element * new = get_free_point_list_element(out);
+ out->first = new;
+ *new = *curr;
curr = curr->next;
do {
- xnew->next = get_free_point_list_element(out);
- xnew = xnew->next;
- *xnew = *curr;
+ new->next = get_free_point_list_element(out);
+ new = new->next;
+ *new = *curr;
curr = curr->next;
} while (curr != in.first);
- xnew->next = out->first;
- out->last = xnew;
+ new->next = out->first;
+ out->last = new;
}
void cell_clipping(unsigned N,
@@ -1015,9 +1000,6 @@ void cell_clipping(unsigned N,
(fabs(target_cell.coordinates_y[0]) >
fabs(source_cell[n].coordinates_y[0])))) {
- // curr_target_cell = source_cell[n];
- // curr_source_cell = target_cell;
-
copy_point_list(target_list, &temp_list);
double temp_norm_vec[3*ncs];
@@ -1051,9 +1033,6 @@ void cell_clipping(unsigned N,
} else {
- // curr_target_cell = target_cell;
- // curr_source_cell = source_cell[n];
-
point_list_clipping(&source_list, source_ordering,
target_list, target_ordering, nct, norm_vec);
diff --git a/src/clipping/grid.h b/src/clipping/grid.h
index 921ddca..cd0b815 100644
--- a/src/clipping/grid.h
+++ b/src/clipping/grid.h
@@ -109,7 +109,7 @@ struct grid_vtable {
void (*pack_grid)(struct grid *, double **, unsigned, unsigned *, unsigned *,
unsigned **, unsigned, unsigned *, unsigned *);
struct grid_search * (*get_grid_search)(struct grid * grid);
- void (*xdelete)(struct grid *);
+ void (*delete)(struct grid *);
};
struct grid {
diff --git a/src/clipping/intersection.c b/src/clipping/intersection.c
index de304eb..83cc0db 100644
--- a/src/clipping/intersection.c
+++ b/src/clipping/intersection.c
@@ -231,9 +231,9 @@ static int vector_is_between_lat (double a[], double b[], double p[]) {
if (vector_is_between(c, d, a, &angle_cd, dot_cd))
result |= 1 << 2;
- double tvec[] = {-a[0], -a[1], -a[2]};
- if (vector_is_between(c, d, tvec, &angle_cd,
- dot_cd)) result |= 1 << 3;
+ double tvec[] = {-a[0], -a[1], -a[2]};
+ if (vector_is_between(c, d, tvec, &angle_cd, dot_cd))
+ result |= 1 << 3;
return result;
}
@@ -265,8 +265,8 @@ static int vector_is_between_lat (double a[], double b[], double p[]) {
if (vector_is_between(a, b, c, &angle_ab, dot_ab))
result |= 1 << 0;
double tvec[] = {-c[0], -c[1], -c[2]};
- if (vector_is_between(a, b, tvec, &angle_ab,
- dot_ab)) result |= 1 << 1;
+ if (vector_is_between(a, b, tvec, &angle_ab, dot_ab))
+ result |= 1 << 1;
return result;
}
@@ -1539,9 +1539,6 @@ int gcxlatc_vec(double a[3], double b[3], double c[3], double d[3],
s[1] = a[1] - scale * b[1];
}
- if (fabs(s[0]) < tol && fabs(s[1]) < tol)
- abort_message("internal error", __FILE__, __LINE__);
-
{
// the intersection of the planes of both circles is defined by:
// x = t + n * s
@@ -1553,6 +1550,9 @@ int gcxlatc_vec(double a[3], double b[3], double c[3], double d[3],
double b_ = 2.0 * (t[0] * s[0] + t[1] * s[1]);
double c_ = t[0] * t[0] + t[1] * t[1] + c[2] * c[2] - 1.0;
+ if (a_ == 0.0)
+ abort_message("internal error", __FILE__, __LINE__);
+
double temp = b_ * b_ - 4.0 * a_ * c_;
// no intersection possible
diff --git a/src/commandline.c b/src/commandline.c
index 0babf21..a8e96e7 100644
--- a/src/commandline.c
+++ b/src/commandline.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/const.h b/src/const.h
index 9adc539..25111cd 100644
--- a/src/const.h
+++ b/src/const.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2012-2012 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2012-2012 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/ecacore.c b/src/ecacore.c
old mode 100755
new mode 100644
diff --git a/src/ecautil.c b/src/ecautil.c
old mode 100755
new mode 100644
diff --git a/src/exception.c b/src/exception.c
index 5bdcfeb..63abca1 100644
--- a/src/exception.c
+++ b/src/exception.c
@@ -5,8 +5,9 @@
#include <cdi.h>
#include "cdo.h"
#include "process.h"
+#include "error.h"
-static int _ExitOnError = 1; /* If set to 1, exit on error */
+#include "config.h"
void cdiOpenError(int cdiErrno, const char *fmt, const char *path)
{
@@ -51,14 +52,15 @@ void cdiOpenError(int cdiErrno, const char *fmt, const char *path)
}
case FILETYPE_NC:
case FILETYPE_NC2:
- {
- fprintf(stderr, "To create a CDO application with netCDF support use: ./configure --with-netcdf=<netCDF root directory> ...\n");
- break;
- }
case FILETYPE_NC4:
case FILETYPE_NC4C:
{
- fprintf(stderr, "To create a CDO application with netCDF4 support use: ./configure --with-netcdf=<netCDF4 root directory> ...\n");
+ const char *ncv = (filetype == FILETYPE_NC4 || filetype == FILETYPE_NC4C) ? "4" : ((filetype == FILETYPE_NC2) ? "2" : "");
+#if defined HAVE_LIBNETCDF
+ fprintf(stderr, "CDO was build with a netCDF version which doesn't support netCDF%s data!\n", ncv);
+#else
+ fprintf(stderr, "To create a CDO application with netCDF%s support use: ./configure --with-netcdf=<netCDF%s root directory> ...\n", ncv, ncv);
+#endif
break;
}
default:
@@ -96,19 +98,22 @@ void cdoAbort(const char *fmt, ...)
void cdoWarning(const char *fmt, ...)
{
- va_list args;
+ if ( _Verbose )
+ {
+ va_list args;
- va_start(args, fmt);
+ va_start(args, fmt);
- set_text_color(stderr, BRIGHT, YELLOW);
- fprintf(stderr, "%s (Warning): ", processInqPrompt());
- reset_text_color(stderr);
- set_text_color(stderr, RESET, BLACK);
- vfprintf(stderr, fmt, args);
- reset_text_color(stderr);
- fprintf(stderr, "\n");
+ set_text_color(stderr, BRIGHT, YELLOW);
+ fprintf(stderr, "%s (Warning): ", processInqPrompt());
+ reset_text_color(stderr);
+ set_text_color(stderr, RESET, BLACK);
+ vfprintf(stderr, fmt, args);
+ reset_text_color(stderr);
+ fprintf(stderr, "\n");
- va_end(args);
+ va_end(args);
+ }
}
diff --git a/src/field.c b/src/field.c
index 6f02404..715daf6 100644
--- a/src/field.c
+++ b/src/field.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/field.h b/src/field.h
index 74d9cc6..d10d296 100644
--- a/src/field.h
+++ b/src/field.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/field2.c b/src/field2.c
index 836d0f1..8a37637 100644
--- a/src/field2.c
+++ b/src/field2.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/fieldc.c b/src/fieldc.c
index 1ad9d2a..9ec4a3b 100644
--- a/src/fieldc.c
+++ b/src/fieldc.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/fieldmer.c b/src/fieldmer.c
index 41e6da6..857c54a 100644
--- a/src/fieldmer.c
+++ b/src/fieldmer.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/fieldzon.c b/src/fieldzon.c
index cea66bc..df16bb2 100644
--- a/src/fieldzon.c
+++ b/src/fieldzon.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/grid.c b/src/grid.c
index 5215d18..b18c5f9 100644
--- a/src/grid.c
+++ b/src/grid.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/grid_area.c b/src/grid_area.c
index 79fea38..b480cca 100644
--- a/src/grid_area.c
+++ b/src/grid_area.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/griddes.c b/src/griddes.c
index 5eaa3d9..6b1f916 100644
--- a/src/griddes.c
+++ b/src/griddes.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -1388,9 +1388,7 @@ int gridFromPingo(FILE *gfp, const char *dname)
int nfc2nlat(int nfc, int ntr)
{
- int nlat;
-
- nlat = nfc / (ntr+1);
+ int nlat = nfc / (ntr+1);
nlat /= 2;
return (nlat);
@@ -1399,9 +1397,7 @@ int nfc2nlat(int nfc, int ntr)
int nlat2ntr(int nlat)
{
- int ntr;
-
- ntr = (nlat*2 - 1) / 3;
+ int ntr = (nlat*2 - 1) / 3;
return (ntr);
}
@@ -1409,9 +1405,7 @@ int nlat2ntr(int nlat)
int nlat2ntr_linear(int nlat)
{
- int ntr;
-
- ntr = (nlat*2 - 1) / 2;
+ int ntr = (nlat*2 - 1) / 2;
return (ntr);
}
@@ -1419,14 +1413,12 @@ int nlat2ntr_linear(int nlat)
int ntr2nlat(int ntr)
{
- int nlat, nlat2;
-
- nlat = lround((ntr*3.+1.)/2.);
+ int nlat = (int)lround((ntr*3.+1.)/2.);
if ( (nlat % 2) > 0 )
{
nlat = nlat + 1;
- nlat2 = lround(((ntr+1)*3.+1.)/2.);
/*
+ int nlat2 = (int)lround(((ntr+1)*3.+1.)/2.);
if ( nlat == nlat2 )
Error("Computation of latitudes failed for truncation %d", ntr);
*/
@@ -1438,14 +1430,12 @@ int ntr2nlat(int ntr)
int ntr2nlat_linear(int ntr)
{
- int nlat, nlat2;
-
- nlat = lround((ntr*2.+1.)/2.);
+ int nlat = (int)lround((ntr*2.+1.)/2.);
if ( (nlat % 2) > 0 )
{
nlat = nlat + 1;
- nlat2 = lround(((ntr+1)*2.+1.)/2.);
/*
+ int nlat2 = (int)lround(((ntr+1)*2.+1.)/2.);
if ( nlat == nlat2 )
Error("Computation of latitudes failed for truncation %d", ntr);
*/
@@ -1457,9 +1447,8 @@ int ntr2nlat_linear(int ntr)
int compNlon(int nlat)
{
- int nlon, n;
-
- nlon = 2 * nlat;
+ int n;
+ int nlon = 2 * nlat;
/* check that FFT works with nlon */
while ( 1 )
diff --git a/src/gridreference.c b/src/gridreference.c
index 84b625c..ddd8f71 100644
--- a/src/gridreference.c
+++ b/src/gridreference.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/history.c b/src/history.c
index 4ac56b2..10c6f76 100644
--- a/src/history.c
+++ b/src/history.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/institution.c b/src/institution.c
index 54f0f2b..5a1676f 100644
--- a/src/institution.c
+++ b/src/institution.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/kvlist.c b/src/kvlist.c
index bc1192d..e9032b5 100644
--- a/src/kvlist.c
+++ b/src/kvlist.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/kvlist.h b/src/kvlist.h
index 9721a39..663f490 100644
--- a/src/kvlist.h
+++ b/src/kvlist.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/list.c b/src/list.c
index 32d3448..2af5a89 100644
--- a/src/list.c
+++ b/src/list.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/list.h b/src/list.h
index cf85b8f..705d888 100644
--- a/src/list.h
+++ b/src/list.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/modules.c b/src/modules.c
index e865480..9ce3864 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/modules.h b/src/modules.h
index 888ad29..b2cdf30 100644
--- a/src/modules.h
+++ b/src/modules.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/namelist.c b/src/namelist.c
index 37c4ed1..e08c844 100644
--- a/src/namelist.c
+++ b/src/namelist.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/namelist.h b/src/namelist.h
index 9e453e9..c4465f4 100644
--- a/src/namelist.h
+++ b/src/namelist.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/operator_help.h b/src/operator_help.h
index 913221e..cf68222 100644
--- a/src/operator_help.h
+++ b/src/operator_help.h
@@ -3934,7 +3934,7 @@ static char *OutputtabHelp[] = {
" ",
" The contents of the table depends on the chosen paramters. The format of each table",
" parameter is keyname[:len]. len is the optional length of a table entry. ",
- " Here is a list a all valid keynames:",
+ " Here is a list of all valid keynames:",
" ",
" Keyname & Type & Description ",
" value & FLOAT & Value of the variable [len:8]",
diff --git a/src/pipe.c b/src/pipe.c
index 8c26fcf..0d69599 100644
--- a/src/pipe.c
+++ b/src/pipe.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/pipe.h b/src/pipe.h
index a2af23f..880989f 100644
--- a/src/pipe.h
+++ b/src/pipe.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/process.c b/src/process.c
index 32896b8..eb564a1 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/process.h b/src/process.h
index 87cc808..77cb7f9 100644
--- a/src/process.h
+++ b/src/process.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/pstream.c b/src/pstream.c
index bdaaebe..1fe4c4d 100644
--- a/src/pstream.c
+++ b/src/pstream.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/pstream.h b/src/pstream.h
index 0e0b883..7a988f8 100644
--- a/src/pstream.h
+++ b/src/pstream.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/pstream_int.h b/src/pstream_int.h
index d623ad4..acb6ec6 100644
--- a/src/pstream_int.h
+++ b/src/pstream_int.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/readline.c b/src/readline.c
index ed0f4bd..2502529 100644
--- a/src/readline.c
+++ b/src/readline.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/remap_conserv.c b/src/remap_conserv.c
index 8b874de..50ecb43 100644
--- a/src/remap_conserv.c
+++ b/src/remap_conserv.c
@@ -304,10 +304,7 @@ void boundbox_from_corners1r(long ic, long nc, const double *restrict corner_lon
static
double gridcell_area(struct grid_cell cell)
{
- double area = huiliers_area(cell);
- area /= (EarthRadius*EarthRadius);
-
- return (area);
+ return huiliers_area(cell);
}
static
@@ -920,6 +917,8 @@ void remap_weights_conserv(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapva
// printf(" int ii = 0;\n");
for ( n = 0; n < num_srch_cells; ++n )
{
+ long srch_corners_new = srch_corners;
+
src_grid_add = srch_add[n];
if ( src_remap_grid_type == REMAP_GRID_TYPE_REG2D )
@@ -947,28 +946,49 @@ void remap_weights_conserv(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapva
else
{
ioffset = src_grid_add*srch_corners;
+ /*
+ for ( k = srch_corners-1; k > 0; --k )
+ {
+ if ( IS_NOT_EQUAL(src_grid->cell_corner_lon[ioffset+k], src_grid->cell_corner_lon[ioffset+k-1]) ||
+ IS_NOT_EQUAL(src_grid->cell_corner_lat[ioffset+k], src_grid->cell_corner_lat[ioffset+k-1]) )
+ break;
+ }
+ if ( k != srch_corners-1 ) printf("%ld %ld %ld %ld\n", tgt_grid_add, n, srch_corners, k+1);
- for ( k = 0; k < srch_corners; ++k )
+ if ( k != srch_corners-1 )
+ {
+ srch_corners_new = k+1;
+ src_grid_cells[n].num_corners = srch_corners_new;
+ }
+ */
+ for ( k = 0; k < srch_corners_new; ++k )
{
src_grid_cells[n].coordinates_x[k] = src_grid->cell_corner_lon[ioffset+k];
src_grid_cells[n].coordinates_y[k] = src_grid->cell_corner_lat[ioffset+k];
}
/*
+ for ( k = 0; k < srch_corners_new; ++k )
+ {
+ printf(" SourceCell[ii].coordinates_x[%ld] = %g*rad;\n", k, src_grid_cells[n].coordinates_x[k]/DEG2RAD);
+ printf(" SourceCell[ii].coordinates_y[%ld] = %g*rad;\n", k, src_grid_cells[n].coordinates_y[k]/DEG2RAD);
+ }
+ */
+ /*
printf("source2: %ld %ld", num_srch_cells, n);
- for ( k = 0; k < srch_corners; ++k )
+ for ( k = 0; k < srch_corners_new; ++k )
printf(" %g %g", src_grid_cells[n].coordinates_x[k]/DEG2RAD, src_grid_cells[n].coordinates_y[k]/DEG2RAD);
printf("\n");
*/
}
- for ( int ic = 0; ic < srch_corners; ++ic )
+ for ( int ic = 0; ic < srch_corners_new; ++ic )
LLtoXYZ(src_grid_cells[n].coordinates_x[ic], src_grid_cells[n].coordinates_y[ic], src_grid_cells[n].coordinates_xyz+ic*3);
if ( lyac )
if ( tgt_grid_add == 174752 )
{
// printf("n %d\n", (int)n);
- for ( k = 0; k < srch_corners; ++k )
+ for ( k = 0; k < srch_corners_new; ++k )
{
printf(" SourceCell[ii].coordinates_x[%ld] = %g*rad;\n", k, src_grid_cells[n].coordinates_x[k]/DEG2RAD);
printf(" SourceCell[ii].coordinates_y[%ld] = %g*rad;\n", k, src_grid_cells[n].coordinates_y[k]/DEG2RAD);
@@ -976,7 +996,7 @@ void remap_weights_conserv(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapva
printf(" ii++;\n");
/*
printf("> -Z1\n");
- for ( k = 0; k < srch_corners; ++k )
+ for ( k = 0; k < srch_corners_new; ++k )
printf(" %g %g\n", src_grid_cells[n].coordinates_x[k]/DEG2RAD, src_grid_cells[n].coordinates_y[k]/DEG2RAD);
printf(" %g %g\n", src_grid_cells[n].coordinates_x[0]/DEG2RAD, src_grid_cells[n].coordinates_y[0]/DEG2RAD);
*/
diff --git a/src/remaplib.c b/src/remaplib.c
index f5545bd..151dd3e 100644
--- a/src/remaplib.c
+++ b/src/remaplib.c
@@ -1,7 +1,7 @@
/*
This is a C library of the Fortran SCRIP version 1.4
- ===>>> Please send bug reports to Uwe.Schulzweida at zmaw.de <<<===
+ ===>>> Please send bug reports to <https://code.zmaw.de/projects/cdo> <<<===
Spherical Coordinate Remapping and Interpolation Package (SCRIP)
================================================================
diff --git a/src/table.c b/src/table.c
index 69277ec..bf9e215 100644
--- a/src/table.c
+++ b/src/table.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/timer.c b/src/timer.c
index 9eb3b36..45aba4c 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/src/util.c b/src/util.c
index ec82877..01d5671 100644
--- a/src/util.c
+++ b/src/util.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -461,3 +461,62 @@ off_t filesize(const char *filename)
return pos;
}
+
+
+/*
+ * Return the filetype extension (const char)
+ * for a given filetype (int)
+ * TODO: handle lists of extensions i.e. grb and grb2 for GRIB2-format
+ */
+const char *filetypeext(int filetype)
+{
+ switch ( filetype )
+ {
+ case FILETYPE_GRB:
+ case FILETYPE_GRB2: return (".grb"); break;
+ case FILETYPE_NC:
+ case FILETYPE_NC2:
+ case FILETYPE_NC4:
+ case FILETYPE_NC4C: return (".nc"); break;
+ case FILETYPE_SRV: return (".srv"); break;
+ case FILETYPE_EXT: return (".ext"); break;
+ case FILETYPE_IEG: return (".ieg"); break;
+ default: return ("");
+ }
+}
+
+
+/*
+ * Remove file extension:
+ * -------------------------------------------------
+ * Remove file extension if it is the expected one
+ * Do nothing otherwise
+ */
+void rm_filetypeext(char *file, const char *ext)
+{
+ // length of filename
+ int namelen = (int) strlen(file);
+ // length of the original file extension
+ int extlen = (int) strlen(ext);
+
+ // delete original extension if it is the expected one
+ if ( strcmp(&file[namelen-extlen], ext) == 0 )
+ file[namelen-extlen] = 0;
+}
+
+
+/*
+ * Replace or just add file extension:
+ * -------------------------------------------------
+ * Replace file extension with new one
+ * or just add the new file extension
+ * if the original extension is not the expected one
+ */
+void repl_filetypeext(char file[], const char *oldext, const char *newext)
+{
+ // delete original extension if it is the expected one
+ rm_filetypeext(file, oldext);
+
+ // add new file extension
+ strcat(file, newext);
+}
diff --git a/src/util.h b/src/util.h
index d2026f0..868c5ab 100644
--- a/src/util.h
+++ b/src/util.h
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
@@ -54,4 +54,62 @@ int userFileOverwrite(const char *filename);
int datatype2str(int datatype, char *datatypestr);
int str2datatype(const char *datatypestr);
+/* filename manipulation */
+const char *filetypeext(int filetype);
+void rm_filetypeext(char *file, const char *ext);
+void repl_filetypeext(char file[], const char *oldext, const char *newext);
+
+
+/* moved here from cdo.h */
+void cdiOpenError(int cdiErrno, const char *fmt, const char *path);
+void cdoAbort(const char *fmt, ...);
+void cdoWarning(const char *fmt, ...);
+void cdoPrint(const char *fmt, ...);
+
+int timer_new(const char *text);
+void timer_report(void);
+void timer_start(int it);
+void timer_stop(int it);
+double timer_val(int it);
+
+
+void operatorInputArg(const char *enter);
+int operatorArgc(void);
+char **operatorArgv(void);
+void operatorCheckArgc(int numargs);
+
+const argument_t *cdoStreamName(int cnt);
+
+void cdoInitialize(void *argument);
+void cdoFinish(void);
+
+int cdoStreamNumber(void);
+int cdoStreamCnt(void);
+int cdoOperatorAdd(const char *name, int func, int intval, const char *enter);
+int cdoOperatorID(void);
+int cdoOperatorF1(int operID);
+int cdoOperatorF2(int operID);
+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);
+
+int vlistInqNWPV(int vlistID, int varID);
+int vlistIsSzipped(int vlistID);
+
+void cdoGenFileSuffix(char *filesuffix, size_t maxlen, int filetype, int vlistID, const char *refname);
+
+void writeNCgrid(const char *gridfile, int gridID, int *imask);
+void defineZaxis(const char *zaxisarg);
+void cdiDefTableID(int tableID);
+
+int gridFromName(const char *gridname);
+int zaxisFromName(const char *zaxisname);
+
#endif /* _UTIL_H */
diff --git a/src/zaxis.c b/src/zaxis.c
index 0d66693..1658bc8 100644
--- a/src/zaxis.c
+++ b/src/zaxis.c
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
- Copyright (C) 2003-2014 Uwe Schulzweida, Uwe.Schulzweida at zmaw.de
+ Copyright (C) 2003-2014 Uwe Schulzweida, <uwe.schulzweida AT mpimet.mpg.de>
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
diff --git a/test/File.test.in b/test/File.test.in
new file mode 100644
index 0000000..b7619b3
--- /dev/null
+++ b/test/File.test.in
@@ -0,0 +1,97 @@
+#! @SHELL@
+echo 1..16 # Number of tests to be executed.
+#
+test -n "$CDO" || CDO=cdo
+test -n "$DATAPATH" || DATAPATH=./data
+#
+CDOOUT=cout
+CDOERR=cerr
+FORMATS="srv ext ieg grb grb2 nc nc2 nc4"
+#
+NTEST=1
+#
+for OPERATOR in write read; do
+ for FORMAT in $FORMATS; do
+ RSTAT=0
+
+ CDOTEST="$OPERATOR $FORMAT"
+ echo "Running test: $NTEST"
+
+ ENABLED_TEST=yes
+
+ if [ "@ENABLE_SERVICE@" = no -a "${FORMAT}" = srv ] ; then
+ FILEFORMAT=SERVICE
+ ENABLED_TEST=no
+ fi
+ if [ "@ENABLE_EXTRA@" = no -a "${FORMAT}" = ext ] ; then
+ FILEFORMAT=EXTRA
+ ENABLED_TEST=no
+ fi
+ if [ "@ENABLE_IEG@" = no -a "${FORMAT}" = ieg ] ; then
+ FILEFORMAT=IEG
+ ENABLED_TEST=no
+ fi
+ if [ "@ENABLE_GRIB@" = no -a "${FORMAT}" = grb ] ; then
+ FILEFORMAT=GRIB
+ ENABLED_TEST=no;
+ fi
+ if [ "@ENABLE_GRIBAPI@" = no -a "${FORMAT}" = grb2 ] ; then
+ FILEFORMAT=GRIB_API
+ ENABLED_TEST=no
+ fi
+ if [ "@ENABLE_NETCDF@" = no -a "${FORMAT}" = nc ] ; then
+ FILEFORMAT=netCDF
+ ENABLED_TEST=no
+ fi
+ if [ "@ENABLE_NETCDF@" = no -a "${FORMAT}" = nc2 ] ; then
+ FILEFORMAT=netCDF2
+ ENABLED_TEST=no
+ fi
+ if [ "@ENABLE_NC4@" = no -a "${FORMAT}" = nc4 ] ; then
+ FILEFORMAT=netCDF4
+ ENABLED_TEST=no
+ fi
+
+ if [ "${ENABLED_TEST}" = yes ] ; then
+ for DATATYPE in F32 F64; do
+ FILE=file_${DATATYPE}_${FORMAT}
+ RFILE=$DATAPATH/file_F32_srv_ref
+
+ if [ $OPERATOR = write ] ; then
+ CDOCOMMAND="$CDO -f $FORMAT -b $DATATYPE cdi${OPERATOR},1,global_10,3,3,3 $FILE"
+ echo "$CDOCOMMAND"
+
+ $CDOCOMMAND > $CDOOUT 2> $CDOERR
+ test $? -eq 0 || let RSTAT+=1
+ test -s $FILE || let RSTAT+=1
+ cat $CDOOUT $CDOERR
+ else
+ CDOCOMMAND="$CDO cdi${OPERATOR} $FILE"
+ echo "$CDOCOMMAND"
+
+ $CDOCOMMAND > $CDOOUT 2> $CDOERR
+ test $? -eq 0 || let RSTAT+=1
+ cat $CDOOUT $CDOERR
+
+ $CDO diff,0.0001 $FILE $RFILE > $CDOOUT 2> $CDOERR
+ test $? -eq 0 || let RSTAT+=1
+ test -s $CDOOUT && let RSTAT+=1
+ cat $CDOOUT $CDOERR
+
+ rm -f $FILE
+ fi
+ done
+
+ test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
+ test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
+ else
+ test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST # SKIP $FILEFORMAT not enabled"
+ fi
+
+ let NTEST+=1
+ done
+done
+#
+rm -f $CDOOUT $CDOERR
+#
+exit 0
diff --git a/test/Makefile.am b/test/Makefile.am
index bdc5f6b..6e2630f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -5,8 +5,8 @@ export
TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
$(top_srcdir)/config/tap-driver.sh
-TESTS = Read_grib.test Read_netcdf.test Copy_netcdf.test Cat.test Gridarea.test Detrend.test Genweights.test Remap.test \
- Select.test Spectral.test Timstat.test Vertint.test Arith.test
+TESTS = File.test Read_grib.test Read_netcdf.test Copy_netcdf.test Cat.test Gridarea.test Detrend.test \
+ Genweights.test Remap.test Select.test Spectral.test Timstat.test Vertint.test Arith.test
# $(top_srcdir)/test/test_Remap.sh \
# $(top_srcdir)/test/test_info.py
diff --git a/test/Makefile.in b/test/Makefile.in
index d3b4c12..2eefc54 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -79,13 +79,14 @@ build_triplet = @build@
host_triplet = @host@
subdir = test
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
- $(top_srcdir)/config/mkinstalldirs $(srcdir)/Read_grib.test.in \
- $(srcdir)/Read_netcdf.test.in $(srcdir)/Copy_netcdf.test.in \
- $(srcdir)/Cat.test.in $(srcdir)/Gridarea.test.in \
- $(srcdir)/Genweights.test.in $(srcdir)/Remap.test.in \
- $(srcdir)/Select.test.in $(srcdir)/Spectral.test.in \
- $(srcdir)/Timstat.test.in $(srcdir)/Vertint.test.in \
- $(srcdir)/Detrend.test.in $(srcdir)/Arith.test.in README
+ $(top_srcdir)/config/mkinstalldirs $(srcdir)/File.test.in \
+ $(srcdir)/Read_grib.test.in $(srcdir)/Read_netcdf.test.in \
+ $(srcdir)/Copy_netcdf.test.in $(srcdir)/Cat.test.in \
+ $(srcdir)/Gridarea.test.in $(srcdir)/Genweights.test.in \
+ $(srcdir)/Remap.test.in $(srcdir)/Select.test.in \
+ $(srcdir)/Spectral.test.in $(srcdir)/Timstat.test.in \
+ $(srcdir)/Vertint.test.in $(srcdir)/Detrend.test.in \
+ $(srcdir)/Arith.test.in README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_options.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
@@ -96,10 +97,10 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES = Read_grib.test Read_netcdf.test Copy_netcdf.test \
- Cat.test Gridarea.test Genweights.test Remap.test Select.test \
- Spectral.test Timstat.test Vertint.test Detrend.test \
- Arith.test
+CONFIG_CLEAN_FILES = File.test Read_grib.test Read_netcdf.test \
+ Copy_netcdf.test Cat.test Gridarea.test Genweights.test \
+ Remap.test Select.test Spectral.test Timstat.test Vertint.test \
+ Detrend.test Arith.test
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_ at AM_V@)
am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
@@ -361,7 +362,10 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
ENABLE_DATA = @ENABLE_DATA@
ENABLE_EXTRA = @ENABLE_EXTRA@
ENABLE_GRIB = @ENABLE_GRIB@
+ENABLE_GRIBAPI = @ENABLE_GRIBAPI@
ENABLE_IEG = @ENABLE_IEG@
+ENABLE_NC2 = @ENABLE_NC2@
+ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NETCDF = @ENABLE_NETCDF@
ENABLE_SERVICE = @ENABLE_SERVICE@
EXEEXT = @EXEEXT@
@@ -497,8 +501,8 @@ CLEANFILES = `ls *.pyc`
TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
$(top_srcdir)/config/tap-driver.sh
-TESTS = Read_grib.test Read_netcdf.test Copy_netcdf.test Cat.test Gridarea.test Detrend.test Genweights.test Remap.test \
- Select.test Spectral.test Timstat.test Vertint.test Arith.test
+TESTS = File.test Read_grib.test Read_netcdf.test Copy_netcdf.test Cat.test Gridarea.test Detrend.test \
+ Genweights.test Remap.test Select.test Spectral.test Timstat.test Vertint.test Arith.test
# $(top_srcdir)/test/test_Remap.sh \
@@ -547,6 +551,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+File.test: $(top_builddir)/config.status $(srcdir)/File.test.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
Read_grib.test: $(top_builddir)/config.status $(srcdir)/Read_grib.test.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
Read_netcdf.test: $(top_builddir)/config.status $(srcdir)/Read_netcdf.test.in
diff --git a/test/data/._netcdf_testfile01.nc b/test/data/._netcdf_testfile01.nc
deleted file mode 100644
index ea54672..0000000
Binary files a/test/data/._netcdf_testfile01.nc and /dev/null differ
diff --git a/test/data/Makefile.am b/test/data/Makefile.am
index 60fc9d4..81224a8 100644
--- a/test/data/Makefile.am
+++ b/test/data/Makefile.am
@@ -1,6 +1,7 @@
INPUTDATA = ts_mm_5years hl_l19.grb t21_geosp_tsurf.grb bathy4.grb pl_data pl_data.grb detrend_data \
grib_testfile01.grb grib_testfile02.grb netcdf_testfile01.nc netcdf_testfile02.nc testfile01c.nc
+FILE_REF = file_F32_srv_ref
GRIB_REF = grib_testfile01_sinfo_ref grib_testfile01_info_ref grib_testfile02_sinfo_ref grib_testfile02_info_ref
NETCDF_REF = netcdf_testfile01_sinfon_ref netcdf_testfile01_infon_ref netcdf_testfile02_sinfon_ref netcdf_testfile02_infon_ref
TIMSTAT_REF = timmin_ref timmax_ref timsum_ref timavg_ref timmean_ref timstd_ref timstd1_ref timvar_ref timvar1_ref
@@ -11,4 +12,4 @@ REMAP_REF = n16_bic_ref n16_bil_ref n16_con_ref n16_ycon_ref n16_laf_ref n16_
SELECT_REF = select1_ref select2_ref select3_ref select4_ref select5_ref
DETREND_REF = detrend_ref
-EXTRA_DIST = $(INPUTDATA) $(GRIB_REF) $(NETCDF_REF) $(TIMSTAT_REF) $(SPECTRAL_REF) $(VERTINT_REF) $(REMAP_REF) $(SELECT_REF) $(DETREND_REF)
+EXTRA_DIST = $(INPUTDATA) $(FILE_REF) $(GRIB_REF) $(NETCDF_REF) $(TIMSTAT_REF) $(SPECTRAL_REF) $(VERTINT_REF) $(REMAP_REF) $(SELECT_REF) $(DETREND_REF)
diff --git a/test/data/Makefile.in b/test/data/Makefile.in
index 4065b62..08a6c67 100644
--- a/test/data/Makefile.in
+++ b/test/data/Makefile.in
@@ -151,7 +151,10 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
ENABLE_DATA = @ENABLE_DATA@
ENABLE_EXTRA = @ENABLE_EXTRA@
ENABLE_GRIB = @ENABLE_GRIB@
+ENABLE_GRIBAPI = @ENABLE_GRIBAPI@
ENABLE_IEG = @ENABLE_IEG@
+ENABLE_NC2 = @ENABLE_NC2@
+ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NETCDF = @ENABLE_NETCDF@
ENABLE_SERVICE = @ENABLE_SERVICE@
EXEEXT = @EXEEXT@
@@ -284,6 +287,7 @@ top_srcdir = @top_srcdir@
INPUTDATA = ts_mm_5years hl_l19.grb t21_geosp_tsurf.grb bathy4.grb pl_data pl_data.grb detrend_data \
grib_testfile01.grb grib_testfile02.grb netcdf_testfile01.nc netcdf_testfile02.nc testfile01c.nc
+FILE_REF = file_F32_srv_ref
GRIB_REF = grib_testfile01_sinfo_ref grib_testfile01_info_ref grib_testfile02_sinfo_ref grib_testfile02_info_ref
NETCDF_REF = netcdf_testfile01_sinfon_ref netcdf_testfile01_infon_ref netcdf_testfile02_sinfon_ref netcdf_testfile02_infon_ref
TIMSTAT_REF = timmin_ref timmax_ref timsum_ref timavg_ref timmean_ref timstd_ref timstd1_ref timvar_ref timvar1_ref
@@ -294,7 +298,7 @@ REMAP_REF = n16_bic_ref n16_bil_ref n16_con_ref n16_ycon_ref n16_laf_ref n16_nn_
SELECT_REF = select1_ref select2_ref select3_ref select4_ref select5_ref
DETREND_REF = detrend_ref
-EXTRA_DIST = $(INPUTDATA) $(GRIB_REF) $(NETCDF_REF) $(TIMSTAT_REF) $(SPECTRAL_REF) $(VERTINT_REF) $(REMAP_REF) $(SELECT_REF) $(DETREND_REF)
+EXTRA_DIST = $(INPUTDATA) $(FILE_REF) $(GRIB_REF) $(NETCDF_REF) $(TIMSTAT_REF) $(SPECTRAL_REF) $(VERTINT_REF) $(REMAP_REF) $(SELECT_REF) $(DETREND_REF)
all: all-am
.SUFFIXES:
diff --git a/test/data/file_F32_srv_ref b/test/data/file_F32_srv_ref
new file mode 100644
index 0000000..42937d1
Binary files /dev/null and b/test/data/file_F32_srv_ref differ
diff --git a/test/data/netcdf_testfile01_infon_ref b/test/data/netcdf_testfile01_infon_ref
index b16b297..49653c5 100644
--- a/test/data/netcdf_testfile01_infon_ref
+++ b/test/data/netcdf_testfile01_infon_ref
@@ -1,13 +1,13 @@
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name
- 1 : 0000-01-00 00:00:00 0 2592 0 : -48.800 3.1647 32.000 : tem
- 2 : 0000-02-00 00:00:00 0 2592 0 : -48.700 2.4530 30.800 : tem
- 3 : 0000-03-00 00:00:00 0 2592 0 : -62.300 2.2681 30.900 : tem
- 4 : 0000-04-00 00:00:00 0 2592 0 : -68.500 3.5152 32.700 : tem
- 5 : 0000-05-00 00:00:00 0 2592 0 : -69.200 5.4965 34.100 : tem
- 6 : 0000-06-00 00:00:00 0 2592 0 : -69.000 6.9265 35.200 : tem
- 7 : 0000-07-00 00:00:00 0 2592 0 : -70.300 7.2876 35.700 : tem
- 8 : 0000-08-00 00:00:00 0 2592 0 : -70.200 6.9544 35.000 : tem
- 9 : 0000-09-00 00:00:00 0 2592 0 : -68.900 5.8637 32.900 : tem
- 10 : 0000-10-00 00:00:00 0 2592 0 : -60.800 4.6208 30.700 : tem
- 11 : 0000-11-00 00:00:00 0 2592 0 : -47.000 3.8041 31.000 : tem
- 12 : 0000-12-00 00:00:00 0 2592 0 : -46.300 3.5452 31.800 : tem
+ 1 : 0000-01-01 00:00:00 0 2592 0 : -48.800 3.1647 32.000 : tem
+ 2 : 0000-02-01 00:00:00 0 2592 0 : -48.700 2.4530 30.800 : tem
+ 3 : 0000-03-01 00:00:00 0 2592 0 : -62.300 2.2681 30.900 : tem
+ 4 : 0000-04-01 00:00:00 0 2592 0 : -68.500 3.5152 32.700 : tem
+ 5 : 0000-05-01 00:00:00 0 2592 0 : -69.200 5.4965 34.100 : tem
+ 6 : 0000-06-01 00:00:00 0 2592 0 : -69.000 6.9265 35.200 : tem
+ 7 : 0000-07-01 00:00:00 0 2592 0 : -70.300 7.2876 35.700 : tem
+ 8 : 0000-08-01 00:00:00 0 2592 0 : -70.200 6.9544 35.000 : tem
+ 9 : 0000-09-01 00:00:00 0 2592 0 : -68.900 5.8637 32.900 : tem
+ 10 : 0000-10-01 00:00:00 0 2592 0 : -60.800 4.6208 30.700 : tem
+ 11 : 0000-11-01 00:00:00 0 2592 0 : -47.000 3.8041 31.000 : tem
+ 12 : 0000-12-01 00:00:00 0 2592 0 : -46.300 3.5452 31.800 : tem
diff --git a/test/data/netcdf_testfile01_sinfon_ref b/test/data/netcdf_testfile01_sinfon_ref
index 9216824..f575024 100644
--- a/test/data/netcdf_testfile01_sinfon_ref
+++ b/test/data/netcdf_testfile01_sinfon_ref
@@ -9,6 +9,6 @@
1 : surface : levels=1
Time coordinate : 12 steps
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss
- 0000-01-00 00:00:00 0000-02-00 00:00:00 0000-03-00 00:00:00 0000-04-00 00:00:00
- 0000-05-00 00:00:00 0000-06-00 00:00:00 0000-07-00 00:00:00 0000-08-00 00:00:00
- 0000-09-00 00:00:00 0000-10-00 00:00:00 0000-11-00 00:00:00 0000-12-00 00:00:00
+ 0000-01-01 00:00:00 0000-02-01 00:00:00 0000-03-01 00:00:00 0000-04-01 00:00:00
+ 0000-05-01 00:00:00 0000-06-01 00:00:00 0000-07-01 00:00:00 0000-08-01 00:00:00
+ 0000-09-01 00:00:00 0000-10-01 00:00:00 0000-11-01 00:00:00 0000-12-01 00:00:00
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cdo.git
More information about the debian-science-commits
mailing list