diff --git a/ChangeLog b/ChangeLog index 4e4b57b487f9decffe2ed149f49bbc6c38e46551..5916be47577a7fd7034612f54293618f130d34eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ * Using CDI library version 2.5.1 * Version 2.5.1 release +2025-01-31 Uwe Schulzweida + + remapcon: env.var. REMAP_AREA_MIN failed since release 2.4.0 (bug fix) + 2025-01-30 Uwe Schulzweida * New operator: setchunkspec - Specify chunking diff --git a/NEWS b/NEWS index bf2de73fce5006ec7818f8747613596e5bf08aee..215c411b12db8739dbf870f1d09243c64332d5a4 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ Version 2.5.1 (6 Feb 2025): New operators: * cinfo: Compact information listed by parameter name Fixed bugs: + * remapcon: env.var. REMAP_AREA_MIN failed since release 2.4.0 * consects/consecsum: wrong result since release 2.4.0 [Bug #12030] Version 2.5.0 (28 Nov 2024): diff --git a/src/remap_scrip_io.cc b/src/remap_scrip_io.cc index a1c14496881c092546d09a4d7ec14dc9f250a0bc..c209d1f0b0093711e08a2b5f59843c112e038fb2 100644 --- a/src/remap_scrip_io.cc +++ b/src/remap_scrip_io.cc @@ -708,6 +708,7 @@ remap_read_data_scrip(const std::string &weightsfile, int gridID1, int gridID2, { srcGrid.mask.resize(srcGrid.size); tgtGrid.mask.resize(tgtGrid.size); + if (remapSwitches.mapType == RemapMethod::CONSERV) tgtGrid.cellFrac.resize(tgtGrid.size); } // Allocate address and weight arrays for mapping 1 @@ -801,10 +802,10 @@ remap_read_data_scrip(const std::string &weightsfile, int gridID1, int gridID2, } if (needGridarea) nce(nc_get_var_double(ncId, nc_dstgrdarea_id, &tgtGrid.cellArea[0])); - - nce(nc_get_var_double(ncId, nc_dstgrdfrac_id, &tgtGrid.cellFrac[0])); } + if (remapSwitches.mapType == RemapMethod::CONSERV) nce(nc_get_var_double(ncId, nc_dstgrdfrac_id, &tgtGrid.cellFrac[0])); + if (rv.numLinks > 0) { read_array_int64(ncId, nc_srcadd_id, rv.numLinks, &rv.srcCellIndices[0]); diff --git a/src/remaplib.cc b/src/remaplib.cc index 67b115f59064b5eaba4183f069673db1282ec500..00d310dcbf013503790f741c8a149143c13f7c88 100644 --- a/src/remaplib.cc +++ b/src/remaplib.cc @@ -15,7 +15,7 @@ #include "gridreference.h" #include "remap.h" -static bool RemapGenWeitghs = true; +static bool RemapGenWeights = true; static bool RemapWriteRemap = false; constexpr size_t DefaultMaxIteration = 100; @@ -47,7 +47,7 @@ remap_set_int(int remapvar, int value) // clang-format off if (remapvar == REMAP_WRITE_REMAP) RemapWriteRemap = (value > 0); else if (remapvar == REMAP_MAX_ITER) RemapMaxIteration = value; - else if (remapvar == REMAP_GENWEIGHTS) RemapGenWeitghs = (value > 0); + else if (remapvar == REMAP_GENWEIGHTS) RemapGenWeights = (value > 0); else cdo_abort("Unsupported remap variable (%d)!", remapvar); // clang-format on } @@ -90,9 +90,8 @@ check_lon_range(const char *txt, size_t nlons, Varray<double> &lons) double minval = 1.e36; double maxval = -1.e36; #ifdef _OPENMP -#pragma omp parallel for if (nlons > cdoMinLoopSize) default(shared) schedule(static) reduction(min \ - : minval) reduction(max \ - : maxval) +#pragma omp parallel for if (nlons > cdoMinLoopSize) default(shared) schedule(static) reduction(min : minval) \ + reduction(max : maxval) #endif for (size_t i = 0; i < nlons; ++i) { @@ -127,9 +126,8 @@ check_lat_range(const char *txt, size_t nlats, Varray<double> &lats) double minval = 1.e36; double maxval = -1.e36; #ifdef _OPENMP -#pragma omp parallel for if (nlats > cdoMinLoopSize) default(shared) schedule(static) reduction(min \ - : minval) reduction(max \ - : maxval) +#pragma omp parallel for if (nlats > cdoMinLoopSize) default(shared) schedule(static) reduction(min : minval) \ + reduction(max : maxval) #endif for (size_t i = 0; i < nlats; ++i) { @@ -414,7 +412,7 @@ remap_grid_alloc(RemapMethod mapType, RemapGrid &grid) auto needCellarea = (mapType == RemapMethod::CONSERV); if (needCellarea) grid.cellArea.resize(grid.size, 0.0); - if (RemapGenWeitghs || mapType == RemapMethod::CONSERV) { grid.cellFrac.resize(grid.size, 0.0); } + if (RemapGenWeights || mapType == RemapMethod::CONSERV) { grid.cellFrac.resize(grid.size, 0.0); } if (grid.needCellCorners && grid.numCorners > 0) { @@ -515,7 +513,7 @@ remap_init_grids(RemapMethod mapType, bool doExtrapolate, int gridID1, RemapGrid srcGrid.type = RemapGridType::Reg2D; else if (is_healpix_grid(gridID1) && mapType == RemapMethod::BILINEAR) srcGrid.type = RemapGridType::HealPix; - else if (is_healpix_grid(gridID1) && mapType == RemapMethod::KNN && !RemapGenWeitghs) + else if (is_healpix_grid(gridID1) && mapType == RemapMethod::KNN && !RemapGenWeights) srcGrid.type = RemapGridType::HealPix; } @@ -525,14 +523,14 @@ remap_init_grids(RemapMethod mapType, bool doExtrapolate, int gridID1, RemapGrid // else srcGrid.type = -1; } - if (!RemapGenWeitghs && is_reg2d_grid(gridID2) && tgtGrid.type != RemapGridType::Reg2D) + if (!RemapGenWeights && is_reg2d_grid(gridID2) && tgtGrid.type != RemapGridType::Reg2D) { if (mapType == RemapMethod::KNN) tgtGrid.type = RemapGridType::Reg2D; if (mapType == RemapMethod::BILINEAR && (srcGrid.type == RemapGridType::Reg2D || srcGrid.type == RemapGridType::HealPix)) tgtGrid.type = RemapGridType::Reg2D; } - if (!RemapGenWeitghs && is_healpix_grid(gridID2)) + if (!RemapGenWeights && is_healpix_grid(gridID2)) { if (mapType == RemapMethod::BILINEAR || mapType == RemapMethod::KNN) tgtGrid.type = RemapGridType::HealPix; }