Re: The significance of trailing blanks in attributes...

Hi Roland-

Roland Schweitzer wrote:

I have some code based the the Java netCDF library (tested against netcdfUI-2.2.10.jar). It depends on the interpretation of files conforming to COARDS and CF-1.0. When a file contains attributes that are significant to the convention, but have trailing blanks, the "grids" are not recognized. E.g.

nxt:long_name = "longitude                                  " ;
nxt:short_name = "lon                                   " ;
nxt:units = "degrees_east                       " ;

Apparently some users have used trailing blanks to pad the netCDF header so they can change attributes without rewriting the entire file. This trick means that the netCDF Java library can't interpret the conventions correctly.

Is it reasonable that the convention attributes be interpreted with the trailing blanks and null bytes removed? Would that sort of change show up in a revised library soon?

I would vote for using .trim() when checking these attributes.
I would also vote for people not padding in the first place. ;-)

If not I will try to attack this problem in myself.

Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
        "Time makes everyone interesting, even YOU!"