Commit 3734ed2e authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

merged changes from branches/cdi_fileDrivenInput

parents e1b4fdc2 247f3a60
...@@ -238,12 +238,22 @@ src/gaussgrid.h -text ...@@ -238,12 +238,22 @@ src/gaussgrid.h -text
src/getline.c -text src/getline.c -text
src/gribapi.c -text src/gribapi.c -text
src/gribapi.h -text src/gribapi.h -text
src/gribapi_utilities.c -text
src/gribapi_utilities.h -text
src/grid.c -text src/grid.c -text
src/grid.h -text src/grid.h -text
src/ieg.h -text src/ieg.h -text
src/ieglib.c -text src/ieglib.c -text
src/input_file.c -text
src/input_file.h -text
src/institution.c -text src/institution.c -text
src/institution.h -text src/institution.h -text
src/iterator.c -text
src/iterator.h -text
src/iterator_fallback.c -text
src/iterator_fallback.h -text
src/iterator_grib.c -text
src/iterator_grib.h -text
src/make_cdilib -text src/make_cdilib -text
src/make_fint.c -text src/make_fint.c -text
src/mo_cdi.f90 -text src/mo_cdi.f90 -text
...@@ -278,6 +288,10 @@ src/pio_util.c -text ...@@ -278,6 +288,10 @@ src/pio_util.c -text
src/pio_util.h -text src/pio_util.h -text
src/pkgconfig/cdi.pc.in -text src/pkgconfig/cdi.pc.in -text
src/pkgconfig/cdipio.pc.in -text src/pkgconfig/cdipio.pc.in -text
src/proprietarySystemWorkarounds.c -text
src/proprietarySystemWorkarounds.h -text
src/referenceCounting.c -text
src/referenceCounting.h -text
src/resource_handle.c -text src/resource_handle.c -text
src/resource_handle.h -text src/resource_handle.h -text
src/resource_unpack.c -text src/resource_unpack.c -text
......
2015-03-26 Uwe Schulzweida
* merged changes from branches/cdi_fileDrivenInput
2015-03-26 Uwe Schulzweida 2015-03-26 Uwe Schulzweida
* Version 1.6.8 released * Version 1.6.8 released
......
...@@ -258,6 +258,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ...@@ -258,6 +258,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_EXTRA = @ENABLE_EXTRA@
ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_GRIB = @ENABLE_GRIB@
ENABLE_IEG = @ENABLE_IEG@ ENABLE_IEG = @ENABLE_IEG@
ENABLE_MPI = @ENABLE_MPI@
ENABLE_NC2 = @ENABLE_NC2@ ENABLE_NC2 = @ENABLE_NC2@
ENABLE_NC4 = @ENABLE_NC4@ ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NETCDF = @ENABLE_NETCDF@ ENABLE_NETCDF = @ENABLE_NETCDF@
......
...@@ -231,6 +231,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ...@@ -231,6 +231,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_EXTRA = @ENABLE_EXTRA@
ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_GRIB = @ENABLE_GRIB@
ENABLE_IEG = @ENABLE_IEG@ ENABLE_IEG = @ENABLE_IEG@
ENABLE_MPI = @ENABLE_MPI@
ENABLE_NC2 = @ENABLE_NC2@ ENABLE_NC2 = @ENABLE_NC2@
ENABLE_NC4 = @ENABLE_NC4@ ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NETCDF = @ENABLE_NETCDF@ ENABLE_NETCDF = @ENABLE_NETCDF@
......
...@@ -141,7 +141,7 @@ void version(void) ...@@ -141,7 +141,7 @@ void version(void)
static static
void usage(void) void usage(void)
{ {
char *name; const char *name;
int id; int id;
fprintf(stderr, "usage : %s [Option] [ifile] [ofile]\n", Progname); fprintf(stderr, "usage : %s [Option] [ifile] [ofile]\n", Progname);
......
...@@ -279,6 +279,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ...@@ -279,6 +279,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_EXTRA = @ENABLE_EXTRA@
ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_GRIB = @ENABLE_GRIB@
ENABLE_IEG = @ENABLE_IEG@ ENABLE_IEG = @ENABLE_IEG@
ENABLE_MPI = @ENABLE_MPI@
ENABLE_NC2 = @ENABLE_NC2@ ENABLE_NC2 = @ENABLE_NC2@
ENABLE_NC4 = @ENABLE_NC4@ ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NETCDF = @ENABLE_NETCDF@ ENABLE_NETCDF = @ENABLE_NETCDF@
......
...@@ -11,7 +11,7 @@ PROGRAM CDIREADF2003 ...@@ -11,7 +11,7 @@ PROGRAM CDIREADF2003
DOUBLE PRECISION, ALLOCATABLE :: field(:,:) DOUBLE PRECISION, ALLOCATABLE :: field(:,:)
CHARACTER(kind=c_char), POINTER, DIMENSION(:) :: & CHARACTER(kind=c_char), POINTER, DIMENSION(:) :: &
msg, cdi_version msg, cdi_version
CHARACTER(kind=c_char), DIMENSION(cdi_max_name + 1) :: & CHARACTER(kind=c_char, LEN = cdi_max_name + 1) :: &
name, longname, units name, longname, units
INTEGER :: name_c_len, longname_c_len, units_c_len INTEGER :: name_c_len, longname_c_len, units_c_len
......
...@@ -273,6 +273,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ...@@ -273,6 +273,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_EXTRA = @ENABLE_EXTRA@
ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_GRIB = @ENABLE_GRIB@
ENABLE_IEG = @ENABLE_IEG@ ENABLE_IEG = @ENABLE_IEG@
ENABLE_MPI = @ENABLE_MPI@
ENABLE_NC2 = @ENABLE_NC2@ ENABLE_NC2 = @ENABLE_NC2@
ENABLE_NC4 = @ENABLE_NC4@ ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NETCDF = @ENABLE_NETCDF@ ENABLE_NETCDF = @ENABLE_NETCDF@
......
...@@ -257,6 +257,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ...@@ -257,6 +257,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_EXTRA = @ENABLE_EXTRA@
ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_GRIB = @ENABLE_GRIB@
ENABLE_IEG = @ENABLE_IEG@ ENABLE_IEG = @ENABLE_IEG@
ENABLE_MPI = @ENABLE_MPI@
ENABLE_NC2 = @ENABLE_NC2@ ENABLE_NC2 = @ENABLE_NC2@
ENABLE_NC4 = @ENABLE_NC4@ ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NETCDF = @ENABLE_NETCDF@ ENABLE_NETCDF = @ENABLE_NETCDF@
......
...@@ -40,7 +40,8 @@ class CdiTaxis { ...@@ -40,7 +40,8 @@ class CdiTaxis {
int ntsteps, unit; int ntsteps, unit;
int rdate, rtime, vdate, vtime; int rdate, rtime, vdate, vtime;
int type, calendar, hasBounds; int type, calendar, hasBounds;
char name[CHARSIZE], *unitname; char name[CHARSIZE];
const char *unitname;
}; };
class CdiZaxis { class CdiZaxis {
......
This diff is collapsed.
...@@ -51,18 +51,32 @@ libcdi_la_SOURCES = \ ...@@ -51,18 +51,32 @@ libcdi_la_SOURCES = \
gaussgrid.h \ gaussgrid.h \
gribapi.c \ gribapi.c \
gribapi.h \ gribapi.h \
gribapi_utilities.c \
gribapi_utilities.h \
grid.c \ grid.c \
grid.h \ grid.h \
ieg.h \ ieg.h \
ieglib.c \ ieglib.c \
input_file.c \
input_file.h \
institution.c \ institution.c \
institution.h \ institution.h \
iterator.c \
iterator.h \
iterator_fallback.c \
iterator_fallback.h \
iterator_grib.c \
iterator_grib.h \
model.c \ model.c \
model.h \ model.h \
namespace.c \ namespace.c \
namespace.h \ namespace.h \
serialize.h \ serialize.h \
serialize.c \ serialize.c \
proprietarySystemWorkarounds.c \
proprietarySystemWorkarounds.h \
referenceCounting.c \
referenceCounting.h \
resource_handle.c\ resource_handle.c\
resource_handle.h\ resource_handle.h\
service.h \ service.h \
......
...@@ -159,8 +159,11 @@ libcdi_la_DEPENDENCIES = $(am__DEPENDENCIES_1) ...@@ -159,8 +159,11 @@ libcdi_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_libcdi_la_OBJECTS = basetime.lo binary.lo calendar.lo cdf.lo \ am_libcdi_la_OBJECTS = basetime.lo binary.lo calendar.lo cdf.lo \
cdf_int.lo cdi_error.lo cdi_util.lo cdiFortran.lo \ cdf_int.lo cdi_error.lo cdi_util.lo cdiFortran.lo \
cgribexlib.lo dmemory.lo cksum.lo cdi_cksum.lo error.lo \ cgribexlib.lo dmemory.lo cksum.lo cdi_cksum.lo error.lo \
extralib.lo file.lo gaussgrid.lo gribapi.lo grid.lo ieglib.lo \ extralib.lo file.lo gaussgrid.lo gribapi.lo \
institution.lo model.lo namespace.lo serialize.lo \ gribapi_utilities.lo grid.lo ieglib.lo input_file.lo \
institution.lo iterator.lo iterator_fallback.lo \
iterator_grib.lo model.lo namespace.lo serialize.lo \
proprietarySystemWorkarounds.lo referenceCounting.lo \
resource_handle.lo servicelib.lo stream_cdf.lo \ resource_handle.lo servicelib.lo stream_cdf.lo \
stream_cgribex.lo stream_ext.lo stream_grb.lo \ stream_cgribex.lo stream_ext.lo stream_grb.lo \
stream_gribapi.lo stream_history.lo stream_ieg.lo \ stream_gribapi.lo stream_history.lo stream_ieg.lo \
...@@ -290,6 +293,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ...@@ -290,6 +293,7 @@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@
ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_EXTRA = @ENABLE_EXTRA@
ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_GRIB = @ENABLE_GRIB@
ENABLE_IEG = @ENABLE_IEG@ ENABLE_IEG = @ENABLE_IEG@
ENABLE_MPI = @ENABLE_MPI@
ENABLE_NC2 = @ENABLE_NC2@ ENABLE_NC2 = @ENABLE_NC2@
ENABLE_NC4 = @ENABLE_NC4@ ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NETCDF = @ENABLE_NETCDF@ ENABLE_NETCDF = @ENABLE_NETCDF@
...@@ -494,18 +498,32 @@ libcdi_la_SOURCES = \ ...@@ -494,18 +498,32 @@ libcdi_la_SOURCES = \
gaussgrid.h \ gaussgrid.h \
gribapi.c \ gribapi.c \
gribapi.h \ gribapi.h \
gribapi_utilities.c \
gribapi_utilities.h \
grid.c \ grid.c \
grid.h \ grid.h \
ieg.h \ ieg.h \
ieglib.c \ ieglib.c \
input_file.c \
input_file.h \
institution.c \ institution.c \
institution.h \ institution.h \
iterator.c \
iterator.h \
iterator_fallback.c \
iterator_fallback.h \
iterator_grib.c \
iterator_grib.h \
model.c \ model.c \
model.h \ model.h \
namespace.c \ namespace.c \
namespace.h \ namespace.h \
serialize.h \ serialize.h \
serialize.c \ serialize.c \
proprietarySystemWorkarounds.c \
proprietarySystemWorkarounds.h \
referenceCounting.c \
referenceCounting.h \
resource_handle.c\ resource_handle.c\
resource_handle.h\ resource_handle.h\
service.h \ service.h \
...@@ -734,9 +752,14 @@ distclean-compile: ...@@ -734,9 +752,14 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gaussgrid.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gaussgrid.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gribapi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gribapi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gribapi_utilities.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grid.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grid.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ieglib.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ieglib.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input_file.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/institution.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/institution.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterator.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterator_fallback.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterator_grib.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/model.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/namespace.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/namespace.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio.Plo@am__quote@
...@@ -754,6 +777,8 @@ distclean-compile: ...@@ -754,6 +777,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_serialize.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_serialize.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_server.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_server.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_util.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proprietarySystemWorkarounds.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/referenceCounting.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_handle.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_handle.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_unpack.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_unpack.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/serialize.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/serialize.Plo@am__quote@
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#if defined (HAVE_LIBNETCDF) #if defined (HAVE_LIBNETCDF)
#include <stdlib.h> #include <stdlib.h>
#include "netcdf.h" #include <netcdf.h>
void cdf_create (const char *path, int cmode, int *idp); void cdf_create (const char *path, int cmode, int *idp);
int cdf_open (const char *path, int omode, int *idp); int cdf_open (const char *path, int omode, int *idp);
......
...@@ -31,6 +31,7 @@ extern "C" { ...@@ -31,6 +31,7 @@ extern "C" {
/* Error identifier */ /* Error identifier */
#define CDI_NOERR 0 /* No Error */ #define CDI_NOERR 0 /* No Error */
#define CDI_EEOF -1 /* The end of file was encountered */
#define CDI_ESYSTEM -10 /* Operating system error */ #define CDI_ESYSTEM -10 /* Operating system error */
#define CDI_EINVAL -20 /* Invalid argument */ #define CDI_EINVAL -20 /* Invalid argument */
#define CDI_EUFTYPE -21 /* Unsupported file type */ #define CDI_EUFTYPE -21 /* Unsupported file type */
...@@ -222,6 +223,17 @@ extern "C" { ...@@ -222,6 +223,17 @@ extern "C" {
/* number of unsigned char needed to store UUID */ /* number of unsigned char needed to store UUID */
#define CDI_UUID_SIZE 16 #define CDI_UUID_SIZE 16
/* Structs that are used to return data to the user */
typedef struct CdiParam { int discipline; int category; int number; } CdiParam;
/* Opaque types */
typedef struct CdiIterator CdiIterator;
typedef struct CdiGribIterator CdiGribIterator;
/* CDI control routines */ /* CDI control routines */
void cdiReset(void); void cdiReset(void);
...@@ -319,8 +331,9 @@ int streamInqTimestep(int streamID, int tsID); ...@@ -319,8 +331,9 @@ int streamInqTimestep(int streamID, int tsID);
/* PIO: query currently set timestep id */ /* PIO: query currently set timestep id */
int streamInqCurTimestepID(int streamID); int streamInqCurTimestepID(int streamID);
char *streamFilename(int streamID); const char* streamFilename(int streamID);
const char *streamFilesuffix(int filetype); const char* streamFilesuffix(int filetype);
off_t streamNvals(int streamID); off_t streamNvals(int streamID);
int streamInqNvars ( int streamID ); int streamInqNvars ( int streamID );
...@@ -343,8 +356,7 @@ void streamWriteVarSliceF(int streamID, int varID, int levelID, const float * ...@@ -343,8 +356,7 @@ void streamWriteVarSliceF(int streamID, int varID, int levelID, const float *
void streamReadVarSlice(int streamID, int varID, int levelID, double *data_vec, int *nmiss); void streamReadVarSlice(int streamID, int varID, int levelID, double *data_vec, int *nmiss);
void streamReadVarSliceF(int streamID, int varID, int levelID, float *data_vec, int *nmiss); void streamReadVarSliceF(int streamID, int varID, int levelID, float *data_vec, int *nmiss);
void streamWriteVarChunk(int streamID, int varID, const int rect[][2], void streamWriteVarChunk(int streamID, int varID, const int rect[3][2], const double *data_vec, int nmiss);
const double *data_vec, int nmiss);
/* STREAM record I/O routines */ /* STREAM record I/O routines */
...@@ -358,6 +370,62 @@ void streamCopyRecord(int streamIDdest, int streamIDsrc); ...@@ -358,6 +370,62 @@ void streamCopyRecord(int streamIDdest, int streamIDsrc);
void streamInqGRIBinfo(int streamID, int *intnum, float *fltnum, off_t *bignum); void streamInqGRIBinfo(int streamID, int *intnum, float *fltnum, off_t *bignum);
/* File driven I/O (may yield better performance than using the streamXXX functions) */
//Creation & Destruction
CdiIterator* cdiIterator_new(const char* path); //Requires a subsequent call to cdiIteratorNextField() to point the iterator at the first field.
CdiIterator* cdiIterator_clone(CdiIterator* me);
char* cdiIterator_serialize(CdiIterator* me); //Returns a malloc'ed string.
CdiIterator* cdiIterator_deserialize(const char* description); //description is a string that was returned by cdiIteratorSerialize(). Returns a copy of the original iterator.
void cdiIterator_print(CdiIterator* me, FILE* stream);
void cdiIterator_delete(CdiIterator* me);
//Advancing an iterator
int cdiIterator_nextField(CdiIterator* me); //Points the iterator at the next field, returns CDI_EEOF if there are no more fields in the file.
//Introspecting metadata
//All outXXX arguments to these functions may be NULL.
char* cdiIterator_inqStartTime(CdiIterator* me); //Returns the (start) time as an ISO-8601 coded string. The caller is responsible to free() the returned string.
char* cdiIterator_inqEndTime(CdiIterator* me); //Returns the end time of an integration period as an ISO-8601 coded string, or NULL if there is no end time. The caller is responsible to free() the returned string.
char* cdiIterator_inqVTime(CdiIterator* me); //Returns the validity date as an ISO-8601 coded string. The caller is responsible to free() the returned string.
int cdiIterator_inqLevelType(CdiIterator* me, int levelSelector, char** outName, char** outLongName, char** outStdName, char** outUnit); //callers are responsible to free() strings that they request
int cdiIterator_inqLevel(CdiIterator* me, int levelSelector, double* outValue1, double* outValue2); //outValue2 is only written to if the level is a hybrid level
int cdiIterator_inqLevelUuid(CdiIterator* me, int* outVgridNumber, int* outLevelCount, unsigned char (*outUuid)[CDI_UUID_SIZE]); //outUuid must point to a buffer of 16 bytes, returns an error code if no generalized zaxis is used.
CdiParam cdiIterator_inqParam(CdiIterator* me);
int cdiIterator_inqDatatype(CdiIterator* me);
int cdiIterator_inqTsteptype(CdiIterator* me);
char* cdiIterator_inqVariableName(CdiIterator* me); //The caller is responsible to free() the returned buffer.
int cdiIterator_inqGridId(CdiIterator* me); //The returned id is only valid until the next call to cdiIteratorNextField().
//Reading data
void cdiIterator_readField(CdiIterator* me, double* data_vec, size_t* nmiss);
void cdiIterator_readFieldF(CdiIterator* me, float* data_vec, size_t* nmiss);
//TODO[NH]: Add functions to read partial fields.
//Direct access to grib fields
CdiGribIterator* cdiGribIterator_clone(CdiIterator* me); //Returns NULL if the associated file is not a GRIB file.
void cdiGribIterator_delete(CdiGribIterator* me);
//Callthroughs to GRIB-API
int cdiGribIterator_getLong(CdiGribIterator* me, const char* key, long* value); //Same semantics as grib_get_long().
int cdiGribIterator_getDouble(CdiGribIterator* me, const char* key, double* value); //Same semantics as grib_get_double().
int cdiGribIterator_getLength(CdiGribIterator* me, const char* key, size_t* value); //Same semantics as grib_get_length().
int cdiGribIterator_getString(CdiGribIterator* me, const char* key, char* value, size_t* length); //Same semantics as grib_get_string().
int cdiGribIterator_getSize(CdiGribIterator* me, const char* key, size_t* value); //Same semantics as grib_get_size().
int cdiGribIterator_getLongArray(CdiGribIterator* me, const char* key, long* value, size_t* array_size); //Same semantics as grib_get_long_array().
int cdiGribIterator_getDoubleArray(CdiGribIterator* me, const char* key, double* value, size_t* array_size); //Same semantics as grib_get_double_array().
//Convenience functions for accessing GRIB-API keys
int cdiGribIterator_inqEdition(CdiGribIterator* me);
long cdiGribIterator_inqLongValue(CdiGribIterator* me, const char* key); //Aborts on failure to fetch the given key.
long cdiGribIterator_inqLongDefaultValue(CdiGribIterator* me, const char* key, long defaultValue); //Returns the default value if the given key is not present.
double cdiGribIterator_inqDoubleValue(CdiGribIterator* me, const char* key); //Aborts on failure to fetch the given key.
double cdiGribIterator_inqDoubleDefaultValue(CdiGribIterator* me, const char* key, double defaultValue); //Returns the default value if the given key is not present.
char* cdiGribIterator_inqStringValue(CdiGribIterator* me, const char* key); //Returns a malloc'ed string.
/* VLIST routines */ /* VLIST routines */
/* vlistCreate: Create a variable list */ /* vlistCreate: Create a variable list */
...@@ -486,6 +554,9 @@ void vlistDefVarName(int vlistID, int varID, const char *name); ...@@ -486,6 +554,9 @@ void vlistDefVarName(int vlistID, int varID, const char *name);
/* vlistInqVarName: Get the name of a Variable */ /* vlistInqVarName: Get the name of a Variable */
void vlistInqVarName(int vlistID, int varID, char *name); void vlistInqVarName(int vlistID, int varID, char *name);
/* vlistCopyVarName: Safe and convenient version of vlistInqVarName */
char* vlistCopyVarName(int vlistId, int varId);
/* vlistDefVarStdname: Define the standard name of a Variable */ /* vlistDefVarStdname: Define the standard name of a Variable */
void vlistDefVarStdname(int vlistID, int varID, const char *stdname); void vlistDefVarStdname(int vlistID, int varID, const char *stdname);
...@@ -787,7 +858,7 @@ void gridDefYbounds(int gridID, const double *ybounds_vec); ...@@ -787,7 +858,7 @@ void gridDefYbounds(int gridID, const double *ybounds_vec);
/* gridInqYbounds: Get the bounds of a Y-axis */ /* gridInqYbounds: Get the bounds of a Y-axis */
int gridInqYbounds(int gridID, double *ybounds_vec); int gridInqYbounds(int gridID, double *ybounds_vec);
void gridDefRowlon(int gridID, int nrowlon, const int rowlon_vec[]); void gridDefRowlon(int gridID, int nrowlon, const int* rowlon_vec);
void gridInqRowlon(int gridID, int *rowlon_vec); void gridInqRowlon(int gridID, int *rowlon_vec);
void gridChangeType(int gridID, int gridtype); void gridChangeType(int gridID, int gridtype);
...@@ -975,7 +1046,7 @@ int taxisInqType(int taxisID); ...@@ -975,7 +1046,7 @@ int taxisInqType(int taxisID);
int taxisInqNumavg(int taxisID); int taxisInqNumavg(int taxisID);
char *tunitNamePtr(int tunitID); const char* tunitNamePtr(int tunitID);
/* Institut routines */ /* Institut routines */
...@@ -986,7 +1057,7 @@ int institutInqNumber(void); ...@@ -986,7 +1057,7 @@ int institutInqNumber(void);
int institutInqCenter(int instID); int institutInqCenter(int instID);
int institutInqSubcenter(int instID); int institutInqSubcenter(int instID);
const char *institutInqNamePtr(int instID); const char *institutInqNamePtr(int instID);
char *institutInqLongnamePtr(int instID); const char* institutInqLongnamePtr(int instID);
/* Model routines */ /* Model routines */
...@@ -1004,7 +1075,7 @@ void tableWrite(const char *filename, int tableID); ...@@ -1004,7 +1075,7 @@ void tableWrite(const char *filename, int tableID);
int tableRead(const char *tablefile); int tableRead(const char *tablefile);
int tableDef(int modelID, int tablenum, const char *tablename); int tableDef(int modelID, int tablenum, const char *tablename);
char *tableInqNamePtr(int tableID); const char* tableInqNamePtr(int tableID);
void tableDefEntry(int tableID, int code, const char *name, const char *longname, const char *units); void tableDefEntry(int tableID, int code, const char *name, const char *longname, const char *units);
int tableInq(int modelID, int tablenum, const char *tablename); int tableInq(int modelID, int tablenum, const char *tablename);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
! !
! Author: ! Author:
! ------- ! -------
! Uwe Schulzweida, MPI-MET, Hamburg, February 2015 ! Uwe Schulzweida, MPI-MET, Hamburg, March 2015
! !
INTEGER CDI_MAX_NAME INTEGER CDI_MAX_NAME
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
! !
INTEGER CDI_NOERR INTEGER CDI_NOERR
PARAMETER (CDI_NOERR = 0) PARAMETER (CDI_NOERR = 0)
INTEGER CDI_EEOF
PARAMETER (CDI_EEOF = -1)
INTEGER CDI_ESYSTEM INTEGER CDI_ESYSTEM
PARAMETER (CDI_ESYSTEM = -10) PARAMETER (CDI_ESYSTEM = -10)
INTEGER CDI_EINVAL INTEGER CDI_EINVAL
...@@ -377,6 +379,12 @@ ...@@ -377,6 +379,12 @@
INTEGER CDI_UUID_SIZE INTEGER CDI_UUID_SIZE
PARAMETER (CDI_UUID_SIZE = 16) PARAMETER (CDI_UUID_SIZE = 16)
! !
! Structs that are used to return data to the user
!
!
! Opaque types
!
!
! CDI control routines ! CDI control routines
! !
! cdiReset ! cdiReset
...@@ -570,14 +578,6 @@ ...@@ -570,14 +578,6 @@
! (INTEGER streamID) ! (INTEGER streamID)
EXTERNAL streamInqCurTimestepID EXTERNAL streamInqCurTimestepID
CHARACTER(80) streamFilename
! (INTEGER streamID)
EXTERNAL streamFilename
CHARACTER(80) streamFilesuffix
! (INTEGER filetype)
EXTERNAL streamFilesuffix
INTEGER streamInqNvars INTEGER streamInqNvars
! (INTEGER streamID) ! (INTEGER streamID)
EXTERNAL streamInqNvars EXTERNAL streamInqNvars
...@@ -691,6 +691,9 @@ ...@@ -691,6 +691,9 @@
! INTEGER streamIDsrc) ! INTEGER streamIDsrc)
EXTERNAL streamCopyRecord EXTERNAL streamCopyRecord