Commit d7ec10f3 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added call to cdiInitialize() in all streamOpen functions (bug fix)

parent e0e5be73
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
2012-07-13 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de> 2012-07-13 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added call to cdiInitialize() in all streamOpen functions (bug fix)
* added support for environment variable NC_CHUNKSIZEHINT [Feature #2142] * added support for environment variable NC_CHUNKSIZEHINT [Feature #2142]
2012-07-04 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de> 2012-07-04 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
......
...@@ -67,13 +67,11 @@ void cdf_create(const char *path, int cmode, int *ncidp) ...@@ -67,13 +67,11 @@ void cdf_create(const char *path, int cmode, int *ncidp)
if ( CDF_Debug || status != NC_NOERR ) if ( CDF_Debug || status != NC_NOERR )
Message("chunksizehint %d", chunksizehint); Message("chunksizehint %d", chunksizehint);
if ( status != NC_NOERR ) if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
Error("%s", nc_strerror(status));
status = nc_set_fill(*ncidp, NC_NOFILL, &oldfill); status = nc_set_fill(*ncidp, NC_NOFILL, &oldfill);
if ( status != NC_NOERR ) if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
Error("%s", nc_strerror(status));
} }
...@@ -102,17 +100,17 @@ int cdf_open(const char *path, int omode, int *ncidp) ...@@ -102,17 +100,17 @@ int cdf_open(const char *path, int omode, int *ncidp)
/* /*
if ( chunksizehint < ChunkSizeMin ) chunksizehint = ChunkSizeMin; if ( chunksizehint < ChunkSizeMin ) chunksizehint = ChunkSizeMin;
*/ */
if ( cdiNcChunksizehint != CDI_UNDEFID ) chunksizehint = cdiNcChunksizehint;
status = nc__open(path, omode, &chunksizehint, ncidp); status = nc__open(path, omode, &chunksizehint, ncidp);
if ( CDF_Debug ) if ( CDF_Debug ) Message("chunksizehint %d", chunksizehint);
Message("chunksizehint %d", chunksizehint);
} }
if ( CDF_Debug ) if ( CDF_Debug )
Message("ncid = %d mode = %d file = %s", *ncidp, omode, path); Message("ncid = %d mode = %d file = %s", *ncidp, omode, path);
if ( CDF_Debug && status != NC_NOERR ) if ( CDF_Debug && status != NC_NOERR ) Message("%s", nc_strerror(status));
Message("%s", nc_strerror(status));
return (status); return (status);
} }
......
...@@ -298,8 +298,7 @@ int get_fnames(const char *argument, char *fnames[], int max_fnames) ...@@ -298,8 +298,7 @@ int get_fnames(const char *argument, char *fnames[], int max_fnames)
strcat(command, pch); strcat(command, pch);
pfp = popen(command, "r"); pfp = popen(command, "r");
if ( pfp == NULL ) if ( pfp == NULL ) SysError("popen %s failed", command);
SysError("popen %s failed", command);
nfiles = 0; nfiles = 0;
while ( _readline_(pfp, line, MAX_LINE) ) while ( _readline_(pfp, line, MAX_LINE) )
...@@ -973,6 +972,8 @@ int streamOpenRead(const char *filenames) ...@@ -973,6 +972,8 @@ int streamOpenRead(const char *filenames)
const char *filename; const char *filename;
stream_t *streamptr = NULL; stream_t *streamptr = NULL;
cdiInitialize();
//num_fnames = get_fnames(filenames, fnames, MAX_FNAMES); //num_fnames = get_fnames(filenames, fnames, MAX_FNAMES);
if ( num_fnames == 0 ) if ( num_fnames == 0 )
...@@ -1015,6 +1016,8 @@ int streamOpenAppend(const char *filename) ...@@ -1015,6 +1016,8 @@ int streamOpenAppend(const char *filename)
int streamID; int streamID;
stream_t *streamptr; stream_t *streamptr;
cdiInitialize();
filetype = getFiletype(filename, &byteorder); filetype = getFiletype(filename, &byteorder);
if ( filetype < 0 ) return (filetype); if ( filetype < 0 ) return (filetype);
...@@ -1073,6 +1076,8 @@ if ( streamID < 0 ) handle_error(streamID); ...@@ -1073,6 +1076,8 @@ if ( streamID < 0 ) handle_error(streamID);
*/ */
int streamOpenWrite(const char *filename, int filetype) int streamOpenWrite(const char *filename, int filetype)
{ {
cdiInitialize();
return (streamOpen(filename, "w", filetype)); return (streamOpen(filename, "w", filetype));
} }
......
...@@ -191,7 +191,9 @@ void cdiInitialize(void) ...@@ -191,7 +191,9 @@ void cdiInitialize(void)
if ( CDI_Debug ) if ( CDI_Debug )
Message("Default calendar set to %s!", envString); Message("Default calendar set to %s!", envString);
} }
#if defined (HAVE_LIBCGRIBEX)
gribSetCalendar(cdiDefaultCalendar); gribSetCalendar(cdiDefaultCalendar);
#endif
envString = getenv("PARTAB_INTERN"); envString = getenv("PARTAB_INTERN");
if ( envString ) cdiPartabIntern = atoi(envString); if ( envString ) cdiPartabIntern = atoi(envString);
...@@ -581,7 +583,6 @@ void cdiCheckContents(int streamID) ...@@ -581,7 +583,6 @@ void cdiCheckContents(int streamID)
if ( zaxisInqType(zaxisID) == ZAXIS_GENERIC ) if ( zaxisInqType(zaxisID) == ZAXIS_GENERIC )
cdiCheckZaxis(zaxisID); cdiCheckZaxis(zaxisID);
} }
} }
......
...@@ -311,6 +311,7 @@ int streamInqDimgroupID(int streamID); ...@@ -311,6 +311,7 @@ int streamInqDimgroupID(int streamID);
int getByteswap(int byteorder); int getByteswap(int byteorder);
void cdiInitialize(void);
void stream_write_record(int streamID, int memtype, const void *data, int nmiss); void stream_write_record(int streamID, int memtype, const void *data, int nmiss);
......
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