NSF Unidata

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HDF 4 > ncml?

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.



Thanks Peter. The HDF4 reading is new, so if anyone sees something that looks
funny compared to the original file, please let me know.

Peter Hollemans wrote:
Hi John,

I didn't know that the latest Java netCDF could read HDF-4!  I did a
dump of a CoastWatch file for Ted:

phollema@bean<Downloads> java -cp toolsUI-4.0.jar ucar.nc2.NCdump
$HOME/Data/2006_249_2137_n18_wn.hdf -ncml
log4j:WARN No appenders could be found for logger (ucar.nc2.NetcdfFile).
log4j:WARN Please initialize the log4j system properly.
<?xml version='1.0' encoding='UTF-8'?>
<netcdf xmlns='http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2'
    location='file:/Users/phollema/Data/2006_249_2137_n18_wn.hdf' >

  <dimension name='rows' length='1024' />
  <dimension name='cols' length='1024' />

  <attribute name='satellite' value='noaa-18' />
  <attribute name='sensor' value='avhrr' />
  <attribute name='origin' value='USDOC/NOAA/NESDIS CoastWatch' />
  <attribute name='cwhdf_version' value='3.4' />
  <attribute name='pass_type' value='day' />
  <attribute name='pass_date' value='13397 ' type='int' />
  <attribute name='start_time' value='77824.0 ' type='double' />
  <attribute name='projection_type' value='mapped' />
  <attribute name='projection' value='Mercator' />
  <attribute name='gctp_sys' value='5 ' type='int' />
  <attribute name='gctp_zone' value='0 ' type='int' />
  <attribute name='gctp_parm' value='0.0  0.0  0.0  0.0  0.0  0.0
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0 ' type='double' />
  <attribute name='gctp_datum' value='12 ' type='int' />
  <attribute name='et_affine' value='0.0  -1470.0  1470.0  0.0
-1.5028629694237337E7  6343200.918551117 ' type='double' />
  <attribute name='rows' value='1024 ' type='int' />
  <attribute name='cols' value='1024 ' type='int' />
  <attribute name='polygon_latitude' value='49.59106659023744
49.59106659023744  49.59106659023744  49.59106659023744
49.59106659023744  47.3457234175452  44.99999999998704
42.55345611162261  40.00635240249667  40.00635240249667
40.00635240249667  40.00635240249667  40.00635240249667
42.55345611162261  44.99999999998704  47.3457234175452
49.59106659023744 ' type='double' />
  <attribute name='polygon_longitude' value='-135.0044775370589
-131.62723876852945  -128.25  -124.87276123147056
-121.49552246294114  -121.49552246294114  -121.49552246294114
-121.49552246294114  -121.49552246294114  -124.87276123147056
-128.25  -131.62723876852945  -135.0044775370589  -135.0044775370589
-135.0044775370589  -135.0044775370589  -135.0044775370589 '
type='double' />
  <attribute name='history' value='[cwf 3.1.10-pre] cwimport
product.tshdf product.hdf' />
  <attribute name='History' value='Direct read of HDF4 file through
CDM library' />
  <attribute name='HDF4_Version' value='4.1.5 (NCSA HDF Version 4.1
Release 5, November 5, 2001)' />

  <variable name='avhrr_ch1' type='short' shape='rows cols' >
    <attribute name='long_name' value='avhrr_ch1' />
    <attribute name='units' value='percent' />
    <attribute name='coordsys' value='Mercator' />
    <attribute name='_FillValue' value='-32768 ' type='short' />
    <attribute name='missing_value' value='-32768 ' type='short' />
    <attribute name='scale_factor' value='0.01 ' type='double' />
    <attribute name='scale_factor_err' value='0.0 ' type='double' />
    <attribute name='add_offset' value='0.0 ' type='double' />
    <attribute name='add_offset_err' value='0.0 ' type='double' />
    <attribute name='calibrated_nt' value='0 ' type='int' />
    <attribute name='fraction_digits' value='2 ' type='int' />
  </variable>
  <variable name='avhrr_ch2' type='short' shape='rows cols' >
    <attribute name='long_name' value='avhrr_ch2' />
    <attribute name='units' value='percent' />
    <attribute name='coordsys' value='Mercator' />
    <attribute name='_FillValue' value='-32768 ' type='short' />
    <attribute name='missing_value' value='-32768 ' type='short' />
    <attribute name='scale_factor' value='0.01 ' type='double' />
    <attribute name='scale_factor_err' value='0.0 ' type='double' />
    <attribute name='add_offset' value='0.0 ' type='double' />
    <attribute name='add_offset_err' value='0.0 ' type='double' />
    <attribute name='calibrated_nt' value='0 ' type='int' />
    <attribute name='fraction_digits' value='2 ' type='int' />
  </variable>
  <variable name='avhrr_ch3' type='short' shape='rows cols' >
    <attribute name='long_name' value='avhrr_ch3' />
    <attribute name='units' value='celsius' />
    <attribute name='coordsys' value='Mercator' />
    <attribute name='_FillValue' value='-32768 ' type='short' />
    <attribute name='missing_value' value='-32768 ' type='short' />
    <attribute name='scale_factor' value='0.01 ' type='double' />
    <attribute name='scale_factor_err' value='0.0 ' type='double' />
    <attribute name='add_offset' value='0.0 ' type='double' />
    <attribute name='add_offset_err' value='0.0 ' type='double' />
    <attribute name='calibrated_nt' value='0 ' type='int' />
    <attribute name='fraction_digits' value='2 ' type='int' />
  </variable>
  <variable name='avhrr_ch4' type='short' shape='rows cols' >
    <attribute name='long_name' value='avhrr_ch4' />
    <attribute name='units' value='celsius' />
    <attribute name='coordsys' value='Mercator' />
    <attribute name='_FillValue' value='-32768 ' type='short' />
    <attribute name='missing_value' value='-32768 ' type='short' />
    <attribute name='scale_factor' value='0.01 ' type='double' />
    <attribute name='scale_factor_err' value='0.0 ' type='double' />
    <attribute name='add_offset' value='0.0 ' type='double' />
    <attribute name='add_offset_err' value='0.0 ' type='double' />
    <attribute name='calibrated_nt' value='0 ' type='int' />
    <attribute name='fraction_digits' value='2 ' type='int' />
    <attribute name='nav_affine' value='1.0  0.0  0.0  1.0  0.0  0.0 '
type='double' />
  </variable>
  <variable name='avhrr_ch5' type='short' shape='rows cols' >
    <attribute name='long_name' value='avhrr_ch5' />
    <attribute name='units' value='celsius' />
    <attribute name='coordsys' value='Mercator' />
    <attribute name='_FillValue' value='-32768 ' type='short' />
    <attribute name='missing_value' value='-32768 ' type='short' />
    <attribute name='scale_factor' value='0.01 ' type='double' />
    <attribute name='scale_factor_err' value='0.0 ' type='double' />
    <attribute name='add_offset' value='0.0 ' type='double' />
    <attribute name='add_offset_err' value='0.0 ' type='double' />
    <attribute name='calibrated_nt' value='0 ' type='int' />
    <attribute name='fraction_digits' value='2 ' type='int' />
  </variable>
  <variable name='cloud' type='byte' shape='rows cols' >
    <attribute name='_unsigned' value='true' />
    <attribute name='long_name' value='cloud' />
    <attribute name='coordsys' value='Mercator' />
    <attribute name='_FillValue' value='0 ' type='byte' />
    <attribute name='missing_value' value='0 ' type='byte' />
    <attribute name='scale_factor' value='1.0 ' type='double' />
    <attribute name='scale_factor_err' value='0.0 ' type='double' />
    <attribute name='add_offset' value='0.0 ' type='double' />
    <attribute name='add_offset_err' value='0.0 ' type='double' />
    <attribute name='calibrated_nt' value='0 ' type='int' />
    <attribute name='fraction_digits' value='1 ' type='int' />
  </variable>
  <variable name='graphics' type='byte' shape='rows cols' >
    <attribute name='_unsigned' value='true' />
    <attribute name='long_name' value='graphics' />
    <attribute name='coordsys' value='Mercator' />
    <attribute name='_FillValue' value='0 ' type='byte' />
    <attribute name='missing_value' value='0 ' type='byte' />
    <attribute name='scale_factor' value='1.0 ' type='double' />
    <attribute name='scale_factor_err' value='0.0 ' type='double' />
    <attribute name='add_offset' value='0.0 ' type='double' />
    <attribute name='add_offset_err' value='0.0 ' type='double' />
    <attribute name='calibrated_nt' value='0 ' type='int' />
    <attribute name='fraction_digits' value='1 ' type='int' />
  </variable>
  <variable name='rel_azimuth' type='short' shape='rows cols' >
    <attribute name='long_name' value='rel_azimuth' />
    <attribute name='units' value='degrees' />
    <attribute name='coordsys' value='Mercator' />
    <attribute name='_FillValue' value='-32768 ' type='short' />
    <attribute name='missing_value' value='-32768 ' type='short' />
    <attribute name='scale_factor' value='0.01 ' type='double' />
    <attribute name='scale_factor_err' value='0.0 ' type='double' />
    <attribute name='add_offset' value='0.0 ' type='double' />
    <attribute name='add_offset_err' value='0.0 ' type='double' />
    <attribute name='calibrated_nt' value='0 ' type='int' />
    <attribute name='fraction_digits' value='2 ' type='int' />
  </variable>
  <variable name='sat_zenith' type='short' shape='rows cols' >
    <attribute name='long_name' value='sat_zenith' />
    <attribute name='units' value='degrees' />
    <attribute name='coordsys' value='Mercator' />
    <attribute name='_FillValue' value='-32768 ' type='short' />
    <attribute name='missing_value' value='-32768 ' type='short' />
    <attribute name='scale_factor' value='0.01 ' type='double' />
    <attribute name='scale_factor_err' value='0.0 ' type='double' />
    <attribute name='add_offset' value='0.0 ' type='double' />
    <attribute name='add_offset_err' value='0.0 ' type='double' />
    <attribute name='calibrated_nt' value='0 ' type='int' />
    <attribute name='fraction_digits' value='2 ' type='int' />
  </variable>
  <variable name='sst' type='short' shape='rows cols' >
    <attribute name='long_name' value='sst' />
    <attribute name='units' value='celsius' />
    <attribute name='coordsys' value='Mercator' />
    <attribute name='_FillValue' value='-32768 ' type='short' />
    <attribute name='missing_value' value='-32768 ' type='short' />
    <attribute name='scale_factor' value='0.01 ' type='double' />
    <attribute name='scale_factor_err' value='0.0 ' type='double' />
    <attribute name='add_offset' value='0.0 ' type='double' />
    <attribute name='add_offset_err' value='0.0 ' type='double' />
    <attribute name='calibrated_nt' value='0 ' type='int' />
    <attribute name='fraction_digits' value='2 ' type='int' />
  </variable>
  <variable name='sun_zenith' type='short' shape='rows cols' >
    <attribute name='long_name' value='sun_zenith' />
    <attribute name='units' value='degrees' />
    <attribute name='coordsys' value='Mercator' />
    <attribute name='_FillValue' value='-32768 ' type='short' />
    <attribute name='missing_value' value='-32768 ' type='short' />
    <attribute name='scale_factor' value='0.01 ' type='double' />
    <attribute name='scale_factor_err' value='0.0 ' type='double' />
    <attribute name='add_offset' value='0.0 ' type='double' />
    <attribute name='add_offset_err' value='0.0 ' type='double' />
    <attribute name='calibrated_nt' value='0 ' type='int' />
    <attribute name='fraction_digits' value='2 ' type='int' />
  </variable>
</netcdf>
phollema@bean<Downloads>




Best regards,
Peter

--
Peter Hollemans, Terrenus Earth Sciences
Consultant for the NOAA/NESDIS CoastWatch Program
Phone: (250) 478-1006
Email: address@hidden




On 3-Aug-08, at 4:28 PM, John Caron wrote:

Hi Ted:

Look at "NcML as output" section in
http://www.unidata.ucar.edu/software/netcdf/ncml/. Be sure to use the
latest version of Netcdf-Java version 4.0 to read HDF-4 files.

However you cant use ncdump -x, because the netCDF C library doesnt
read HDF-4 files. Im guessing Peter and Mike are talking about a
version of ncdump supplied by hdfgroup.org?

Ted Habermann wrote:
Hello All,
The NOAA CoastWatch Program provides data in HDF4 files which include
a bunch of high-quality metadata (attributes) that I would like to
extract. Seems like a good idea to extract them in XML, maybe even a
better idea to extract them in NCML. I figured you guys would know if
a tool existed to do this...
Ted