<div dir="ltr"><div><div><div><div>[1] short2flt_hdf uses the formula: x_float = scale_factor*(x_short - offset)<br></div>[2] short2flt uses the formula: x_float = x_short*scale_factor + offset<br><br></div><div><br></div>netCDF conventions (COARDS, CF [Climate & Forecast]) *require* use of the attribute names: scale_factor and add_offset. Further, they *require* use of formula [2]. The netCDF conventions require use of the attributes _FillValue or missing_value to identify values that should be ignored. The type of the _FillValue/missing_value attribute should match the type of the variable with which it is associated. For example, a short variable should have a _FillValue that is type short.<br><br></div>To my knowledge, HDF-4/5, have no common conventions. Likely, it is left up to each project to define assorted information. This often makes dealing with HDF variables that must be converted to a new numeric a nuisance!! It becomes the user's responsibility to determine how to get the correct numbers.<br><br></div><div>NCL's function [1] and [2] try to accommodate 'aliases' for scale_factor and add_offset. Based on past experience, the following are allowed.<br><br> sNames = (/"scale", "SCALE", "Scale", "_scale", "scale_factor", "factor" \<br> ,"Scale_factor", "Slope" , "slope", "ScaleFactor", "Scale_Factor" \<br> ,"SCALING_FACTOR" /)<br><br></div><div>Note: there is no 'Scaling_Factor'. Thus, the resulting data are not scaled properly.<br>---<br><br></div><div>Also, looking at the 'printVarSummary' output shows no _FillValue or missing_value attribute. Only the following:<br><br> Undef_Code : 32767<br><br></div><div>As noted in NCL's documentation **only** _FillValue is recognized. User's must make the appropriate changes.<br><br>---<br></div><div>Attached is a simple scrip. No graphics.<br><br></div><div>Output is as follows:<br><br>Variable: ts <===== original variable<br>Type: <b>short</b><br>Total Size: 5972192 bytes<br> 2986096 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [DIM_000 | 1544] x [DIM_001 | 1934]<br>Coordinates: <br>Number Of Attributes: 11<br> Data_Type : STD_I16LE<br> Maximum : 305.7448<br> Minimum : 245.3125<br> Number_of_Bits_per_Pixel : 10<br> Number_of_Columns : 1934<br> Number_of_Lines : 1544<br> <b>Offset</b> : 220<br> <b>Scaling_Factor</b> : 0.1270772<br> <b>Undef_Code</b> : 32767<br> <b>Unit</b> : K<br> <b>Variable_Long_Name</b> : Land_Surface_Temperature<br><br>(0) min=199 max=32767 <=== ts min and max<br><br>(0) typeof(ts@Undef_Code) =integer<br>(0) typeof(ts@Scaling_Factor)=float<br>(0) typeof(ts@Offset) =float<br>(0) ---<br><br>Variable: TS<br>Type: float<br>Total Size: 11944384 bytes<br> 2986096 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [DIM_000 | 1544] x [DIM_001 | 1934]<br>Coordinates: <br>Number Of Attributes: 1<br> _FillValue : 32767<br><br>(0) min=245.288 max=305.777<br><br></div><div><br></div><div><br></div><div><br><br><br><br><br><br><br><br></div><div><div><div><div><div><div><div><pre><br></pre></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 30, 2017 at 2:06 PM, Jin-Young Kim <span dir="ltr"><<a href="mailto:ruwiejin@gmail.com" target="_blank">ruwiejin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear Shea <div><br></div><div>I've tried to read hdf5 format with short2flt_hdf for COMS satellite. </div><div><br></div><div>But it looks that short2flt_hdf doesn't control offset and scaling_factor well. </div><div><br></div><div>Would you look into the error ? </div><div><br></div><div>Here is my error and tried script and original sample data. </div><div><br></div><div>In addition, if it solve then i would like to try to read multiple file more than 1024 number. </div><div><br></div><div>Would you give me any guidance ? </div><div><br></div><div>Best regards, </div><span class="HOEnZb"><font color="#888888"><div>Jin </div><div><div><br></div>-- <br><div class="m_5285033620136298766gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div><div dir="ltr"><div><div><strong>Jin-Young Kim, </strong><strong>Ph.D </strong><strong> </strong></div><div><strong></strong> </div><div><strong>한국에너지기술연구원 </strong></div><div><strong>KIER(Korea Institute of Energy Research)</strong></div><div><strong>이메일: <a href="mailto:jinyoung.kim@kier.re.kr" target="_blank">jinyoung.kim@kier.re.kr</a></strong></div><div><strong>사무실: <a href="tel:+82%2042-860-3734" value="+82428603734" target="_blank">+82-42-860-3734</a></strong></div><div><strong>휴대폰: <a href="tel:+82%2010-2990-7595" value="+821029907595" target="_blank">+82-10-2990-7595</a></strong></div><div><font size="3" face="굴림" color="#000000"> </font></div></div></div></div></div></div></div>
</div></font></span></div>
</blockquote></div><br></div>