-
Notifications
You must be signed in to change notification settings - Fork 45
Description
CDF variable names are supposed to be case-sensitive, as documented in the manual here: https://cdf.gsfc.nasa.gov/manual/node72.html
But the varget method calls vdr_info, which has this case-insensitive comparison:
name, vdr_next = self._read_vdr_fast(position)
if name.strip().lower() == variable.strip().lower():
vdr_info = self._read_vdr(position)
break
I noticed this when the ERG project released CDFs that changed some variable names from mixed case to lower case. In IDL, I had to make code changes to be able to retrieve the renamed variables from the new CDFs, but in Python using cdflib, varget returned the lower-case version, even though I was requesting the mixed-case version.
If someone were perverse enough to create a CDF with two variables that differed only in case, the one that occurs later in the list would be invisible to cdflib, and varget would return the same info for both variables.
I'm not too mad about this -- it actually saved me some trouble! (In the short run, at least...) But for the sake of correctness, it should probably be changed to use case-sensitive comparisons. Maybe a 'strict mode' or 'ignore case' flag of some sort would give the best of both worlds, allowing us to accommodate a hypothetical case like a CDF with one spelling for a DEPEND_N attribute and another for the target variable.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status