Skip to content

Commit b50c92a

Browse files
authored
added precedence for main netCDF variable lookup (#540)
1 parent bb5144a commit b50c92a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libs/gdal/frmts/gsky_netcdf/netcdfdataset.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7295,7 +7295,10 @@ GDALDataset *netCDFDataset::Open( GDALOpenInfo *poOpenInfo )
72957295

72967296
const char *mainVarLookup = CSLFetchNameValue(poOpenInfo->papszOpenOptions, "var_id_query");
72977297
if(mainVarLookup != nullptr) {
7298-
poDS->mainVariableId = (char *)poDS->FetchAttr("NC_GLOBAL", mainVarLookup);
7298+
char *varId = (char *)poDS->FetchAttr("NC_GLOBAL", mainVarLookup);
7299+
if(poDS->mainVariableId == nullptr && varId != nullptr) {
7300+
poDS->mainVariableId = varId;
7301+
}
72997302
}
73007303

73017304
// Identify coordinate and boundary variables that we should

0 commit comments

Comments
 (0)