[ncl-talk] Convert unpacked netCDF file to packed one
Setareh Rahimi
setareh.rahimi at gmail.com
Tue Jan 12 06:19:28 MST 2021
Dear Dave,
Many thanks for your help and advice. And, appreciate the time you consider
to guide me.
Best wishes,
On Mon, Jan 11, 2021 at 11:15 PM Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:
> I see. I suggest the best solution would be a simple upgrade to the model
> code, so that it could read both packed and unpacked air temp files. This
> will enable the model to use future data updates without extra processing.
>
> In fortran, this would be an if statement to check whether there is a
> scale_factor attribute. If not, then skip reading scale_factor and
> add_offset, also skip the unpacking statement or loop that converts packed
> data values to unpacked. Just read in the unpacked values directly. You
> would need two read statements, the original one for the packed data type,
> and a new one for the unpacked data type (fortran real).
>
> If something prevents you from changing the model code, then just convert
> the air temp file to packed using the NCL *pack_values* function. See
> the general documentation for how to read and write a netcdf file.
>
>
> On Mon, Jan 11, 2021 at 12:00 PM Setareh Rahimi <setareh.rahimi at gmail.com>
> wrote:
>
>> Dear Dave,
>> Thank you for your reply. Yes I am sure, because the model I am running
>> only accept packed nc file with scale factor.
>> Please have a look at attached file showing the error I face while
>> running the model with mentioned nc file.
>> Best regard
>>
>> On Mon, Jan 11, 2021 at 22:20 Dave Allured - NOAA Affiliate <
>> dave.allured at noaa.gov> wrote:
>>
>>> That file is already compressed to 31% of its natural array size, using
>>> netcdf-4 internal compression. Are you sure you want to do that? If yes,
>>> then use the NCL function *pack_values*.
>>>
>>>
>>> On Mon, Jan 11, 2021 at 11:07 AM Setareh Rahimi via ncl-talk <
>>> ncl-talk at mailman.ucar.edu> wrote:
>>>
>>>> Dear all,
>>>> I need to convert an unpacked netCDF file to a packed one (
>>>> ftp://ftp2.psl.noaa.gov/Datasets/ncep.reanalysis2/pressure/air.2019.nc),
>>>> I wonder if this possible using NCL?
>>>> Many thanks in advance,
>>>> Best wishes,
>>>> --
>>>> S.Rahimi
>>>>
>>>
--
S.Rahimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210112/640ee120/attachment.html>
More information about the ncl-talk
mailing list