NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hello, I'm trying to write unsigned data to attributes, but I can't quite get it working. I've seen the mailing list threads on reading from unsigned attributes, but I haven't seen much discussion about writing. Suppose I have an unsigned byte variable, and I want to set its `valid_range` attribute. I tried using `Array.setUnsigned`, but the values are still written as signed. In this case the valid range is 0..255, which comes out as 0..-1. This causes ToolsUI to read the variable as being empty. I would just use shorts instead of bytes, but this approach does not seem to be reliable for all attributes: it fails for the `_FillValue` attribute which the nc4 IOSP says must be the same type as the variable. I asked a question on StackOverflow; it has some simplified code in it: http://stackoverflow.com/questions/17139391/netcdf-java-how-to-write-unsigned-attribute Versions: - NetCDF-Java 4.3.16 - libnetcdf 4.2.1 - ToolsUI 4.3 Let me know if you need more information. Cheers, Alex -- Alex Fraser Software Engineer VPAC Ltd.
netcdf-java
archives: