Reserved keywords
Question:
What variable names conflict with Ferret's reserved keywords?
Example:
yes? use my_data.nc yes? show data currently SET data sets: 1> ./my_data.nc (default) name title I J K L T SEA SURFACE TEMPERATURE 1:180 1:90 ... 1:1 yes? shade T **ERROR: dimensions improperly specified: 9999999 words were requested. *** NOTE: Check for unspecified limits on an ABSTRACT axis *** NOTE: Use the SHOW GRID command to see the axes
Explanation:
Ferret has a small set of absolutely reserved keywords. If Ferret encounters a variable who's name is an absolutely reserved keyword an error will result. The only absolutely reserved names are the pseudovariables I, J, K, L, X, Y, Z, T, _I, _J, _K, _L, _M, _N, _X, _Y, _Z, _T, _E, _F, XBOX, YBOX, ZBOX, TBOX, EBOX, FBOX, XBOXLO, XBOXHI, XBOXLO, YBOXHI, YBOXLO, ZBOXHI, ZBOXLO, ZBOXHI, EBOXLO, EBOXHI, TBOXLO, TBOXHI; and operators AND, OR, GT, GE, LT, LE, EQ, NE. Ferret does not distinguish between upper and lower case.
It turns out that you CAN legally define variables using function names and keywords, like this (a good way to confuse the innocent!)
yes? LET plot = sin(x[gx=sst]) yes? PLOT plot
Solution:
Three basic possibilities exist for addressing this problem.
- In your Ferret expression, use single quotes around the variable name. (Note that variable names become case sensitive when surrounded by single quotes.)
-
For variables which come from a NetCDF dataset or OPeNDAP URL, rename the variable in Ferret after opening the dataset. This renames the variables within the Ferret session.
yes? use indata.nc yes? show data currently SET data sets: 1> ./indata.nc (default) name title I J K L T TEMPERATURE 1:180 1:90 ... 1:12 TBOX TEMPERATURE IN BOX 1:180 1:90 ... 1:12 Z BOTTOM DEPTH 1:180 1:90 ... 1:12 ! Rename the variables so they are not keywords. yes? set var/name=temp 'T' yes? set var/name=tempbox 'TBOX' yes? set var/name=depth 'Z' yes? show data currently SET data sets: 1> ./indata.nc (default) name title I J K L TEMP TEMPERATURE 1:180 1:90 ... 1:12 TEMPBOX TEMPERATURE IN BOX 1:180 1:90 ... 1:12 DEPTH BOTTOM DEPTH 1:180 1:90 ... 1:12
- Outside of Ferret, rename the variable using the netCDF operator named ncrename. (e.g. "ncrename -v T,TEMP my_file.nc")