[Thread Prev][Thread Next][Index]

Re: [ferret_users] cancel mode upcase



Hi David,
This has been on our list of improvements to make for a while, and the MODE UPCASE is a step towards full control over the case of variables in output files. There are just two entirely pieces of the underlying code that are doing things here. For netCDF files, we have introduced a step in the initialization of the file where Ferret saves information about the file. We store global attributes, variable attributes, and the original upper-or lower-case spelling of the variables and attributes, and we use that stored information when deciding what attributes to write and what case names are in.

For user commands defining variables, the name of the variable is upcased almost right away. By default  Ferret is case-insensive (and for almost everything there's no choice about treatment of case).  If we say

yes? use basin.nc
yes? LET A1 = BASIN
yes? let a1 1= 2*basin

then we've defined only one variable, A1. The second definition replaces the first, and we cannot define two variables a1, and A1 (as Ferret is currently written).  So there's more to the issue than just what the case will be upon output. It would be a small step, however, to change the Ferret code to save the case of the variable from the LET command each time a definition is made, and if CANCEL MODE UPCASE is in effect, we would output the variable using that case to netCDF files. In the above example
yes? use basin.nc
yes? can mode upcase

yes? LET A1 = BASIN
yes? save/clobber/file=a1.nc a1   ! This would write A1

yes? let a1 = 2*basin
yes? save/clobber/file=a1.nc a1   ! This would write A1
Doesn't work this way yet, but I'll add this to our planning.


David Wang wrote:
Hello Ferreters,

I found CANCEL MODE UPCASE failed to work for user-defined variables. For example:

yes? use basin.nc
yes? can mode upcase
yes? let basin2 = basin
yes? save/file=tmp1.nc basin
 LISTing to file tmp1.nc
 *** NOTE: Converting data type of missing_value NC_SHORT to match output type of variable NC_FLOAT
yes? save/file=tmp2.nc basin2
 LISTing to file tmp2.nc

the variable `basin' and all coordinate variables are still in lower case in tmp1.nc, but they are all capitalized in tmp2.nc

Is there a reason that it has to be like that?

Thanks,
David

-- 

~>   ~>   ~>   ~>   ~>   ~>   ~>   ~>   ~>   ~>   ~> 

Ansley Manke, NOAA/PMEL   ansley.b.manke@xxxxxxxx
7600 Sand Point Way NE, Seattle WA
Phone 206-526-6246,  FAX 206-526-6744


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement