Commit da48aac1 authored by Deike Kleberg's avatar Deike Kleberg
Browse files

Merge trunk into cdi-pio.

parent b499d8ba
......@@ -298,3 +298,6 @@ tests/Makefile.am -text
tests/Makefile.in -text
tests/test_grib.c -text
tests/test_grib.sh -text
util/sunf95preproc-wrapper -text
util/sxpreproc-wrapper -text
util/xlfpreproc-wrapper -text
2011-12-13 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* verify_coordinate_vars: bug fix in check for units = "1" [report: Katharina Six]
2011-11-11 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added support for netCDF attributes scale_factor and add_offset for lon/lat coordinates
2011-11-04 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added support for GRIB1_LTYPE_SIGMA_LAYER
2011-11-01 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added support for netcdf attribute valid_min/valid_max [request: Etienne Tourigny]
2011-10-27 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* cdilib.c::defineAttributes: bug fix atttxt [report: Florian Prill]
2011-10-25 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added support for netcdf attribute valid_range [request: Etienne Tourigny]
2011-10-17 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* Version 1.5.3 released
* using CGRIBEX library version 1.5.1
2011-10-11 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* zaxisCompare: set epsilon from 0 to 1e-9 [request: Felicia Brisc]
2011-10-06 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added level type ZAXIS_TOA, ZAXIS_SEA_BOTTOM, ZAXIS_ATMOSPHERE [request: Drte Liermann]
2011-10-05 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* stream_cdf::cdfInqContents: check units of hybrid levels
* varAddRecord: used max number of bit_per_value for 3D GRIB data
* gribapiDefGrid: added parameter jScansPositively [report: Juan Jose Tasso]
2011-10-02 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* deflate compression with netCDF4 doesn't work (bug fix) [report: Geert Jan van Oldenborgh]
2011-09-21 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* correct netCDF dimension order of unstructured grids (bug fix) [report: Ralf Mueller]
2011-08-22 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* Version 1.5.2 released
2011-08-15 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* streamFilesuffix: added suffix for filetype NC4C (bug fix)
......
CDI NEWS
--------
Version 1.5.3 (17 October 2011):
New features:
* Added support for level type ZAXIS_TOA, ZAXIS_SEA_BOTTOM, ZAXIS_ATMOSPHERE
Fixed bugs:
* deflate compression with netCDF4 doesn't work
Version 1.5.2 (22 August 2011):
New features:
......
......@@ -87,6 +87,14 @@ case "${HOSTNAME}" in
CC=sxc++ AR=sxar RANLIB=ls \
CFLAGS="-O -Onooverlap,restrict=all -pvctl,fullmsg,noassume,loopcnt=1000000"
;;
lxe0*)
echo 'Please choose compiler modules! Checkout with "module av"!'
./configure --prefix=$(pwd)/build-SX --host=sx9-nec-superux \
--with-netcdf=/usr/local/pkg-sx9 \
--with-grib_api=/usr/local/pkg-sx9/grib_api CC=sxc++ FC=sxf90 \
LD=/SX/opt/crosskit/inst/bin/sxld AR=/SX/opt/crosskit/inst/bin/sxar \
RANLIB=echo
;;
# mips-sgi-irix6.5
ecgate1)
./configure --prefix=$HOME/local \
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for cdi 1.5.2.
# Generated by GNU Autoconf 2.68 for cdi 1.5.4.
#
# Report bugs to <http://code.zmaw.de/projects/cdi>.
#
......@@ -570,8 +570,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='cdi'
PACKAGE_TARNAME='cdi'
PACKAGE_VERSION='1.5.2'
PACKAGE_STRING='cdi 1.5.2'
PACKAGE_VERSION='1.5.4'
PACKAGE_STRING='cdi 1.5.4'
PACKAGE_BUGREPORT='http://code.zmaw.de/projects/cdi'
PACKAGE_URL=''
 
......@@ -1394,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 cdi 1.5.2 to adapt to many kinds of systems.
\`configure' configures cdi 1.5.4 to adapt to many kinds of systems.
 
Usage: $0 [OPTION]... [VAR=VALUE]...
 
......@@ -1464,7 +1464,7 @@ fi
 
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of cdi 1.5.2:";;
short | recursive ) echo "Configuration of cdi 1.5.4:";;
esac
cat <<\_ACEOF
 
......@@ -1616,7 +1616,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
cdi configure 1.5.2
cdi configure 1.5.4
generated by GNU Autoconf 2.68
 
Copyright (C) 2010 Free Software Foundation, Inc.
......@@ -2331,7 +2331,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.5.2, which was
It was created by cdi $as_me 1.5.4, which was
generated by GNU Autoconf 2.68. Invocation command line was
 
$ $0 $@
......@@ -3263,7 +3263,7 @@ fi
 
# Define the identity of the package.
PACKAGE='cdi'
VERSION='1.5.2'
VERSION='1.5.4'
 
 
cat >>confdefs.h <<_ACEOF
......@@ -24725,7 +24725,7 @@ fi
 
done
 
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing deflate" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing deflate" >&5
$as_echo_n "checking for library containing deflate... " >&6; }
if ${ac_cv_search_deflate+:} false; then :
$as_echo_n "(cached) " >&6
......@@ -25561,10 +25561,19 @@ $as_echo "no" >&6; }
fi
 
 
$as_echo $NC_CONFIG
if test "x$NC_CONFIG" != "x"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
$as_echo "found" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking netcdf's OpenDAP support" >&5
$as_echo_n "checking netcdf's OpenDAP support... " >&6; }
if test "x$($NC_CONFIG --has-dap)" = "xyes"; then :
$as_echo "#define HAVE_LIBNC_DAP 1" >>confdefs.h
{ $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
$as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking netcdf's nc2 support" >&5
$as_echo_n "checking netcdf's nc2 support... " >&6; }
if test "x$($NC_CONFIG --has-nc2)" = "xyes"; then :
......@@ -26074,7 +26083,7 @@ ENABLE_IEG=$enable_ieg
 
# ----------------------------------------------------------------------
# At the moment, there are two possible CDI bindings
# (default for CDO) linking directly to CDI's object files in ./libcdi/src
# (default for CDO) linking directly to CDI convenience library with libtool
# (default for CDI) build and link to a shared CDI library
if test "x$CDO_DISABLE_CDILIB" = "x1"; then :
enable_cdi_lib=no
......@@ -27180,7 +27189,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.5.2, which was
This file was extended by cdi $as_me 1.5.4, which was
generated by GNU Autoconf 2.68. Invocation command line was
 
CONFIG_FILES = $CONFIG_FILES
......@@ -27246,7 +27255,7 @@ _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.5.2
cdi config.status 1.5.4
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
 
......
# Process this file with autoconf to produce a configure script.
AC_INIT([cdi], [1.5.2], [http://code.zmaw.de/projects/cdi])
AC_INIT([cdi], [1.5.4], [http://code.zmaw.de/projects/cdi])
echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}"
......
......@@ -45,8 +45,8 @@ AC_ARG_WITH([zlib],
AC_SEARCH_LIBS([deflate],[z],[AC_DEFINE([HAVE_LIBZ],[1],[Define 1 for ZLIB support])])
ZLIB_INCLUDE=" -I$ZLIB_ROOT/include"
ZLIB_LIBS=" -L$ZLIB_ROOT/lib -lz"])],
[AC_CHECK_HEADERS(zlib.h)
AC_SEARCH_LIBS([deflate],[z],[AC_DEFINE([HAVE_LIBZ],[1],[Define 1 for ZLIB support])])
[AC_CHECK_HEADERS(zlib.h)
AC_SEARCH_LIBS([deflate],[z],[AC_DEFINE([HAVE_LIBZ],[1],[Define 1 for ZLIB support])])
ZLIB_LIBS=" -lz"])
AC_SUBST([ZLIB_INCLUDE])
AC_SUBST([ZLIB_LIBS])
......@@ -173,10 +173,12 @@ AC_ARG_WITH([netcdf],
NETCDF_INCLUDE=" -I$NETCDF_ROOT/include"
AC_MSG_CHECKING([nc-config script])
AC_CHECK_PROG(NC_CONFIG,nc-config,[$NETCDF_ROOT/bin/nc-config],,["$NETCDF_ROOT/bin"])
AS_ECHO([$NC_CONFIG])
AS_IF([test "x$NC_CONFIG" != "x"],
[AC_MSG_RESULT([found])
AC_MSG_CHECKING([netcdf's nc2 support])
[AC_MSG_CHECKING([netcdf's OpenDAP support])
AS_IF([test "x$($NC_CONFIG --has-dap)" = "xyes"],
[AC_DEFINE([HAVE_LIBNC_DAP],[1],[Define to 1 for NETCDF OpenDAP])
AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])]
[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])],[AC_MSG_RESULT([no])])
......@@ -310,7 +312,7 @@ AC_MSG_RESULT([$enable_ieg])
AC_SUBST([ENABLE_IEG],[$enable_ieg])
# ----------------------------------------------------------------------
# At the moment, there are two possible CDI bindings
# (default for CDO) linking directly to CDI's object files in ./libcdi/src
# (default for CDO) linking directly to CDI convenience library with libtool
# (default for CDI) build and link to a shared CDI library
AS_IF([test "x$CDO_DISABLE_CDILIB" = "x1"],[enable_cdi_lib=no],[enable_cdi_lib=yes])
# save CDI binding mode for later automake use
......
......@@ -124,7 +124,11 @@ cdilib.c:
cdilib.o: cdilib.c
$(COMPILE) -c $<
LOCALTARGETS = pkgconfig/cdi.pc
LOCALTARGETS =
if ENABLE_CDI_LIB
LOCALTARGETS += pkgconfig/cdi.pc
endif
if CREATE_ISOC
LOCALTARGETS += mo_cdi.o mo_cdi.$(FCMODEXT)
endif
......@@ -149,6 +153,9 @@ if CREATE_ISOC
CLEANFILES += $(top_builddir)/src/mo_cdi.$(FCMODEXT) $(top_builddir)/src/mo_cdi.o
endif
if ENABLE_CDI_LIB
CLEANFILES += pkgconfig/cdi.pc
install-exec-local: pkgconfig/cdi.pc
$(mkinstalldirs) "$(DESTDIR)$(libdir)/pkgconfig"
$(install_sh_DATA) pkgconfig/cdi.pc "$(DESTDIR)$(libdir)/pkgconfig/cdi.pc"
......@@ -157,3 +164,10 @@ uninstall-local:
rm -f "$(DESTDIR)$(libdir)/pkgconfig/cdi.pc"
rmdir "$(DESTDIR)$(libdir)/pkgconfig"
endif
install-exec-hook:
-@rmdir "$(DESTDIR)$(libdir)"
install-data-hook:
-@rmdir "$(DESTDIR)$(includedir)"
......@@ -35,8 +35,10 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@CREATE_ISOC_TRUE@am__append_1 = mo_cdi.o mo_cdi.$(FCMODEXT)
@CREATE_ISOC_TRUE@am__append_2 = $(top_builddir)/src/mo_cdi.$(FCMODEXT) $(top_builddir)/src/mo_cdi.o
@ENABLE_CDI_LIB_TRUE@am__append_1 = pkgconfig/cdi.pc
@CREATE_ISOC_TRUE@am__append_2 = mo_cdi.o mo_cdi.$(FCMODEXT)
@CREATE_ISOC_TRUE@am__append_3 = $(top_builddir)/src/mo_cdi.$(FCMODEXT) $(top_builddir)/src/mo_cdi.o
@ENABLE_CDI_LIB_TRUE@am__append_4 = pkgconfig/cdi.pc
subdir = src
DIST_COMMON = $(am__include_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in
......@@ -401,9 +403,9 @@ libcdi_la_SOURCES = \
stream.c \
swap.c
LOCALTARGETS = pkgconfig/cdi.pc $(am__append_1)
LOCALTARGETS = $(am__append_1) $(am__append_2)
#
CLEANFILES = `ls *~` cdilib.c $(am__append_2)
CLEANFILES = `ls *~` cdilib.c $(am__append_3) $(am__append_4)
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
......@@ -726,6 +728,8 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
@ENABLE_CDI_LIB_FALSE@uninstall-local:
@ENABLE_CDI_LIB_FALSE@install-exec-local:
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
......@@ -750,13 +754,15 @@ info: info-am
info-am:
install-data-am: install-includeHEADERS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-exec-local install-libLTLIBRARIES
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-html: install-html-am
install-html-am:
......@@ -798,15 +804,16 @@ ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
uninstall-local
.MAKE: all install-am install-strip
.MAKE: all install-am install-data-am install-exec-am install-strip
.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
clean-generic clean-libLTLIBRARIES clean-libtool \
clean-noinstLTLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-hdr distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-exec-local \
install install-am install-data install-data-am \
install-data-hook install-dvi install-dvi-am install-exec \
install-exec-am install-exec-hook install-exec-local \
install-html install-html-am install-includeHEADERS \
install-info install-info-am install-libLTLIBRARIES \
install-man install-pdf install-pdf-am install-ps \
......@@ -841,13 +848,18 @@ pkgconfig/cdi.pc: pkgconfig/cdi.pc.in ../config.status
#
all-local: $(LOCALTARGETS)
install-exec-local: pkgconfig/cdi.pc
$(mkinstalldirs) "$(DESTDIR)$(libdir)/pkgconfig"
$(install_sh_DATA) pkgconfig/cdi.pc "$(DESTDIR)$(libdir)/pkgconfig/cdi.pc"
@ENABLE_CDI_LIB_TRUE@install-exec-local: pkgconfig/cdi.pc
@ENABLE_CDI_LIB_TRUE@ $(mkinstalldirs) "$(DESTDIR)$(libdir)/pkgconfig"
@ENABLE_CDI_LIB_TRUE@ $(install_sh_DATA) pkgconfig/cdi.pc "$(DESTDIR)$(libdir)/pkgconfig/cdi.pc"
@ENABLE_CDI_LIB_TRUE@uninstall-local:
@ENABLE_CDI_LIB_TRUE@ rm -f "$(DESTDIR)$(libdir)/pkgconfig/cdi.pc"
@ENABLE_CDI_LIB_TRUE@ rmdir "$(DESTDIR)$(libdir)/pkgconfig"
uninstall-local:
rm -f "$(DESTDIR)$(libdir)/pkgconfig/cdi.pc"
rmdir "$(DESTDIR)$(libdir)/pkgconfig"
install-exec-hook:
-@rmdir "$(DESTDIR)$(libdir)"
install-data-hook:
-@rmdir "$(DESTDIR)$(includedir)"
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
......
......@@ -147,6 +147,10 @@ extern "C" {
#define ZAXIS_ALTITUDE 10 /* Altitude above mean sea level in meters */
#define ZAXIS_SIGMA 11 /* Sigma level */
#define ZAXIS_MEANSEA 12 /* Mean sea level */
#define ZAXIS_TOA 13 /* Norminal top of atmosphere */
#define ZAXIS_SEA_BOTTOM 14 /* Sea bottom */
#define ZAXIS_ATMOSPHERE 15 /* Entire atmosphere */
#define ZAXIS_REFERENCE 16 /* zaxis reference number */
/* TAXIS types */
......
......@@ -3,7 +3,7 @@
!
! Author:
! -------
! Uwe Schulzweida, MPI-MET, Hamburg, October 2011
! Uwe Schulzweida, MPI-MET, Hamburg, December 2011
!
INTEGER CDI_MAX_NAME
......@@ -244,6 +244,14 @@
PARAMETER (ZAXIS_SIGMA = 11)
INTEGER ZAXIS_MEANSEA
PARAMETER (ZAXIS_MEANSEA = 12)
INTEGER ZAXIS_TOA
PARAMETER (ZAXIS_TOA = 13)
INTEGER ZAXIS_SEA_BOTTOM
PARAMETER (ZAXIS_SEA_BOTTOM = 14)
INTEGER ZAXIS_ATMOSPHERE
PARAMETER (ZAXIS_ATMOSPHERE = 15)
INTEGER ZAXIS_REFERENCE
PARAMETER (ZAXIS_REFERENCE = 16)
!
! TAXIS types
!
......@@ -327,28 +335,22 @@
PARAMETER (PIO_ASYNCH = 3)
INTEGER PIO_FPGUARD
PARAMETER (PIO_FPGUARD = 4)
INTEGER pioInit
! (INTEGER ,
! INTEGER ,
! INTEGER ,
! INTEGER ,
! INTEGER )
EXTERNAL pioInit
! pioFinalize
EXTERNAL pioFinalize
! pioEndDef
EXTERNAL pioEndDef
! pioEndTimestepping
EXTERNAL pioEndTimestepping
! pioWriteTimestep
! pioFinalize
EXTERNAL pioFinalize
INTEGER pioInit
! (INTEGER ,
! INTEGER ,
! INTEGER ,
! INTEGER ,
! INTEGER )
EXTERNAL pioWriteTimestep
EXTERNAL pioInit
INTEGER pioInqVarDecoChunk
! (INTEGER ,
......@@ -364,6 +366,12 @@
! (INTEGER )
EXTERNAL pioNamespaceSetActive
! pioWriteTimestep
! (INTEGER ,
! INTEGER ,
! INTEGER )
EXTERNAL pioWriteTimestep
CHARACTER*80 cdiStringError
! (INTEGER cdiErrno)
EXTERNAL cdiStringError
......
......@@ -53,14 +53,14 @@
/* CALENDAR types */
FCALLSCFUN5 (INT, pioInit, PIOINIT, pioinit, INT, INT, INT, INT, PINT)
FCALLSCSUB0 (pioFinalize, PIOFINALIZE, piofinalize)
FCALLSCSUB0 (pioEndDef, PIOENDDEF, pioenddef)
FCALLSCSUB0 (pioEndTimestepping, PIOENDTIMESTEPPING, pioendtimestepping)
FCALLSCSUB3 (pioWriteTimestep, PIOWRITETIMESTEP, piowritetimestep, INT, INT, INT)
FCALLSCSUB0 (pioFinalize, PIOFINALIZE, piofinalize)
FCALLSCFUN5 (INT, pioInit, PIOINIT, pioinit, INT, INT, INT, INT, PINT)
FCALLSCFUN2 (INT, pioInqVarDecoChunk, PIOINQVARDECOCHUNK, pioinqvardecochunk, INT, INT)
FCALLSCFUN2 (INT, pioInqVarDecoOff, PIOINQVARDECOOFF, pioinqvardecooff, INT, INT)
FCALLSCSUB1 (pioNamespaceSetActive, PIONAMESPACESETACTIVE, pionamespacesetactive, INT)
FCALLSCSUB3 (pioWriteTimestep, PIOWRITETIMESTEP, piowritetimestep, INT, INT, INT)
FCALLSCFUN1 (STRING, cdiStringError, CDISTRINGERROR, cdistringerror, INT)
FCALLSCSUB1 (cdiDebug, CDIDEBUG, cdidebug, INT)
FCALLSCFUN0 (STRING, cdiLibraryVersion, CDILIBRARYVERSION, cdilibraryversion)
......
......@@ -8,12 +8,16 @@
/* GRIB1 Level Types */
#define GRIB1_LTYPE_SURFACE 1
#define GRIB1_LTYPE_TOA 8
#define GRIB1_LTYPE_SEA_BOTTOM 9
#define GRIB1_LTYPE_ATMOSPHERE 10
#define GRIB1_LTYPE_99 99
#define GRIB1_LTYPE_ISOBARIC 100
#define GRIB1_LTYPE_MEANSEA 102
#define GRIB1_LTYPE_ALTITUDE 103
#define GRIB1_LTYPE_HEIGHT 105
#define GRIB1_LTYPE_SIGMA 107
#define GRIB1_LTYPE_SIGMA_LAYER 108
#define GRIB1_LTYPE_HYBRID 109
#define GRIB1_LTYPE_HYBRID_LAYER 110
#define GRIB1_LTYPE_LANDDEPTH 111
......@@ -240,12 +244,3 @@ double calculate_pfactor(const double* spectralField, long fieldTruncation, long
#endif /* _CGRIBEX_H */
/*
* Local Variables:
* c-file-style: "Java"
* c-basic-offset: 2
* indent-tabs-mode: nil
* show-trailing-whitespace: t
* require-trailing-newline: t
* End:
*/
/* Automatically generated by m214003 at 2011-02-15, do not edit */
/* Automatically generated by m214003 at 2011-08-29, do not edit */
/* CGRIBEXLIB_VERSION="1.5.0" */
/* CGRIBEXLIB_VERSION="1.5.1" */
#if defined (HAVE_CONFIG_H)
# include "config.h"
......@@ -3268,9 +3268,7 @@ void encodeBMS(GRIBPACK *lGrib, long *gribLen, double *fsec3, int *isec4, double
long bmsLen, bmsUnusedBits;
long fsec4size;
long z = *gribLen;
#ifdef VECTORCODE
unsigned int *imask;
#endif
static int lmissvalinfo = 1;
/* unsigned int c, imask; */
......@@ -3820,7 +3818,7 @@ void gribEncode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
bmsIncluded = ISEC1_Sec2Or3Flag & 64;
/* set max header len */
len = 3000;
len = 16384;
/* add data len */
numBytes = (ISEC4_NumBits+7)>>3;
......@@ -3830,7 +3828,6 @@ void gribEncode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
/* add bitmap len */
if ( bmsIncluded ) len += (klenp+7)>>3;
#if defined (VECTORCODE)
lGrib = (GRIBPACK *) malloc(len*sizeof(GRIBPACK));
if ( lGrib == NULL ) SysError("No Memory!");
......@@ -3886,17 +3883,15 @@ void gribEncode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
bdsend = gribLen;
encodeES(lGrib, &gribLen, bdsstart);
if ( (size_t) gribLen > len )
Error("lGrib buffer too small! len = %d gribLen = %d", len, gribLen);
if ( (size_t) gribLen > kleng*sizeof(int) )
Error("kgrib buffer too small! kleng = %d gribLen = %d", kleng, gribLen);
#if defined (VECTORCODE)
if ( (size_t) gribLen > len )
Error("lGrib buffer too small! len = %d gribLen = %d", len, gribLen);
(void) PACK_GRIB(lGrib, (unsigned char *)CGrib, gribLen, -1L);
#endif
#if defined (VECTORCODE)
free(lGrib);
#endif
......@@ -4421,13 +4416,20 @@ void decode_double_array_common(unsigned char *igrib, long jlend, int NumBits,
unsigned char *bits = igrib;
unsigned int jmask;
long i;
int tbits = 0;
unsigned int tbits = 0;
int n_bits = NumBits;
int t_bits = 0;
jmask = (1 << n_bits) - 1;
for ( i = 0; i < jlend; i++ )
{
if (n_bits - t_bits > 8)
{
tbits = (tbits << 16) | (bits[0] << 8) | (bits[1]);
bits += 2;
t_bits += 16;
}
while ( t_bits < n_bits )
{
tbits = (tbits * 256) + *bits++;
......@@ -4441,6 +4443,54 @@ void decode_double_array_common(unsigned char *igrib, long jlend, int NumBits,
fpdata[i] = fmin + zscale*fpdata[i];
}
static unsigned int mask[] = {0,1,3,7,15,31,63,127,255};
static double shift[9] = {1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0};
static
void decode_double_array_common2(unsigned char *igrib, long jlend, int NumBits,
double fmin, double zscale, double *fpdata)
{
/* code from wgrib routine BDS_unpack */
unsigned char *bits = igrib;
unsigned int map_mask;
long i;
int n_bits = NumBits;
int c_bits, j_bits;
double jj;
/* older unoptimized code, not often used */
c_bits = 8;
map_mask = 128;
for ( i = 0; i < jlend; i++ )
{
jj = 0.0;
j_bits = n_bits;
while (c_bits <= j_bits)
{
if (c_bits == 8)
{
jj = jj * 256.0 + (double) (*bits++);
j_bits -= 8;
}
else
{
jj = (jj * shift[c_bits]) + (double) (*bits & mask[c_bits]);
bits++;
j_bits -= c_bits;
c_bits = 8;
}
}
if (j_bits)
{
c_bits -= j_bits;
jj = (jj * shift[j_bits]) + (double) ((*bits >> c_bits) & mask[j_bits]);
}
fpdata[i] = fmin + zscale*jj;
}
}