[Thread Prev][Thread Next][Index]

Re: [ferret_users] SAVE precision of var from binary data?

Hi Ryo,

The /OUTTYPE option is available for any netCDF write, regardless of the source of the data. In my tests it is working with Ferret v6.93; this has not changed recently.

        FERRET v6.93 
        Linux 2.6.32-504.el6.x86_64 64-bit - 11/05/14
         5-Jul-17 09:49    

yes? define axis/x=1:10:1 x10
yes? define axis/y=1:5:1 y5
yes? define grid/x=x10/y=y5 g10x5
yes? file/var=myvar/grid=g10x5/format=stream stream_data_link.unf

yes? save/file=vsingle.nc/clobber myvar
 LISTing to file vsingle.nc
yes? save/clobber/file=vdouble.nc/outtype=double myvar
 LISTing to file vdouble.nc
 *** NOTE: Converting data type of missing_value NC_FLOAT to match output type of variable NC_DOUBLE

and the resulting files do have data of those types.  I've attached the data file; please test it and let me know what you see.

Note you can say

yes? set list/outtype=double

To apply that setting to all files written in the session.  (Often people use SET LIST/OUTTYPE=float or even /OUTTYPE=int, to save disk space when their data does not need double precision output.)  The default type for writing netCDF files is the input data type; does your data have more than 6-7 digits?  Are the data correct within Ferret when it reads from your binary file?


On 7/4/2017 8:37 PM, Ryo Furue wrote:
Hi Ferret users,

It seems that

   SAVE/file=some.nc var

saves var in single precision, if var is from a stream, double-precision binary file.  In contrast,

   LIST/form=STREAM/file=some.bin var

saves it in double precision.

I'm using Ferret 6.93 on Linux.

I guess the OUTTYPE attribute isn't set for a variable from a binary file, or there is some such inconsistency.  I hope it's fixed in the future.


I have been able to reproduce this problem with

set data levitus_climatology
save/file=tmp.nc/outtype=double temp[k=1,l=1]
cancel data/all
SPAWN ncks -C -b tmp.bin -v TEMP tmp.nc -o tmp2.nc
define axis/x=0:359:1 xax
define axis/y=-89.5:89.5:1 yax
define grid/x=xax/y=yax mygrid
file/form=STREAM/var=temp/type=r8/grid=mygrid tmp.bin
save/file=tmp-new.nc temp

Attachment: stream_example.tar
Description: Unix tar archive

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement