NOAA-PMEL / Ferret

The Ferret program from NOAA/PMEL
https://ferret.pmel.noaa.gov/Ferret/
The Unlicense
55 stars 21 forks source link

variables w/names that are reserved keywords, attribute access and up-casing #1969

Closed AnsleyManke closed 4 years ago

AnsleyManke commented 4 years ago

Ryo Furue ran into this. When a variable name in a file matches a reserved name, we can refer to it in quotes:

yes? plot 'z'

but to work with it conveniently in scripts the best method is to do a rename, giving it a legal name:

yes? set variable/name=myvar 'z'

It turns out that all of this works fine if the name in the file is UPPER-CASE Z but not if it's lower-case z. Ferret has forever been (largely) case insensitive, so there is all kinds of complexity about comparing text coming from the user in non-case-sensitive ways. Somehow this has gotten tangled when handling attribute-access commands.

AnsleyManke commented 4 years ago

In cd_get_var_id.F, the code correctly does a case-sensitive search for the variable name that's given in the command inside quotes, but it used the up-cased version of the variable. Change this to look for the name in its original upper- or lower-case form.

I've added several more tests of this to the benchmarks.