Skip to content

Commit

Permalink
Fixed warnings thrown by compiler on latlonbnds converter
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenplieger committed Dec 23, 2024
1 parent e2892e3 commit 91a64c7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"${workspaceFolder}/hclasses/CppUnitLite/CppUnitLite",
"${workspaceFolder}/hclasses",
"${workspaceFolder}/CCDFDataModel",
"${workspaceFolder}/adagucserverEC"
"${workspaceFolder}/adagucserverEC",
"/usr/include/x86_64-linux-gnu"
],
"defines": ["${default}"],
"macFrameworkPath": ["${default}"],
Expand Down
39 changes: 17 additions & 22 deletions adagucserverEC/CConvertLatLonBnds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,27 @@
const char *CConvertLatLonBnds::className = "CConvertLatLonBnds";

bool CConvertLatLonBnds::isThisLatLonBndsData(CDFObject *cdfObject) {
try {
CDF::Attribute *attr = cdfObject->getAttributeNE("USE_ADAGUC_LATLONBNDS_CONVERTER");
if ((attr != NULL) && attr->getDataAsString().toLowerCase().equals("true")) {
return true;
}
} catch (int e) {
// Go on
CDF::Attribute *attr = cdfObject->getAttributeNE("USE_ADAGUC_LATLONBNDS_CONVERTER");
if ((attr != NULL) && attr->getDataAsString().toLowerCase().equals("true")) {
return true;
}
try {
CDF::Variable *pointLon = cdfObject->getVariable("lon_bnds");
CDF::Variable *pointLat = cdfObject->getVariable("lat_bnds");
} catch (int e) {
auto *pointLon = cdfObject->getVariableNE("lon_bnds");
auto *pointLat = cdfObject->getVariableNE("lat_bnds");
auto *gridpointDim = cdfObject->getDimensionNE("gridpoint");
if (pointLon == nullptr || pointLat == nullptr || gridpointDim == nullptr) {
return false;
}
try {
CDF::Dimension *gridpointDim = cdfObject->getDimension("gridpoint");
CDF::Variable *pointLon = cdfObject->getVariable("lon_bnds");
CDF::Variable *pointLat = cdfObject->getVariable("lat_bnds");
pointLon->getDimension("gridpoint");
pointLat->getDimension("gridpoint");
if ((pointLon->dimensionlinks.size() > 1) && (pointLon->dimensionlinks.size() > 1)) {
cdfObject->setAttributeText("USE_ADAGUC_LATLONBNDS_CONVERTER", "true");
return true;
}

} catch (int e) {
auto *lonGridPointDim = pointLon->getDimensionNE("gridpoint");
auto *latGridPointDim = pointLat->getDimensionNE("gridpoint");
if (lonGridPointDim == nullptr || latGridPointDim == nullptr) {
return false;
}

if ((pointLon->dimensionlinks.size() > 1) && (pointLon->dimensionlinks.size() > 1)) {
cdfObject->setAttributeText("USE_ADAGUC_LATLONBNDS_CONVERTER", "true");
return true;
}

return false;
};
7 changes: 0 additions & 7 deletions adagucserverEC/CConvertLatLonBndsData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ int CConvertLatLonBnds::convertLatLonBndsData(CDataSource *dataSource, int mode)
double *latData = (double *)latitudeBnds->data;

int numY = latitudeBnds->dimensionlinks[0]->getSize();
int numX = longitudeBnds->dimensionlinks[0]->getSize();
#ifdef CConvertLatLonBnds_DEBUG
CDBDebug("numRows %d numCells %d", numY, numX);
#endif
Expand Down Expand Up @@ -219,12 +218,6 @@ int CConvertLatLonBnds::convertLatLonBndsData(CDataSource *dataSource, int mode)
}
}

bool drawBilinear = false;
CStyleConfiguration *styleConfiguration = dataSource->getStyle();
if (styleConfiguration->styleCompositionName.indexOf("bilinear") >= 0) {
drawBilinear = true;
}

CDF::Dimension *gridpoint = cdfObject->getDimensionNE("gridpoint");
size_t nr_points = 0;
if (gridpoint != NULL) {
Expand Down

0 comments on commit 91a64c7

Please sign in to comment.