From aefa16d967e09a4258ad64ece18e94eab5443e95 Mon Sep 17 00:00:00 2001 From: ftomei Date: Mon, 11 Dec 2023 16:02:34 +0100 Subject: [PATCH] update netcdf --- netcdfHandler/netcdfHandler.cpp | 17 +++++++++++++++++ netcdfHandler/netcdfHandler.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/netcdfHandler/netcdfHandler.cpp b/netcdfHandler/netcdfHandler.cpp index e0e409669..9a6331bbc 100644 --- a/netcdfHandler/netcdfHandler.cpp +++ b/netcdfHandler/netcdfHandler.cpp @@ -149,6 +149,8 @@ void NetCDFHandler::clear() variables.clear(); metadata.str(""); timeUnit = ""; + + missingValue = NODATA; } @@ -525,11 +527,25 @@ bool NetCDFHandler::readProperties(string fileName) else if (ncTypeId == NC_INT) { nc_get_att(ncId, v, attrName, &valueInt); + + // no data + if (lowerCase(string(attrName)) == "missing_value" || lowerCase(string(attrName)) == "nodata") + { + missingValue = double(valueInt); + } + metadata << attrName << " = " << valueInt << endl; } else if (ncTypeId == NC_DOUBLE) { nc_get_att(ncId, v, attrName, &value); + + // no data + if (lowerCase(string(attrName)) == "missing_value" || lowerCase(string(attrName)) == "nodata") + { + missingValue = value; + } + metadata << attrName << " = " << value << endl; } } @@ -1131,6 +1147,7 @@ bool NetCDFHandler::extractVariableMap(int idVar, const Crit3DTime& myTime, std: } default: { + delete[] values; errorStr = "Wrong variable type."; return false; } diff --git a/netcdfHandler/netcdfHandler.h b/netcdfHandler/netcdfHandler.h index 294f6a2f2..1d8a284d9 100644 --- a/netcdfHandler/netcdfHandler.h +++ b/netcdfHandler/netcdfHandler.h @@ -54,6 +54,8 @@ bool isHourly; bool isDaily; + double missingValue; + gis::Crit3DLatLonHeader latLonHeader; NetCDFHandler();