[ncl-talk] hdf file to netcdf

Dennis Shea shea at ucar.edu
Tue Feb 19 09:46:34 MST 2019


Oi Vanúcia

I believe I answered a similar question on 14 February. Note the '*-nc4c*'
option at the end.

%> *ncl_convert2nc*
<https://www.ncl.ucar.edu/Document/Tools/ncl_convert2nc.shtml> MOD11_L2.hdf
*-nc4c*

netCDF's "Classic mode" refers to netCDF-3.
netCDF-3 *does not support* (allow) *unsigned integer* types
netCDF-4 does allow (support) these numeric types.

Surprisingly, *ncl_convert2nc *converted these numeric data types to type
short*.*
I *speculate *this would be 'ok.'


%> *ncl_convert2nc* MOD11_L2.hdf *-nc4c*
Processing file: MOD11_L2.hdf...
 Copyright (C) 1995-2017 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.5.0 -29Mar2018_0148
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
C*lassic mode NetCDf* does not support unsigned integer types: *LST will be
written as type short*
Classic mode NetCDf does not support unsigned integer types: QC will be
written as type short
Classic mode NetCDf does not support unsigned integer types: Error_LST will
be written as type byte
Classic mode NetCDf does not support unsigned integer types: Emis_31 will
be written as type byte
Classic mode NetCDf does not support unsigned integer types: Emis_32 will
be written as type byte
Classic mode NetCDf does not support unsigned integer types: View_angle
will be written as type byte
Classic mode NetCDf does not support unsigned integer types: View_time will
be written as type byte



On Tue, Feb 19, 2019 at 8:28 AM Vanúcia Schumacher <
vanucia-schumacher at hotmail.com> wrote:

> Hi NCL team
>
> I would like to convert data in hdf to netcdf.
> I tried to use ncl_convert2nc, but it did not work:
>
> Classic mode NetCDf does not support unsigned integer types: LST will be
> written as type short
> Classic mode NetCDf does not support unsigned integer types: QC will be
> written as type short
> Classic mode NetCDf does not support unsigned integer types: Error_LST
> will be written as type byte
> Classic mode NetCDf does not support unsigned integer types: Emis_31 will
> be written as type byte
> Classic mode NetCDf does not support unsigned integer types: Emis_32 will
> be written as type byte
> Classic mode NetCDf does not support unsigned integer types: View_angle
> will be written as type byte
> Classic mode NetCDf does not support unsigned integer types: View_time
> will be written as type byte
>
> I also tried this and it did not work (data attached):
>
>    fils = ("MOD11_L2.hdf")
>       f = addfile(fils, "r")
>     var = short2flt_hdf(f->LST)
>              printVarSummary(var)
> var!0   = "lat"
> var!1   = "lon"
> ...
>
> var original:
> Type: float
> Total Size: 11102800 bytes
>             2775700 values
> Number of Dimensions: 2
> Dimensions and sizes: [Along_swath_lines_1km_MOD_Swath_LST | 2050] x
> [Cross_swath_pixels_1km_MOD_Swath_LST | 1354]
> Coordinates:
> Number Of Attributes: 11
>   long_name : Land-surface Temperature
>   units : K
>   Number_Type : uint16
>   valid_range : ( 7500, 65535 )
>   LST : LST data * scale_factor
>   scale_factor_err :    0
>   add_offset_err :    0
>   calibrated_nt : 5
>   hdf_name : LST
>   _FillValue_original : 0
>   _FillValue :  0
>
>
> Variable: new_var
> Type: float
> Total Size: 11102800 bytes
>             2775700 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat | 2050] x [lon | 1354]
> Coordinates:
> Number Of Attributes: 11
>   long_name : Land-surface Temperature
>   units : K
>   Number_Type : uint16
>   valid_range : ( 7500, 65535 )
>   LST : LST data * scale_factor
>   scale_factor_err :    0
>   add_offset_err :    0
>   calibrated_nt : 5
>   hdf_name : LST
>   _FillValue_original : 0
>   _FillValue :  0
>
> Variable: new_var
> Type: float
> Total Size: 11102800 bytes
>             2775700 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat | 2050] x [lon | 1354]
> Coordinates:
> Number Of Attributes: 11
>   _FillValue :  0
>   _FillValue_original : 0
>   hdf_name : LST
>   calibrated_nt : 5
>   add_offset_err :    0
>   scale_factor_err :    0
>   LST : LST data * scale_factor
>   valid_range : ( 7500, 65535 )
>   Number_Type : uint16
>   units : K
>   long_name : Land-surface Temperature
>
>
> warning:Argument 0 of the current function or procedure was coerced to the
> appropriate type and thus will not change if the function or procedure
> modifies its value
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190219/e9309cc0/attachment.html>


More information about the ncl-talk mailing list