|
diff -h -r -x '*.o' -x '*~' cdo-1.5.8-orig//libcdi/src/stream_cdf.c cdo-1.5.8/libcdi/src/stream_cdf.c
|
|
92a93
|
|
> int chunksize[4]; //chunking information
|
|
2683a2685,2686
|
|
> char* chunkAlgo = 0;
|
|
> int xd,yd;
|
|
2751a2755
|
|
> xd = yd = -1;
|
|
2762a2767
|
|
> yd = ndims;
|
|
2768a2774
|
|
> xd = ndims;
|
|
2775,2778d2780
|
|
< if ( CDI_Debug )
|
|
< fprintf(stderr, "chunks %d %d %d %d\n",
|
|
< (int)chunks[0], (int)chunks[1], (int)chunks[2], (int)chunks[3]);
|
|
<
|
|
2800c2802
|
|
< while ( checkname )
|
|
---
|
|
> while ( checkname )
|
|
2870c2872,2873
|
|
< if ( lchunk && (streamptr->filetype == FILETYPE_NC4 || streamptr->filetype == FILETYPE_NC4C) )
|
|
---
|
|
> if ( lchunk &&
|
|
> (streamptr->filetype == FILETYPE_NC4 || streamptr->filetype == FILETYPE_NC4C) )
|
|
2872,2873c2875,2924
|
|
< if ( (retval = nc_def_var_chunking(fileID, ncvarid, 0, chunks)) )
|
|
< Error("nc_def_var_chunking failed, status = %d", retval);
|
|
---
|
|
> chunkAlgo = getenv("CDI_CHUNK_ALGO");
|
|
> if ( CDI_Debug )
|
|
> printf("chunkAlgo: %s\n",chunkAlgo);
|
|
> if ( !chunkAlgo || ( strcmp("", chunkAlgo) == 0 )
|
|
> || ( strcmp("default", chunkAlgo) == 0 ) )
|
|
> {
|
|
> if ( xd != -1 ) chunks[xd] = xsize;
|
|
> if ( yd != -1 ) chunks[yd] = ysize;
|
|
> }
|
|
> else if ( strcmp("auto", chunkAlgo) == 0 )
|
|
> {
|
|
> // noop, will not call nc_def_var_chunking() below
|
|
> }
|
|
> else if ( strcmp("lines", chunkAlgo) == 0 )
|
|
> {
|
|
> if ( xd != -1 ) chunks[xd] = xsize;
|
|
> if ( yd != -1 ) chunks[yd] = 1;
|
|
> }
|
|
> else
|
|
> {
|
|
> // TODO parse widthxheight
|
|
> int xchunk,ychunk;
|
|
> xchunk=ychunk=-1;
|
|
> char * pch = strstr (chunkAlgo,"x");
|
|
> if ( pch != 0 )
|
|
> {
|
|
> xchunk = atoi(chunkAlgo);
|
|
> ychunk = atoi(pch+1);
|
|
> printf("xchunk: %d ychunk: %d\n",xchunk,ychunk);
|
|
> }
|
|
> if ( xchunk>0 && ychunk>0 )
|
|
> {
|
|
> if ( xd != -1 ) chunks[xd] = xchunk;
|
|
> if ( yd != -1 ) chunks[yd] = ychunk;
|
|
> }
|
|
> else
|
|
> {
|
|
> fprintf(stderr, "ERROR parsing CDI_CHUNK_ALGO=%s\n",chunkAlgo);
|
|
> chunkAlgo = 0;
|
|
> }
|
|
> }
|
|
> if ( chunkAlgo!=0 && strcmp("auto", chunkAlgo) != 0 )
|
|
> {
|
|
> // TODO error checking - make sure that chunks<=size
|
|
> if ( CDI_Debug )
|
|
> fprintf(stderr, "chunks: %d %d %d %d\n",
|
|
> (int)chunks[0], (int)chunks[1], (int)chunks[2], (int)chunks[3]);
|
|
> if ( (retval = nc_def_var_chunking(fileID, ncvarid, 0, chunks)) )
|
|
> Error("nc_def_var_chunking failed, status = %d", retval);
|
|
> }
|
|
4416a4468,4476
|
|
>
|
|
> size_t chunks[4];
|
|
> if ( nc_inq_var_chunking(ncid, ncvarid, 0, chunks ) == NC_NOERR )
|
|
> {
|
|
> for ( int i=0; i<=4; i++ )
|
|
> ncvars[ncvarid].chunksize[i] = (int)chunks[i];
|
|
> for ( int i=ncvars[ncvarid].ndims; i<=4; i++ )
|
|
> ncvars[ncvarid].chunksize[i] = 0;
|
|
> }
|
|
5964a6025
|
|
> vlistDefVarChunksize(vlistID, varID, ncvars[ncvarid].chunksize);
|
|
diff -h -r -x '*.o' -x '*~' cdo-1.5.8-orig//libcdi/src/vlist.h cdo-1.5.8/libcdi/src/vlist.h
|
|
102a103
|
|
> int chunksize[4]; //chunking information
|
|
diff -h -r -x '*.o' -x '*~' cdo-1.5.8-orig//libcdi/src/vlist_var.c cdo-1.5.8/libcdi/src/vlist_var.c
|
|
55a56,57
|
|
> for ( int i=0; i<=4; i++ )
|
|
> vlistptr->vars[varID].chunksize[i] = 0;
|
|
1687a1690,1718
|
|
> void vlistDefVarChunksize(int vlistID, int varID, int* chunksize)
|
|
> {
|
|
> vlist_t *vlistptr;
|
|
>
|
|
> if ( reshGetStatus ( vlistID, &vlist_ops ) == CLOSED )
|
|
> {
|
|
> xwarning("%s", "Operation not executed.");
|
|
> return;
|
|
> }
|
|
>
|
|
> vlistptr = vlist_to_pointer(vlistID);
|
|
>
|
|
> vlistCheckVarID(__func__, vlistID, varID);
|
|
>
|
|
> for ( int i=0; i<=4; i++ )
|
|
> vlistptr->vars[varID].chunksize[i] = chunksize[i];
|
|
> }
|
|
>
|
|
> void vlistInqVarChunksize(int vlistID, int varID, int* chunksize)
|
|
> {
|
|
> vlist_t *vlistptr;
|
|
>
|
|
> vlistptr = vlist_to_pointer(vlistID);
|
|
>
|
|
> vlistCheckVarID(__func__, vlistID, varID);
|
|
>
|
|
> for ( int i=0; i<=4; i++ )
|
|
> chunksize[i] = vlistptr->vars[varID].chunksize[i];
|
|
> }
|
|
diff -h -r -x '*.o' -x '*~' cdo-1.5.8-orig//src/printinfo.h cdo-1.5.8/src/printinfo.h
|
|
383a384,412
|
|
>
|
|
> void printChunking(int streamID, int vlistID, int varID)
|
|
> {
|
|
> int filetype;
|
|
> filetype = streamInqFiletype(streamID);
|
|
>
|
|
> if ( filetype == FILETYPE_NC4 || filetype == FILETYPE_NC4C )
|
|
> {
|
|
> int ndims, nzaxis, taxisID, ntsteps;
|
|
> int chunksize[4] = {0,0,0,0};
|
|
>
|
|
> vlistInqVarChunksize(vlistID, varID, chunksize);
|
|
>
|
|
> // note: zaxis =1 even if there is no zaxis
|
|
> ndims = 2 + vlistNzaxis(vlistID) + vlistNtsteps(vlistID);
|
|
> /* printf(" ndims=%d nz=%d nt=%d ",ndims,vlistNzaxis(vlistID),vlistNtsteps(vlistID)); */
|
|
> if ( chunksize[0] != 0 )
|
|
> {
|
|
> printf("chunks: ");
|
|
> for( int i=ndims-1; i>0; i-- )
|
|
> {
|
|
> if ( chunksize[i] != 0 )
|
|
> printf("%d X ",chunksize[i]);
|
|
> }
|
|
> if ( chunksize[0] != 0 )
|
|
> printf("%d",chunksize[0]);
|
|
> }
|
|
> }
|
|
> }
|
|
diff -h -r -x '*.o' -x '*~' cdo-1.5.8-orig//src/Sinfo.c cdo-1.5.8/src/Sinfo.c
|
|
92c92
|
|
< "%6d : Institut Source Ttype Einfo Levels Num Gridsize Num Dtype : Parameter name\n", -(indf+1));
|
|
---
|
|
> "%6d : Institut Source Ttype Einfo Levels Num Gridsize Num Dtype : Parameter name : Extra\n", -(indf+1));
|
|
95c95
|
|
< "%6d : Institut Source Ttype Einfo Levels Num Gridsize Num Dtype : Table Code\n", -(indf+1));
|
|
---
|
|
> "%6d : Institut Source Ttype Einfo Levels Num Gridsize Num Dtype : Table Code : Extra\n", -(indf+1));
|
|
98c98
|
|
< "%6d : Institut Source Ttype Einfo Levels Num Gridsize Num Dtype : Parameter ID\n", -(indf+1));
|
|
---
|
|
> "%6d : Institut Source Ttype Einfo Levels Num Gridsize Num Dtype : Parameter ID : Extra\n", -(indf+1));
|
|
104c104
|
|
< "%6d : Institut Source Ttype Levels Num Gridsize Num Dtype : Parameter name\n", -(indf+1));
|
|
---
|
|
> "%6d : Institut Source Ttype Levels Num Gridsize Num Dtype : Parameter name : Extra\n", -(indf+1));
|
|
107c107
|
|
< "%6d : Institut Source Ttype Levels Num Gridsize Num Dtype : Table Code\n", -(indf+1));
|
|
---
|
|
> "%6d : Institut Source Ttype Levels Num Gridsize Num Dtype : Table Code : Extra\n", -(indf+1));
|
|
110c110
|
|
< "%6d : Institut Source Ttype Levels Num Gridsize Num Dtype : Parameter ID\n", -(indf+1));
|
|
---
|
|
> "%6d : Institut Source Ttype Levels Num Gridsize Num Dtype : Parameter ID : Extra\n", -(indf+1));
|
|
189c189
|
|
< fprintf(stdout, "%-11s", varname);
|
|
---
|
|
> fprintf(stdout, "%-15s", varname);
|
|
193c193,197
|
|
< fprintf(stdout, "%-11s", paramstr);
|
|
---
|
|
> fprintf(stdout, "%-15s", paramstr);
|
|
>
|
|
> /* extra (chunking) */
|
|
> fprintf(stdout, " ");
|
|
> printChunking(streamID, vlistID, varID);
|