Error with generateBeld4Data / computeGridLandUse_beld4

Hello,

it looks like even with enough RAM and recompiling the SA tools (version 4.4), I’m having trouble with generateBeld4Data. I’m running it through the FEST-C interface (version 1.4); the run script is generated through FEST-C, and I’m running it for the 12US1 domain, with the goal of running FEST-C on this nested grids for 2024 (so I can’t use beld4 files from EQUATES or the 2022 modeling platform). I have successfully benchmarked FEST-C.

The FEST-C script for generateBeld4Data makes two beld4 files, one with landmask, imperviousness, and canopy information generated though the SA’s computeGridLandUse_beld4.exe, and another with specific crop, tree, etc. information, generated with FEST-C’s Beld_nc2ioapi.exe. The issue I’m seeing is a discontinuity in the landmask variable in the former (attached landcover_imperviousness_canopy screenshot)–the output from computeGridLandUse_beld4. The discontinuity seems to follow the northern bound of the imperviousness variable (not sure if that’s coincidental), and affects the second beld4 file (with crops&trees) when compared to the beld4 file I got from the 2022 modeling platform (attached wheat_spring.png).
The log file shows that a few MODIS files weren’t in the domain, because I pulled more MODIS data than I needed, but otherwise I don’t see anything helpful in the log file to guide further investigation and fixing this, and any suggestions would be so very much appreciated!

(edited with more specific executable info.)

Thanks,
Monica

generateBeld4Data_12US1_20260928131657.csh.log.txt (122.2 KB)

I worked with Huan Fang to find the source of this error–the NLCD noData value has changed, so the new noData value of 250 was incorrectly mapped to open water. Huan made the following changes to the script, and it works correctly now.

original (with line numbers):
2649 gridID = poImage_grd[k];
2650 classID = poImage[k];
2651
2652 if ( gridID > 0 && gridID <= gridPixels && classID != NoDataValue)
2653 {
2654 idIndex = nlcdIDS[classID]; //index in USGS NLCD ID pointer

should be:
2649 gridID = poImage_grd[k];
2650 classID = poImage[k];
2651
2652 std::map<int,int>::const_iterator it = nlcdIDS.find(classID);
2653
2654 if ( gridID > 0 && gridID <= gridPixels && it != nlcdIDS.end())
2655 {
2656 idIndex = it->second; //index in USGS NLCD ID pointer