[Kst] extragear/graphics/kst/kst/datasources/cdf
Nicolas Brisset
nicolas.brisset at eurocopter.com
Wed Oct 12 18:42:30 CEST 2005
SVN commit 469950 by brisset:
First KDE commit ever: I hope it won't break anything :-) Vectors of size 1 in CDF files should be handled like scalars (I have seen that in the real world)
M +12 -3 cdf.cpp
--- trunk/extragear/graphics/kst/kst/datasources/cdf/cdf.cpp #469949:469950
@@ -65,8 +65,9 @@
_fieldList.clear();
//_fieldList += "INDEX"; commented out as it leads to problems in countFrames():
// which value should the method return when not all variables have the same length ?
- long numRvars, numZvars, varN, numDims;
+ long numRvars, numZvars, varN, numDims, dimSizes[CDF_MAX_DIMS];
char varName[CDF_VAR_NAME_LEN + 1];
+ bool var_ok = false;
status = CDFlib(SELECT_, CDF_READONLY_MODE_, READONLYon,
GET_, CDF_NUMrVARS_, &numRvars,
CDF_NUMzVARS_, &numZvars,
@@ -75,7 +76,11 @@
for (varN = 0; varN < numRvars; varN++) {
status = CDFlib(SELECT_, rVAR_, varN, GET_, rVAR_NAME_, varName,
rVARs_NUMDIMS_, &numDims, NULL_);
- if (status == CDF_OK && numDims == 0) {
+ if (numDims == 1) {
+ status = CDFlib(GET_, rVARs_DIMSIZES_, dimSizes, NULL_);
+ if (dimSizes[0] == 1) {var_ok = true;}
+ }
+ if (status == CDF_OK && (numDims == 0 || var_ok)) {
_fieldList += varName;
}
}
@@ -83,7 +88,11 @@
for (varN = 0; varN < numZvars; varN++) {
status = CDFlib(SELECT_, zVAR_, varN, GET_, zVAR_NAME_, varName,
zVAR_NUMDIMS_, &numDims, NULL_);
- if (status == CDF_OK && numDims == 0) {
+ if (numDims == 1) {
+ status = CDFlib(GET_, zVAR_DIMSIZES_, dimSizes, NULL_);
+ if (dimSizes[0] == 1) {var_ok = true;}
+ }
+ if (status == CDF_OK && (numDims == 0 || var_ok)) {
_fieldList += varName;
}
}
More information about the Kst
mailing list