Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
The issue stems from the fact that Java stores float variables in binary and some values (like 0.2) can't be represented in binary. ncks always returns floats with 6 decimal places.
ncks -s '%f' -v VARIABLE NETCDF_FILE I got an equivalent output in Java doing the following: import java.math.BigDecimal; ... float var = ... // (Code to get variable into a Java float excluded) BigDecimal big_var = new BigDecimal(var); String ncks_formated_var = big_var.setScale(6,6).toString(); -- Kyle Wilcox NOAA Chesapeake Bay Office 410 Severn Avenue Suite 107A Annapolis, MD 21403 office: (410) 295-3151 Kyle.Wilcox@xxxxxxxx
netcdf-java
archives: