Re: writing netCDF-4 file with compression?

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri, 29 Aug 2008 14:01:36 -0600

Hi Yolande,

There is a function called pack_values that can do this:
http://www.ncl.ucar.edu/Document/Functions/Contributed/pack_values.shtml

Note that the original float values are not exactly reproduced when
converted to shorts and then back to floats.. (See the examples at the
bottom of the page.)
Adam

Yolande Serra wrote:
> Hi,
>
> I'm trying to use NCL to calculate the streamfunction for reanalysis
> winds. I have code that can do that now, but am wondering about
> outputting the streamfunction as a short (like the NCEP/NCAR winds are
> stored) so that the files are not so large. I take it there is no way to
> do this?
>
> Thanks, Yolande
>
> On Aug 17, 2008, at 2:49 PM, David Brown wrote:
>
>> Hi Jeff,
>>
>> There is a file option that can be set using the setfileoption
>> procedure called "CompressionLevel".
>> This allows you to specify the compression-level for data written to a
>> NetCDF4 classic file.
>>
>> Prior to opening the file you would make these calls:
>> setfileoption("nc","Format","NetCDF4Classic")
>> setfileoption("nc","CompressionLevel",5) ; 0 through 9 possible
>>
>> This causes all data written to be compressed. There is no way
>> currently to selectively activate compression
>> on a per-variable basis.
>> -dave
>>
>>
>> On Aug 13, 2008, at 4:09 PM, Jeff Van Dorn wrote:
>>
>>> Hello,
>>>
>>> I saw in a message on Jan, 28 2008 "about HDF5", that Mary said:
>>>
>>> "We do support classic netCDF-4 files (on systems where netCDF-4 is
>>> supported), which write HDF5 underneath the hood."
>>>
>>> I'm wondering if you're able to modify the compression of the netCDF
>>> file on output (e.g., from the C netCDF API: nc_def_var_deflate)? Or
>>> does "classic" mean NCL can write netCDF-4 files but with just using
>>> standard settings?
>>>
>>> Thanks,
>>> Jeff
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk_at_ucar.edu
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Aug 29 2008 - 14:01:36 MDT

This archive was generated by hypermail 2.2.0 : Mon Sep 01 2008 - 06:20:11 MDT