HDF Home 
hdiff

hdiff examples

This page describes some examples of use and the output of hdiff. The basic usage of the tool is described on the hdiff syntax page.

These examples use the files hdifftst1.hdf and hdifftst2.hdf

The table in hdiff_hdp.html shows the hdp output of the sds and vdata in the files.


Example: 1.0
Command: hdiff -g hdifftst1.hdf hdifftst2.hdf
Notes:  Compare global attributes only
Output: 

$hdiff -g hdifftst1.hdf hdifftst2.hdf
*****     Global attributes comparison:     *****
---------------------------
Attr Name: File_contents
< "Storm_track_data1"
> "Storm_track_data2"
 

Example: 1.1
Command: hdiff -s hdifftst1.hdf hdifftst2.hdf
Notes:  Compare SD local attributes only
Output: 

$hdiff -s hdifftst1.hdf hdifftst2.hdf
*****     SD attributes comparison:     *****
---------------------------
SD Name: dset1
<<<<
Dimension: (3, 2) ;
	dset1:Valid_range = 1.f, 1.f ;
>>>>
Dimension: (3, 2) ;
	dset1:Valid_range = 1.f, 2.f ;

 


Example: 1.2
Command: hdiff -d hdifftst1.hdf hdifftst2.hdf
Notes:  Compare SD data only
Output: 

$hdiff -d hdifftst1.hdf hdifftst2.hdf
*****     SD Data comparison:     *****
---------------------------
SD Name: dset1 .... Comparing
Index: 1,   File1: 1,   File2: 2
Index: 2,   File1: 1,   File2: 3
Index: 3,   File1: 1,   File2: 4
---------------------------
SD Name: dset2 .... Comparing
Index: 1,   File1: 1,   File2: 2
Index: 2,   File1: 1,   File2: 3
Index: 3,   File1: 1,   File2: 4

 


Example: 1.3
Command: hdiff -D hdifftst1.hdf hdifftst2.hdf
Notes:  Compare Vdata data only
Output: 

$hdiff -D hdifftst1.hdf hdifftst2.hdf
*****     Vdata comparison:     *****
*****     Vdata comparison:     *****
Comparing... vdata1
---------------------------
Vdata Name: vdata1 (Data record comparison)
> 0: V
< 0: X
Comparing... vdata2
---------------------------
Vdata Name: vdata2 (Data record comparison)
> 0: 1 2 3 4 
< 0: 1 1 1 1 
Comparing... vdata3
---------------------------
Vdata Name: vdata3 (Data record comparison)
> 0: 1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 
< 0: 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 

 


Example: 1.4
Command: $hdiff -d -S hdifftst1.hdf hdifftst2.hdf
Notes:  Print statistics
Output: 

$hdiff -d -S hdifftst1.hdf hdifftst2.hdf
*****     SD Data comparison:     *****
---------------------------
SD Name: dset1 .... Comparing
Index: 1,   File1: 1,   File2: 2
Index: 2,   File1: 1,   File2: 3
Index: 3,   File1: 1,   File2: 4
Type: Integer4  Npts: 6  Ndiff: 3 (50.000000%)
Avg Diff: 1.000000e+00   Max. Diff: 3
Range File1: 1/6  File2: 1/6
Regression  N: 6  Slope: 6.727273e-01  Intercept: 1.818182e+00  R: 8.433083e-01
---------------------------
SD Name: dset2 .... Comparing
Index: 1,   File1: 1,   File2: 2
Index: 2,   File1: 1,   File2: 3
Index: 3,   File1: 1,   File2: 4
Type: Integer4  Npts: 6  Ndiff: 3 (50.000000%)
Avg Diff: 1.000000e+00   Max. Diff: 3
Range File1: 1/6  File2: 1/6
Regression  N: 6  Slope: 6.727273e-01  Intercept: 1.818182e+00  R: 8.433083e-01

 


Example: 1.5
Command: hdiff -d -v dset1 hdifftst1.hdf hdifftst2.hdf
Notes:  Compare SD data on variable(s) <var1>,... only
Output: 

$hdiff -d -v dset1 hdifftst1.hdf hdifftst2.hdf
*****     SD Data comparison:     *****
---------------------------
SD Name: dset1 .... Comparing
Index: 1,   File1: 1,   File2: 2
Index: 2,   File1: 1,   File2: 3
Index: 3,   File1: 1,   File2: 4

Example: 1.6
Command: hdiff -D -u vdata1 hdifftst1.hdf hdifftst2.hdf
Notes:  Compare vdata on variable(s) <var1>,... only
Output: 

$hdiff -D -u vdata1 hdifftst1.hdf hdifftst2.hdf
*****     Vdata comparison:     *****
*****     Vdata comparison:     *****
Comparing... vdata1
---------------------------
Vdata Name: vdata1 (Data record comparison)
> 0: V
< 0: X

Example: 1.7
Command: hdiff -d -e 2 hdifftst1.hdf hdifftst2.hdf
Notes:  Print difference up to count number for each variable
Output: 

$hdiff -d -e 2 hdifftst1.hdf hdifftst2.hdf
*****     SD Data comparison:     *****
---------------------------
SD Name: dset1 .... Comparing
Index: 1,   File1: 1,   File2: 2
Index: 2,   File1: 1,   File2: 3
---------------------------
SD Name: dset2 .... Comparing
Index: 1,   File1: 1,   File2: 2
Index: 2,   File1: 1,   File2: 3
 

Example: 1.8
Command: hdiff -d -t 2 hdifftst1.hdf hdifftst2.hdf
Notes:  Print difference when it is greater than limit
Output: 

$hdiff -d -t 2 hdifftst1.hdf hdifftst2.hdf
*****     SD Data comparison:     *****
---------------------------
SD Name: dset1 .... Comparing
Index: 3,   File1: 1,   File2: 4
---------------------------
SD Name: dset2 .... Comparing
Index: 3,   File1: 1,   File2: 4
 

HDF Help Desk
Last modified: June 18, 2003
Describes hdiff examples