<div dir="ltr">Dear Dave,<div>Many thanks for your help and advice. And, appreciate the time you consider to guide me.</div><div>Best wishes,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 11, 2021 at 11:15 PM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov">dave.allured@noaa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>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.</div><div><br></div><div>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).</div><div><br></div><div>If something prevents you from changing the model code, then just convert the air temp file to packed using the NCL <b>pack_values</b> function.  See the general documentation for how to read and write a netcdf file.</div><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 11, 2021 at 12:00 PM Setareh Rahimi <<a href="mailto:setareh.rahimi@gmail.com" target="_blank">setareh.rahimi@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Dear Dave,</div><div dir="auto">Thank you for your reply. Yes I am sure, because the model I am running only accept packed nc file with scale factor. </div><div dir="auto">Please have a look at attached file showing the error I face while running the model with mentioned nc file.</div><div dir="auto">Best regard</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 11, 2021 at 22:20 Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>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 <b>pack_values</b>.</div></div><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 11, 2021 at 11:07 AM Setareh Rahimi via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear all,<div>I need to convert an unpacked netCDF file to a packed one (<a href="ftp://ftp2.psl.noaa.gov/Datasets/ncep.reanalysis2/pressure/air.2019.nc" target="_blank">ftp://ftp2.psl.noaa.gov/Datasets/ncep.reanalysis2/pressure/air.2019.nc</a>), I wonder if this possible using NCL?</div><div>Many thanks in advance,</div><div>Best wishes,<br>-- <br><div dir="ltr">S.Rahimi</div></div></div></blockquote></div></div></blockquote></div></div>
</blockquote></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">S.Rahimi<br><br></div>