Comparing 2 HAR or SL4 files


ViewHAR can display the differences between numbers on two files that you select.

You could use this feature either for checking differences between two files, or perhaps to compute results as the difference between quantities on the initial and updated datafiles used in some simulation.

Differences are only shown for real headers that have the same header and same dimensions on both files.

You can choose for the output file to contain original values and/or differences. Differences are displayed as:

ordinary changes = File1-File2

absolute differences = Abs(File1-File2)

percent changes = 100*[File1-File2] / File2

difference metrics = Abs(File1-File2) / Max{1, Min[Abs(File1), Abs(File2)] }

In the first and 3rd cases, the order of File1 and File2 is relevant. If there is a clear before-versus-after interpretation, you may wish to set:

File1 = After.HAR

File2 = Before.HAR

The output appears as a new HAR file that exists in memory only. You need to explicitly save it if you want to preserve it for later.

If you select original values or several types of change for output, ViewHAR adds a new dimension [File1, File2, OrdDiff, PctDiff, DiffMet] to each array. Since the maximum numbers of dimensions is 7, arrays which originally had 7 dimensions cannot be shown in this case. To see these, you would need to select just one of [OrdDiff, AbsDiff, PctDiff, DiffMet].

There is a command-line program, DiffHAR, that does the same job.

Comparing SL4 files

You can also see the difference between 2 SL4 files -- as long as both files come from the same model. In this case the original values will be percent change results (or sometimes ordinary change results), and it will make little sense to select the PctDiff option.

Difference metrics

While percentage differences are more suitable for comparing larger numbers, for smaller numbers ordinary differences are more suitable -- especially if one number is zero! The difference metric, also used in the CMPHAR program, is a measure of difference that is designed to marry the advantages of percentage and ordinary differences. For numbers V1 and V2, it is calculated as:

If either V1 or V2 is less than 1 in absolute value, the difference metric is just the absolute difference.

Otherwise (that is, if both V1 and V2 are at least 1 in absolute value), the difference metric is equal to Abs(V1-V2) / Min[ Abs(V1), Abs(V2) ].

Or we could write: D:= Abs(V1-V2) / Max{ 1, Min[ Abs(V1), Abs(V2) ] }

The GEMPACK manual gpmanual.htm gives more details -- look in the Index under "difference metric".



URL of this topic: www.copsmodels.com/webhelp/viewhar/hc_compare.htm

Link to full GEMPACK Manual

Link to GEMPACK homepage