Commit 55fd3444 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

new function: streamNvals

parent 4190f757
2006-12-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* new function: streamNvals
* Version 1.0.4 released
2006-11-03 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* using GRIB library version 1.0.3
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for cdi 1.0.3.
# Generated by GNU Autoconf 2.59 for cdi 1.0.4.
#
# Report bugs to <Uwe.Schulzweida@zmaw.de>.
#
......@@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='cdi'
PACKAGE_TARNAME='cdi'
PACKAGE_VERSION='1.0.3'
PACKAGE_STRING='cdi 1.0.3'
PACKAGE_VERSION='1.0.4'
PACKAGE_STRING='cdi 1.0.4'
PACKAGE_BUGREPORT='Uwe.Schulzweida@zmaw.de'
# Factoring default headers for most tests.
......@@ -795,7 +795,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.0.3 to adapt to many kinds of systems.
\`configure' configures cdi 1.0.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -862,7 +862,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of cdi 1.0.3:";;
short | recursive ) echo "Configuration of cdi 1.0.4:";;
esac
cat <<\_ACEOF
......@@ -1006,7 +1006,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
cdi configure 1.0.3
cdi configure 1.0.4
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
......@@ -1020,7 +1020,7 @@ cat >&5 <<_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.0.3, which was
It was created by cdi $as_me 1.0.4, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
......@@ -1707,7 +1707,7 @@ fi
# Define the identity of the package.
PACKAGE=cdi
VERSION=1.0.3
VERSION=1.0.4
cat >>confdefs.h <<_ACEOF
......@@ -6400,7 +6400,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by cdi $as_me 1.0.3, which was
This file was extended by cdi $as_me 1.0.4, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -6463,7 +6463,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
cdi config.status 1.0.3
cdi config.status 1.0.4
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
......
# Process this file with autoconf to produce a configure script.
AC_INIT(cdi, 1.0.3, Uwe.Schulzweida@zmaw.de)
AC_INIT(cdi, 1.0.4, Uwe.Schulzweida@zmaw.de)
CONFIG_ABORT=yes
......
......@@ -958,6 +958,8 @@ int main(int argc, char *argv[])
free(data);
fprintf(stderr, "%ld\n", (long) streamNvals(streamID1));
if ( fname2 ) streamClose(streamID2);
streamClose(streamID1);
}
......
#ifndef _CDI_H
#define _CDI_H
#include <sys/types.h>
#if defined(__cplusplus)
extern "C" {
#endif
......@@ -186,6 +188,7 @@ int streamInqTimestep(int streamID, int tsID);
char *streamFilename(int streamID);
char *streamFilesuffix(int filetype);
int streamNtsteps(int streamID);
off_t streamNvals(int streamID);
/* STREAM var I/O routines */
......
......@@ -1658,6 +1658,14 @@ int streamNtsteps(int streamID)
return (streams[streamID].ntsteps);
}
off_t streamNvals(int streamID)
{
static char func[] = "streamNvals";
streamCheckID(func, streamID);
return (streams[streamID].numvals);
}
/*
@Function streamDefVlist
......
......@@ -2453,6 +2453,7 @@ int cdfReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *n
int xid = UNDEFID, yid = UNDEFID, zid = UNDEFID;
int ncvarid;
int tsID;
int gridsize;
size_t size;
size_t start[4];
size_t count[4];
......@@ -2487,6 +2488,10 @@ int cdfReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *n
zaxisID = vlistInqVarZaxis(vlistID, varID);
timeID = vlistInqVarTime(vlistID, varID);
gridsize = gridInqSize(gridID);
streams[streamID].numvals += gridsize;
gridindex = vlistGridIndex(vlistID, gridID);
if ( gridInqType(gridID) == GRID_TRAJECTORY )
{
......@@ -2581,10 +2586,9 @@ int cdfReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *n
*nmiss = 0;
if ( vlistInqVarMissvalUsed(vlistID, varID) == TRUE )
{
size = gridInqSize(gridID);
missval = vlistInqVarMissval(vlistID, varID);
for ( i = 0; i < (int) size; i++ )
for ( i = 0; i < gridsize; i++ )
if ( DBL_IS_EQUAL(data[i], missval) ) *nmiss += 1;
}
......@@ -2595,12 +2599,11 @@ int cdfReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *n
if ( laddoffset || lscalefactor )
{
size = gridInqSize(gridID);
missval = vlistInqVarMissval(vlistID, varID);
if ( *nmiss > 0 )
{
for ( i = 0; i < (int) size; i++ )
for ( i = 0; i < gridsize; i++ )
{
if ( !DBL_IS_EQUAL(data[i], missval) )
{
......@@ -2611,7 +2614,7 @@ int cdfReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *n
}
else
{
for ( i = 0; i < (int) size; i++ )
for ( i = 0; i < gridsize; i++ )
{
if ( lscalefactor ) data[i] *= scalefactor;
if ( laddoffset ) data[i] += addoffset;
......
......@@ -123,9 +123,11 @@ int extReadRecord(int streamID, double *data, int *nmiss)
extInqHeader(extp, header);
extInqDataDP(extp, data);
missval = vlistInqVarMissval(vlistID, varID);
gridID = vlistInqVarGrid(vlistID, varID);
size = gridInqSize(gridID);
missval = vlistInqVarMissval(vlistID, varID);
streams[streamID].numvals += size;
*nmiss = 0;
for ( i = 0; i < size; i++ )
......
......@@ -302,6 +302,8 @@ int grbReadRecord(int streamID, double *data, int *nmiss)
gridID = vlistInqVarGrid(vlistID, varID);
gridsize = gridInqSize(gridID);
streams[streamID].numvals += gridsize;
fileSetPos(fileID, recpos, SEEK_SET);
fileRead(fileID, gribbuffer, (size_t) recsize);
......
......@@ -123,9 +123,11 @@ int iegReadRecord(int streamID, double *data, int *nmiss)
iegInqDataDP(iegp, data);
missval = vlistInqVarMissval(vlistID, varID);
gridID = vlistInqVarGrid(vlistID, varID);
size = gridInqSize(gridID);
missval = vlistInqVarMissval(vlistID, varID);
streams[streamID].numvals += size;
*nmiss = 0;
for ( i = 0; i < size; i++ )
......
......@@ -204,6 +204,7 @@ void streamsInitEntry(int streamID)
streams[streamID].fileID = 0;
streams[streamID].dimgroupID = UNDEFID;
streams[streamID].filemode = 0;
streams[streamID].numvals = 0;
streams[streamID].filename = NULL;
streams[streamID].ctlname = NULL;
streams[streamID].ctlfp = NULL;
......
......@@ -179,6 +179,7 @@ typedef struct {
int fileID;
int dimgroupID;
int filemode;
off_t numvals;
char *filename;
char *ctlname;
FILE *ctlfp;
......
......@@ -123,9 +123,11 @@ int srvReadRecord(int streamID, double *data, int *nmiss)
srvInqHeader(srvp, header);
srvInqDataDP(srvp, data);
missval = vlistInqVarMissval(vlistID, varID);
gridID = vlistInqVarGrid(vlistID, varID);
size = gridInqSize(gridID);
missval = vlistInqVarMissval(vlistID, varID);
streams[streamID].numvals += size;
*nmiss = 0;
for ( i = 0; i < size; i++ )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment