diff --git a/ChangeLog b/ChangeLog index b1e9272c0692a43be5c759aa014b62854d57147e..b110284d9f00a8ae94c1396618bd6a761822ee44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-03-27 Uwe Schulzweida + + * vlistChangeZaxis: added call to delete_chunks() (bug fix) + +2025-03-14 Uwe Schulzweida + + * enable-hirlam-extensions failed since release 2.5.1 (bug fix) + 2025-03-05 Uwe Schulzweida * Version 2.5.1 released diff --git a/configure.ac b/configure.ac index 112aeb0f2fb9b8d1d95499e41c054f5053d80b1f..a6026ba7cf6f9fa1af8a32d7dcba0566be7a1e5f 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ AC_PREREQ([2.69]) LT_PREREQ([2.4.6]) -AC_INIT([cdi],[2.5.1.1],[https://mpimet.mpg.de/cdi]) +AC_INIT([cdi],[2.5.2],[https://mpimet.mpg.de/cdi]) AC_DEFINE_UNQUOTED(CDI, ["$PACKAGE_VERSION"], [CDI version]) AC_CONFIG_AUX_DIR([config]) diff --git a/src/cdf_filter.c b/src/cdf_filter.c index 615208ca3c0e2bce59972f73e112abb3b27a3978..91773ffe7267868fa9cc658611f1d405d2fad511 100644 --- a/src/cdf_filter.c +++ b/src/cdf_filter.c @@ -94,8 +94,7 @@ cdf_def_var_filter(int ncid, int ncvarID, const char *filterSpec) for (size_t i = 0; i < nfilters; i++) { unsigned int filterid = filters[i]->filterid; - // printf("filter %zu id:%d nparams:%zu param1 %d %d\n", i + 1, filterid, filters[i]->nparams, filters[i]->params[0], - // filters[i]->params[1]); + // printf("filter %zu id:%d nparams:%zu param1 %d\n", i + 1, filterid, filters[i]->nparams, filters[i]->params[0]); status = nc_def_var_filter(ncid, ncvarID, filterid, filters[i]->nparams, filters[i]->params); if (status != NC_NOERR) { diff --git a/src/grb_write.c b/src/grb_write.c index 217904313fda17b3dfc7d6f1a7d3caf7ed14f976..7f699aac75d87694f237e30127a9845a49aa8727 100644 --- a/src/grb_write.c +++ b/src/grb_write.c @@ -316,8 +316,8 @@ grbCopyField(stream_t *streamptr2, stream_t *streamptr1) size_t numMissVals = 0; int vlistID = streamptr1->vlistID; - int varID = record->varID; - int levelID = record->levelID; + int varID = recinfo->varID; + int levelID = recinfo->levelID; int gridID = vlistInqVarGrid(vlistID, varID); size_t gridsize = gridInqSize(gridID); diff --git a/src/vlist.c b/src/vlist.c index a6bf4888ee0e7ebcea82061e0bcf35a52c14eb74..998026b61d9e8383fe6d6c45cf24a0f22a2fa7e3 100644 --- a/src/vlist.c +++ b/src/vlist.c @@ -507,6 +507,22 @@ vlist_generate_zaxis(int vlistID, int zaxistype, int nlevels, const double *leve return zaxisID; } +static void +delete_chunks(int vlistID, int varID) +{ + int chunkKeys[4] = { CDI_KEY_CHUNKSIZE_DIMX, CDI_KEY_CHUNKSIZE_DIMY, CDI_KEY_CHUNKSIZE_DIMZ, CDI_KEY_CHUNKSIZE_DIMT }; + for (int i = 0; i < 4; ++i) + { + int chunkSize = 0; + cdiInqKeyInt(vlistID, varID, chunkKeys[i], &chunkSize); + if (chunkSize != 0) cdiDeleteKey(vlistID, varID, chunkKeys[i]); + } + + int chunkSize = 0; + cdiInqKeyInt(vlistID, varID, CDI_KEY_CHUNKSIZE, &chunkSize); + if (chunkSize > 0) cdiDeleteKey(vlistID, varID, CDI_KEY_CHUNKSIZE); +} + /* @Function vlistCopyFlag @Title Copy some entries of a variable list @@ -708,6 +724,7 @@ vlistCopyFlag(int vlistID2, int vlistID1) zaxisID = zaxisID2; vars2[varID2].zaxisID = zaxisID2; + delete_chunks(vlistID2, varID2); } for (int levID = 0; levID < nlevs2; levID++) @@ -1350,22 +1367,6 @@ vlistGridIndex(int vlistID, int gridID) return index; } -static void -delete_chunks(int vlistID, int varID) -{ - int chunkKeys[4] = { CDI_KEY_CHUNKSIZE_DIMX, CDI_KEY_CHUNKSIZE_DIMY, CDI_KEY_CHUNKSIZE_DIMZ, CDI_KEY_CHUNKSIZE_DIMT }; - for (int i = 0; i < 4; ++i) - { - int chunkSize = 0; - cdiInqKeyInt(vlistID, varID, chunkKeys[i], &chunkSize); - if (chunkSize != 0) cdiDeleteKey(vlistID, varID, chunkKeys[i]); - } - - int chunkSize = 0; - cdiInqKeyInt(vlistID, varID, CDI_KEY_CHUNKSIZE, &chunkSize); - if (chunkSize > 0) cdiDeleteKey(vlistID, varID, CDI_KEY_CHUNKSIZE); -} - void vlistChangeGridIndex(int vlistID, int index, int gridID) { @@ -1457,6 +1458,7 @@ vlistChangeZaxisIndex(int vlistID, int index, int zaxisID) if (vlistptr->vars[varID].zaxisID == zaxisIDold) { vlistptr->vars[varID].zaxisID = zaxisID; + delete_chunks(vlistID, varID); if (vlistptr->vars[varID].levinfo && nlevs != nlevsOld) { vlistptr->vars[varID].levinfo @@ -1490,6 +1492,7 @@ vlistChangeZaxis(int vlistID, int zaxisID1, int zaxisID2) if (vlistptr->vars[varID].zaxisID == zaxisID1) { vlistptr->vars[varID].zaxisID = zaxisID2; + delete_chunks(vlistID, varID); if (vlistptr->vars[varID].levinfo && nlevs2 != nlevs1) {