<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
Hi NCL team,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<div style="margin: 0px; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; background-color: rgb(255, 255, 255)">
<span>I </span>would like to convert hdf data to netcdf. <br>
</div>
<div style="margin: 0px; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; background-color: rgb(255, 255, 255)">
I tried to use ncl_convert2nc, but it did not work:<br>
</div>
<div style="margin: 0px; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; background-color: rgb(255, 255, 255)">
<br>
</div>
<div style="margin: 0px; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; background-color: rgb(255, 255, 255)">
<span style="margin: 0px">Classic mode NetCDf does not support unsigned integer types: LST will be written as type short<br>
</span>
<div style="margin: 0px">Classic mode NetCDf does not support unsigned integer types: QC will be written as type short<br>
</div>
<div style="margin: 0px">Classic mode NetCDf does not support unsigned integer types: Error_LST will be written as type byte<br>
</div>
<div style="margin: 0px">Classic mode NetCDf does not support unsigned integer types: Emis_31 will be written as type byte<br>
</div>
<div style="margin: 0px">Classic mode NetCDf does not support unsigned integer types: Emis_32 will be written as type byte<br>
</div>
<div style="margin: 0px">Classic mode NetCDf does not support unsigned integer types: View_angle will be written as type byte<br>
</div>
<div style="margin: 0px">Classic mode NetCDf does not support unsigned integer types: View_time will be written as type byte<br>
</div>
<span style="margin: 0px"></span><br>
</div>
<div style="margin: 0px; font-size: 14pt; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; background-color: rgb(255, 255, 255)">
I also tried this script and it did not work</div>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<span> fils = ("MOD11_L2.A2008009.0435.006.2015337174400.hdf") <br>
</span>
<div> f = addfile(fils, "r") </div>
<div> var = short2flt_hdf(f->LST) </div>
<div> lat2d = f->Latitude<br>
</div>
<div> lon2d = f->Longitude<br>
</div>
<div> </div>
<div>var!0 = "latitude"<br>
</div>
<div>var!1 = "longitude"<br>
</div>
<div>var&latitude = lat2d(:,0)<br>
</div>
<div>var&longitude = lon2d(0,:)</div>
<div>var@lat2d = lat2d<br>
</div>
<div>var@lon2d = lon2d<br>
</div>
<div> <br>
</div>
<div>newfile = "of.nc" <br>
</div>
<div>new_var = var </div>
<div>file_create = addfile(newfile, "c") </div>
<div>file_create->LST= new_var <br>
</div>
<div><br>
</div>
<span>fatal:Coordinate variables must have one dimension only<br>
</span>
<div>fatal:No coordinate variable exists for dimension (latitude) in variable (var)<br>
</div>
<span></span><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
print(f):</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<span> identifier_product_doi : 10.5067/MODIS/MOD11_L2.006<br>
</span>
<div> identifier_product_doi_authority : http://dx.doi.org<br>
</div>
<div> dimensions:<br>
</div>
<div> Coarse_swath_lines_5km_MOD_Swath_LST = 410<br>
</div>
<div> Coarse_swath_pixels_5km_MOD_Swath_LST = 271<br>
</div>
<div> Along_swath_lines_1km_MOD_Swath_LST = 2050<br>
</div>
<div> Cross_swath_pixels_1km_MOD_Swath_LST = 1354<br>
</div>
<div> variables:<br>
</div>
<div> float Latitude ( Coarse_swath_lines_5km_MOD_Swath_LST, Coarse_swath_pixels_5km_MOD_Swath_LST )<br>
</div>
<div> long_name : Latitude of every 5 scan lines and 5 pixels<br>
</div>
<div> units : degree<br>
</div>
<div> Number_Type : float32<br>
</div>
<div> valid_range : ( -90, 90 )<br>
</div>
<div> _FillValue : -999<br>
</div>
<div> Cell_Along_Swath_Sampling : 3, 2048, 5<br>
</div>
<div> Cell_Across_Swath_Sampling : 3, 1353, 5<br>
</div>
<div> hdf_name : Latitude<br>
</div>
<div><br>
</div>
<div> float Longitude ( Coarse_swath_lines_5km_MOD_Swath_LST, Coarse_swath_pixels_5km_MOD_Swath_LST )<br>
</div>
<div> long_name : Longitude of every 5 scan lines and 5 pixels<br>
</div>
<div> units : degree<br>
</div>
<div> Number_Type : float32<br>
</div>
<div> valid_range : ( -180, 180 )<br>
</div>
<div> _FillValue : -999<br>
</div>
<div> Cell_Along_Swath_Sampling : 3, 2048, 5<br>
</div>
<div> Cell_Across_Swath_Sampling : 3, 1353, 5<br>
</div>
<div> hdf_name : Longitude<br>
</div>
<div><br>
</div>
<div> ushort LST ( Along_swath_lines_1km_MOD_Swath_LST, Cross_swath_pixels_1km_MOD_Swath_LST )<br>
</div>
<div> long_name : Land-surface Temperature<br>
</div>
<div> units : K<br>
</div>
<div> Number_Type : uint16<br>
</div>
<div> valid_range : ( 7500, 65535 )<br>
</div>
<div> _FillValue : 0<br>
</div>
<div> LST : LST data * scale_factor<br>
</div>
<div> scale_factor : 0.02<br>
</div>
<div> add_offset : 0<br>
</div>
<div> scale_factor_err : 0<br>
</div>
<div> add_offset_err : 0<br>
</div>
<div> calibrated_nt : 5<br>
</div>
<div> hdf_name : LST<br>
</div>
<div><br>
</div>
<div> ushort QC ( Along_swath_lines_1km_MOD_Swath_LST, Cross_swath_pixels_1km_MOD_Swath_LST )<br>
</div>
<div> long_name : Quality control for daytime LST and emissivity<br>
</div>
<div> Number_Type : uint16<br>
</div>
<div> valid_range : ( 0, 65535 )<br>
</div>
<div> hdf_name : QC<br>
</div>
<div><br>
</div>
<div> ubyte Error_LST ( Along_swath_lines_1km_MOD_Swath_LST, Cross_swath_pixels_1km_MOD_Swath_LST )<br>
</div>
<div> long_name : Land-surface Temperature Error<br>
</div>
<div> units : K<br>
</div>
<div> Number_Type : uint8<br>
</div>
<div> valid_range : ( 1, 255 )<br>
</div>
<div> _FillValue : 0<br>
</div>
<div> Error_LST : Error_LST data * scale_factor<br>
</div>
<div> scale_factor : 0.04<br>
</div>
<div> add_offset : 0<br>
</div>
<div> scale_factor_err : 0<br>
</div>
<div> add_offset_err : 0<br>
</div>
<div> calibrated_nt : 5<br>
</div>
<div> hdf_name : Error_LST<br>
</div>
<div><br>
</div>
<div> ubyte Emis_31 ( Along_swath_lines_1km_MOD_Swath_LST, Cross_swath_pixels_1km_MOD_Swath_LST )<br>
</div>
<div> long_name : Band 31 emissivity<br>
</div>
<div> Number_Type : uint8<br>
</div>
<div> valid_range : ( 1, 255 )<br>
</div>
<div> _FillValue : 0<br>
</div>
<div> Emis_31 : Emis_31 data * scale_factor + add_offset<br>
</div>
<div> scale_factor : 0.002<br>
</div>
<div> add_offset : 0.49<br>
</div>
<div> scale_factor_err : 0<br>
</div>
<div> add_offset_err : 0<br>
</div>
<div> calibrated_nt : 5<br>
</div>
<div> hdf_name : Emis_31<br>
</div>
<div><br>
</div>
<div> ubyte Emis_32 ( Along_swath_lines_1km_MOD_Swath_LST, Cross_swath_pixels_1km_MOD_Swath_LST )<br>
</div>
<div> long_name : Band 32 emissivity<br>
</div>
<div> Number_Type : uint8<br>
</div>
<div> valid_range : ( 1, 255 )<br>
</div>
<div> _FillValue : 0<br>
</div>
<div> Emis_32 : Emis_32 data * scale_factor + add_offset<br>
</div>
<div> scale_factor : 0.002<br>
</div>
<div> add_offset : 0.49<br>
</div>
<div> scale_factor_err : 0<br>
</div>
<div> add_offset_err : 0<br>
</div>
<div> calibrated_nt : 5<br>
</div>
<div> hdf_name : Emis_32<br>
</div>
<div><br>
</div>
<div> ubyte View_angle ( Along_swath_lines_1km_MOD_Swath_LST, Cross_swath_pixels_1km_MOD_Swath_LST )<br>
</div>
<div> long_name : zenith angle of MODIS viewing at the pixel<br>
</div>
<div> units : deg<br>
</div>
<div> Number_Type : uint8<br>
</div>
<div> valid_range : ( 0, 180 )<br>
</div>
<div> _FillValue : 255<br>
</div>
<div> View_angle : View_angle data * scale_factor<br>
</div>
<div> scale_factor : 0.5<br>
</div>
<div> add_offset : 0<br>
</div>
<div> scale_factor_err : 0<br>
</div>
<div> add_offset_err : 0<br>
</div>
<div> calibrated_nt : 5<br>
</div>
<div> hdf_name : View_angle<br>
</div>
<div><br>
</div>
<div> ubyte View_time ( Along_swath_lines_1km_MOD_Swath_LST, Cross_swath_pixels_1km_MOD_Swath_LST )<br>
</div>
<div> long_name : Time of Land-surface Temperature observation<br>
</div>
<div> units : hrs<br>
</div>
<div> Number_Type : uint8<br>
</div>
<div> valid_range : ( 0, 240 )<br>
</div>
<div> _FillValue : 255<br>
</div>
<div> View_time : View_time data * scale_factor<br>
</div>
<div> scale_factor : 0.1<br>
</div>
<div> add_offset : 0<br>
</div>
<div> scale_factor_err : 0<br>
</div>
<div> add_offset_err : 0<br>
</div>
<div> calibrated_nt : 5<br>
</div>
<div> hdf_name : View_time<br>
</div>
<span></span><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 14pt; color: rgb(0, 0, 0);">
<br>
</div>
</body>
</html>