Commit 94b0c9de authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

moved streamReadVar functions to stream_read.c

parent 8996fe67
......@@ -17,8 +17,6 @@ Function catalog:
streamInqVlist Get the variable list
streamDefTimestep Define time step
streamInqTimestep Get time step
streamReadVar Read a variable
streamReadVarSlice Read a horizontal slice of a variable
-------------------------------------------------------------
stream_write
-------------------------------------------------------------
......@@ -26,6 +24,13 @@ Function catalog:
streamWriteVarF Write a variable
streamWriteVarSlice Write a horizontal slice of a variable
streamWriteVarSliceF Write a horizontal slice of a variable
-------------------------------------------------------------
stream_read
-------------------------------------------------------------
streamReadVar Read a variable
streamReadVarF Read a variable
streamReadVarSlice Read a horizontal slice of a variable
streamReadVarSliceF Read a horizontal slice of a variable
-------------------------------------------------------------
stream_record
-------------------------------------------------------------
......
streamOpenWrite stream
streamOpenRead stream
streamClose stream
streamInqFiletype stream
streamDefByteorder stream
streamInqByteorder stream
streamDefVlist stream
streamInqVlist stream
streamDefTimestep stream
streamInqTimestep stream
streamReadVar stream
streamReadVarSlice stream
streamWriteVar stream_write
streamWriteVarF stream_write
streamWriteVarSlice stream_write
streamWriteVarSliceF stream_write
streamDefRecord stream_record
streamInqRecord stream_record
streamWriteRecord stream_record
streamReadRecord stream_record
streamCopyRecord stream_record
vlistCreate vlist
vlistDestroy vlist
vlistCopy vlist
vlistDuplicate vlist
vlistCat vlist
vlistCopyFlag vlist
vlistNvars vlist
vlistNgrids vlist
vlistNzaxis vlist
vlistDefTaxis vlist
vlistInqTaxis vlist
vlistDefVar vlist_var
vlistInqVarGrid vlist_var
vlistInqVarZaxis vlist_var
vlistInqVarTime vlist_var
vlistDefVarCode vlist_var
vlistInqVarCode vlist_var
vlistDefVarName vlist_var
vlistInqVarName vlist_var
vlistDefVarLongname vlist_var
vlistInqVarLongname vlist_var
vlistDefVarStdname vlist_var
vlistInqVarStdname vlist_var
vlistDefVarUnits vlist_var
vlistInqVarUnits vlist_var
vlistDefVarDatatype vlist_var
vlistInqVarDatatype vlist_var
vlistDefVarMissval vlist_var
vlistInqVarMissval vlist_var
vlistInqNatts vlist_att
vlistInqAtt vlist_att
vlistDelAtt vlist_att
vlistDefAttInt vlist_att
vlistInqAttInt vlist_att
vlistDefAttFlt vlist_att
vlistInqAttFlt vlist_att
vlistDefAttTxt vlist_att
vlistInqAttTxt vlist_att
gridCreate grid
gridDestroy grid
gridDuplicate grid
gridIsCyclic grid
gridIsRotated grid
gridInqType grid
gridInqSize grid
gridDefXsize grid
gridInqXsize grid
gridDefYsize grid
gridInqYsize grid
gridDefNP grid
gridInqNP grid
gridDefXvals grid
gridInqXvals grid
gridDefYvals grid
gridInqYvals grid
gridDefXbounds grid
gridInqXbounds grid
gridDefYbounds grid
gridInqYbounds grid
gridDefXpole grid
gridInqXpole grid
gridDefXname grid
gridInqXname grid
gridDefXlongname grid
gridInqXlongname grid
gridDefXunits grid
gridInqXunits grid
gridDefYname grid
gridInqYname grid
gridDefYlongname grid
gridInqYlongname grid
gridDefYunits grid
gridInqYunits grid
gridDefLambert grid
gridInqLambert grid
gridDefNumber grid
gridInqNumber grid
gridDefPosition grid
gridInqPosition grid
gridDefReference grid
gridInqReference grid
gridDefUUID grid
gridInqUUID grid
zaxisCreate zaxis
zaxisDestroy zaxis
zaxisDuplicate zaxis
zaxisInqType zaxis
zaxisInqSize zaxis
zaxisDefLevels zaxis
zaxisInqLevels zaxis
zaxisInqLevel zaxis
zaxisDefLbounds zaxis
zaxisDefUbounds zaxis
zaxisInqLbounds zaxis
zaxisInqUbounds zaxis
zaxisDefVct zaxis
zaxisInqVctSize zaxis
zaxisInqVct zaxis
zaxisDefName zaxis
zaxisInqName zaxis
zaxisDefLongname zaxis
zaxisInqLongname zaxis
zaxisDefUnits zaxis
zaxisInqUnits zaxis
taxisCreate taxis
taxisDestroy taxis
taxisDuplicate taxis
taxisDefRdate taxis
taxisInqRdate taxis
taxisDefRtime taxis
taxisInqRtime taxis
taxisDefVdate taxis
taxisInqVdate taxis
taxisDefVtime taxis
taxisInqVtime taxis
taxisDefCalendar taxis
taxisInqCalendar taxis
streamOpenWrite stream
streamOpenRead stream
streamClose stream
streamInqFiletype stream
streamDefByteorder stream
streamInqByteorder stream
streamDefVlist stream
streamInqVlist stream
streamDefTimestep stream
streamInqTimestep stream
streamWriteVar stream_write
streamWriteVarF stream_write
streamWriteVarSlice stream_write
streamWriteVarSliceF stream_write
streamReadVar stream_read
streamReadVarF stream_read
streamReadVarSlice stream_read
streamReadVarSliceF stream_read
streamDefRecord stream_record
streamInqRecord stream_record
streamWriteRecord stream_record
streamReadRecord stream_record
streamCopyRecord stream_record
vlistCreate vlist
vlistDestroy vlist
vlistCopy vlist
vlistDuplicate vlist
vlistCat vlist
vlistCopyFlag vlist
vlistNvars vlist
vlistNgrids vlist
vlistNzaxis vlist
vlistDefTaxis vlist
vlistInqTaxis vlist
vlistDefVar vlist_var
vlistInqVarGrid vlist_var
vlistInqVarZaxis vlist_var
vlistInqVarTime vlist_var
vlistDefVarCode vlist_var
vlistInqVarCode vlist_var
vlistDefVarName vlist_var
vlistInqVarName vlist_var
vlistDefVarLongname vlist_var
vlistInqVarLongname vlist_var
vlistDefVarStdname vlist_var
vlistInqVarStdname vlist_var
vlistDefVarUnits vlist_var
vlistInqVarUnits vlist_var
vlistDefVarDatatype vlist_var
vlistInqVarDatatype vlist_var
vlistDefVarMissval vlist_var
vlistInqVarMissval vlist_var
vlistInqNatts vlist_att
vlistInqAtt vlist_att
vlistDelAtt vlist_att
vlistDefAttInt vlist_att
vlistInqAttInt vlist_att
vlistDefAttFlt vlist_att
vlistInqAttFlt vlist_att
vlistDefAttTxt vlist_att
vlistInqAttTxt vlist_att
gridCreate grid
gridDestroy grid
gridDuplicate grid
gridIsCyclic grid
gridIsRotated grid
gridInqType grid
gridInqSize grid
gridDefXsize grid
gridInqXsize grid
gridDefYsize grid
gridInqYsize grid
gridDefNP grid
gridInqNP grid
gridDefXvals grid
gridInqXvals grid
gridDefYvals grid
gridInqYvals grid
gridDefXbounds grid
gridInqXbounds grid
gridDefYbounds grid
gridInqYbounds grid
gridDefXpole grid
gridInqXpole grid
gridDefXname grid
gridInqXname grid
gridDefXlongname grid
gridInqXlongname grid
gridDefXunits grid
gridInqXunits grid
gridDefYname grid
gridInqYname grid
gridDefYlongname grid
gridInqYlongname grid
gridDefYunits grid
gridInqYunits grid
gridDefLambert grid
gridInqLambert grid
gridDefNumber grid
gridInqNumber grid
gridDefPosition grid
gridInqPosition grid
gridDefReference grid
gridInqReference grid
gridDefUUID grid
gridInqUUID grid
zaxisCreate zaxis
zaxisDestroy zaxis
zaxisDuplicate zaxis
zaxisInqType zaxis
zaxisInqSize zaxis
zaxisDefLevels zaxis
zaxisInqLevels zaxis
zaxisInqLevel zaxis
zaxisDefLbounds zaxis
zaxisDefUbounds zaxis
zaxisInqLbounds zaxis
zaxisInqUbounds zaxis
zaxisDefVct zaxis
zaxisInqVctSize zaxis
zaxisInqVct zaxis
zaxisDefName zaxis
zaxisInqName zaxis
zaxisDefLongname zaxis
zaxisInqLongname zaxis
zaxisDefUnits zaxis
zaxisInqUnits zaxis
taxisCreate taxis
taxisDestroy taxis
taxisDuplicate taxis
taxisDefRdate taxis
taxisInqRdate taxis
taxisDefRtime taxis
taxisInqRtime taxis
taxisDefVdate taxis
taxisInqVdate taxis
taxisDefVtime taxis
taxisInqVtime taxis
taxisDefCalendar taxis
taxisInqCalendar taxis
......@@ -765,6 +765,21 @@ Read a variable
\ifpdfoutput{}{(\ref{streamReadVar})}
\section*{\tt
\ifpdf
\hyperref[streamReadVarF]{streamReadVarF}
\else
streamReadVarF
\fi
}
\begin{verbatim}
void streamReadVar(int streamID, int varID, float *data, int *nmiss);
\end{verbatim}
Read a variable
\ifpdfoutput{}{(\ref{streamReadVarF})}
\section*{\tt
\ifpdf
\hyperref[streamReadVarSlice]{streamReadVarSlice}
......@@ -781,6 +796,22 @@ Read a horizontal slice of a variable
\ifpdfoutput{}{(\ref{streamReadVarSlice})}
\section*{\tt
\ifpdf
\hyperref[streamReadVarSliceF]{streamReadVarSliceF}
\else
streamReadVarSliceF
\fi
}
\begin{verbatim}
void streamReadVarSliceF(int streamID, int varID, int levelID, float *data,
int *nmiss);
\end{verbatim}
Read a horizontal slice of a variable
\ifpdfoutput{}{(\ref{streamReadVarSliceF})}
\section*{\tt
\ifpdf
\hyperref[streamWriteRecord]{streamWriteRecord}
......
......@@ -329,62 +329,3 @@ Timestep identifier.
{\tt streamInqTimestep} returns the number of records of the time step.
\subsection{Read a variable: {\tt streamReadVar}}
\index{streamReadVar}
\label{streamReadVar}
The function streamReadVar reads all the values of one time step of a variable
from an open dataset.
\subsubsection*{Usage}
\begin{verbatim}
void streamReadVar(int streamID, int varID, double *data, int *nmiss);
\end{verbatim}
\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt streamID\ }
\item[{\tt streamID}]
Stream ID, from a previous call to {\htmlref{\tt streamOpenRead}{streamOpenRead}}.
\item[{\tt varID}]
Variable identifier.
\item[{\tt data}]
Pointer to the location into which the data values are read.
The caller must allocate space for the returned values.
\item[{\tt nmiss}]
Number of missing values.
\end{deflist}
\end{minipage}
\subsection{Read a horizontal slice of a variable: {\tt streamReadVarSlice}}
\index{streamReadVarSlice}
\label{streamReadVarSlice}
The function streamReadVarSlice reads all the values of a horizontal slice of a variable
from an open dataset.
\subsubsection*{Usage}
\begin{verbatim}
void streamReadVarSlice(int streamID, int varID, int levelID, double *data,
int *nmiss);
\end{verbatim}
\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt streamID\ }
\item[{\tt streamID}]
Stream ID, from a previous call to {\htmlref{\tt streamOpenRead}{streamOpenRead}}.
\item[{\tt varID}]
Variable identifier.
\item[{\tt levelID}]
Level identifier.
\item[{\tt data}]
Pointer to the location into which the data values are read.
The caller must allocate space for the returned values.
\item[{\tt nmiss}]
Number of missing values.
\end{deflist}
\end{minipage}
......@@ -175,6 +175,7 @@
\input{dataset}
\input{c_stream}
\input{c_stream_write}
\input{c_stream_read}
\newpage
......
......@@ -172,6 +172,7 @@
\input{dataset}
\input{f_stream}
\input{f_stream_write}
\input{f_stream_read}
\newpage
......
......@@ -766,6 +766,22 @@ Read a variable
\ifpdfoutput{}{(\ref{streamReadVar})}
\section*{\tt
\ifpdf
\hyperref[streamReadVarF]{streamReadVarF}
\else
streamReadVarF
\fi
}
\begin{verbatim}
SUBROUTINE streamReadVar(INTEGER streamID, INTEGER varID, REAL*4 data,
INTEGER nmiss)
\end{verbatim}
Read a variable
\ifpdfoutput{}{(\ref{streamReadVarF})}
\section*{\tt
\ifpdf
\hyperref[streamReadVarSlice]{streamReadVarSlice}
......@@ -782,6 +798,22 @@ Read a horizontal slice of a variable
\ifpdfoutput{}{(\ref{streamReadVarSlice})}
\section*{\tt
\ifpdf
\hyperref[streamReadVarSliceF]{streamReadVarSliceF}
\else
streamReadVarSliceF
\fi
}
\begin{verbatim}
SUBROUTINE streamReadVarSliceF(INTEGER streamID, INTEGER varID, INTEGER levelID,
REAL*4 data, INTEGER nmiss)
\end{verbatim}
Read a horizontal slice of a variable
\ifpdfoutput{}{(\ref{streamReadVarSliceF})}
\section*{\tt
\ifpdf
\hyperref[streamWriteRecord]{streamWriteRecord}
......
......@@ -329,63 +329,3 @@ Timestep identifier.
{\tt streamInqTimestep} returns the number of records of the time step.
\subsection{Read a variable: {\tt streamReadVar}}
\index{streamReadVar}
\label{streamReadVar}
The function streamReadVar reads all the values of one time step of a variable
from an open dataset.
\subsubsection*{Usage}
\begin{verbatim}
SUBROUTINE streamReadVar(INTEGER streamID, INTEGER varID, REAL*8 data,
INTEGER nmiss)
\end{verbatim}
\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt streamID\ }
\item[{\tt streamID}]
Stream ID, from a previous call to {\htmlref{\tt streamOpenRead}{streamOpenRead}}.
\item[{\tt varID}]
Variable identifier.
\item[{\tt data}]
Pointer to the location into which the data values are read.
The caller must allocate space for the returned values.
\item[{\tt nmiss}]
Number of missing values.
\end{deflist}
\end{minipage}
\subsection{Read a horizontal slice of a variable: {\tt streamReadVarSlice}}
\index{streamReadVarSlice}
\label{streamReadVarSlice}
The function streamReadVarSlice reads all the values of a horizontal slice of a variable
from an open dataset.
\subsubsection*{Usage}
\begin{verbatim}
SUBROUTINE streamReadVarSlice(INTEGER streamID, INTEGER varID, INTEGER levelID,
REAL*8 data, INTEGER nmiss)
\end{verbatim}
\hspace*{4mm}\begin{minipage}[]{15cm}
\begin{deflist}{\tt streamID\ }
\item[{\tt streamID}]
Stream ID, from a previous call to {\htmlref{\tt streamOpenRead}{streamOpenRead}}.
\item[{\tt varID}]
Variable identifier.
\item[{\tt levelID}]
Level identifier.
\item[{\tt data}]
Pointer to the location into which the data values are read.
The caller must allocate space for the returned values.
\item[{\tt nmiss}]
Number of missing values.
\end{deflist}
\end{minipage}
......@@ -118,6 +118,7 @@ libcdi_la_SOURCES = \
zaxis.h \
stream.c \
stream_write.c \
stream_read.c \
swap.c \
iterator.c \
iterator.h \
......
......@@ -187,9 +187,10 @@ am__libcdi_la_SOURCES_DIST = basetime.c basetime.h binary.c binary.h \
table.h tablepar.h taxis.c taxis.h timebase.c timebase.h \
tsteps.c util.c varscan.c varscan.h version.c vlist.c vlist.h \
vlist_att.c vlist_att.h vlist_var.c vlist_var.h zaxis.c \
zaxis.h stream.c stream_write.c swap.c iterator.c iterator.h \
iterator_fallback.c iterator_fallback.h iterator_grib.c \
iterator_grib.h cfortran.h cdiFortran.c gribapi_utilities.c
zaxis.h stream.c stream_write.c stream_read.c swap.c \
iterator.c iterator.h iterator_fallback.c iterator_fallback.h \
iterator_grib.c iterator_grib.h cfortran.h cdiFortran.c \
gribapi_utilities.c
am__objects_1 = cdiFortran.lo
@USE_FC_TRUE@am__objects_2 = $(am__objects_1)
am__objects_3 = gribapi_utilities.lo
......@@ -206,8 +207,8 @@ am_libcdi_la_OBJECTS = basetime.lo binary.lo calendar.lo cdf.lo \
stream_var.lo cdf_write.lo subtype.lo table.lo taxis.lo \
timebase.lo tsteps.lo util.lo varscan.lo version.lo vlist.lo \
vlist_att.lo vlist_var.lo zaxis.lo stream.lo stream_write.lo \
swap.lo iterator.lo iterator_fallback.lo iterator_grib.lo \
$(am__objects_2) $(am__objects_4)
stream_read.lo swap.lo iterator.lo iterator_fallback.lo \
iterator_grib.lo $(am__objects_2) $(am__objects_4)
libcdi_la_OBJECTS = $(am_libcdi_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
......@@ -532,9 +533,10 @@ libcdi_la_SOURCES = basetime.c basetime.h binary.c binary.h calendar.c \
tablepar.h taxis.c taxis.h timebase.c timebase.h tsteps.c \
util.c varscan.c varscan.h version.c vlist.c vlist.h \
vlist_att.c vlist_att.h vlist_var.c vlist_var.h zaxis.c \
zaxis.h stream.c stream_write.c swap.c iterator.c iterator.h \
iterator_fallback.c iterator_fallback.h iterator_grib.c \
iterator_grib.h $(am__append_2) $(am__append_3)
zaxis.h stream.c stream_write.c stream_read.c swap.c \
iterator.c iterator.h iterator_fallback.c iterator_fallback.h \
iterator_grib.c iterator_grib.h $(am__append_2) \
$(am__append_3)
# cfortran.h is an optional part of libcdi
libcdi_la_USE_FC_extra_sources = \
......@@ -753,6 +755,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_gribapi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_history.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_ieg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_read.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_record.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_srv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_var.Plo@am__quote@
......
......@@ -122,6 +122,7 @@ files="basetime.c \
servicelib.c \
stream.c \
stream_write.c \
stream_read.c \
stream_cdf.c \
stream_cgribex.c \
stream_ext.c \
......
......@@ -7,8 +7,6 @@
#endif
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include "binary.h"
#include "cdi.h"
......@@ -25,15 +23,10 @@
#include "file.h"
#include "cgribex.h"
#include "gribapi.h"
#include "cdf.h"
#include "service.h"
#include "extra.h"
#include "ieg.h"
#include "vlist.h"
#include "serialize.h"
#include "resource_handle.h"
#include "resource_unpack.h"
#include "namespace.h"
......@@ -1331,264 +1324,6 @@ int streamInqTimestep(int streamID, int tsID)
return (nrecs);
}
/* the single image implementation */
static
void cdiStreamReadVar(int streamID, int varID, int memtype, void *data, int *nmiss)
{
if ( CDI_Debug ) Message("streamID = %d varID = %d", streamID, varID);
check_parg(data);
check_parg(nmiss);
stream_t *streamptr = stream_to_pointer(streamID);
stream_check_ptr(__func__, streamptr);
int filetype = streamptr->filetype;
*nmiss = 0;
switch (filetype)
{
#if defined (HAVE_LIBGRIB)
case FILETYPE_GRB:
case FILETYPE_GRB2:
{