Commit 727734ba authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

NetCDF4: set chunk size max to 1073741823 (bug fix).

parent 13b1d094
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
* using CGRIBEX library version 1.9.4 * using CGRIBEX library version 1.9.4
* Version 1.9.8 released * Version 1.9.8 released
2019-08-12 Uwe Schulzweida
* NetCDF4: set chunk size max to 1073741823 (bug fix)
2019-08-01 Uwe Schulzweida 2019-08-01 Uwe Schulzweida
* grbGetGridtype: return changed gridID (bug fix) [report: Florian Prill] * grbGetGridtype: return changed gridID (bug fix) [report: Florian Prill]
......
...@@ -521,10 +521,11 @@ int cdfDefineDimsAndChunks(const stream_t *streamptr, int varID, int xid, int yi ...@@ -521,10 +521,11 @@ int cdfDefineDimsAndChunks(const stream_t *streamptr, int varID, int xid, int yi
} }
int chunktype = vlistInqVarChunkType(vlistID, varID); int chunktype = vlistInqVarChunkType(vlistID, varID);
size_t chunk_size_max = 65536; const size_t chunk_size_max = 65536;
if ( chunktype != CDI_CHUNK_LINES && gridsize > INT32_MAX ) const size_t chunk_size_lim = 1073741823;
if ( chunktype != CDI_CHUNK_LINES && gridsize > chunk_size_lim )
{ {
if ( CDI_Debug ) fprintf(stderr, "gridsize > %d, changed chunktype to CDI_CHUNK_LINES!\n", INT32_MAX); if ( CDI_Debug ) fprintf(stderr, "gridsize > %zu, changed chunktype to CDI_CHUNK_LINES!\n", chunk_size_lim);
chunktype = CDI_CHUNK_LINES; chunktype = CDI_CHUNK_LINES;
} }
...@@ -551,7 +552,7 @@ int cdfDefineDimsAndChunks(const stream_t *streamptr, int varID, int xid, int yi ...@@ -551,7 +552,7 @@ int cdfDefineDimsAndChunks(const stream_t *streamptr, int varID, int xid, int yi
if ( chunktype == CDI_CHUNK_AUTO && yid == CDI_UNDEFID ) if ( chunktype == CDI_CHUNK_AUTO && yid == CDI_UNDEFID )
chunks[ndims] = (chunk_size_max > xsize) ? xsize : chunk_size_max; chunks[ndims] = (chunk_size_max > xsize) ? xsize : chunk_size_max;
else else
chunks[ndims] = (xsize > INT32_MAX) ? INT32_MAX : xsize; chunks[ndims] = (xsize > chunk_size_lim) ? chunk_size_lim : xsize;
dims[ndims] = xid; dims[ndims] = xid;
ndims++; ndims++;
} }
......
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