You are here: home pagemax_diff_nc.

What is it?

This is a program which compares two NetCDF files. Only NetCDF variables with type nf90_float or nf90_double are compared. The program either compares variables with the same NetCDF ID (varid) or variables with the same name. Compared variables are assumed to have the same type and shape. For each such couple of variables, the program computes the maximum of the absolute value of the difference, and the maximum of the absolute value of the relative difference. The program also tells you at what location (the subscript list of the array) the maximum difference is reached.

How does it compare with other similar utilities?




Maximum memory used will normally be:

But memory used may increase with the optimization level you choose when you compile max_diff_nc.

There is a known problem in older versions of Gfortran, fixed in version 4.4.5 of Gfortran. The program max_diff_nc prints differences with the Fortran format 1pg7.1. Older versions of Gfortran produce wrong results with this format. For example, according to the Fortran 95 standard, printing the number 0.96 with the format 1pg7.1 should give the same result than with format f3.0. Thus, the result should be 1., but Gfortran produces the surprising result 0. If you cannot use another compiler, a work-around is to change 1pg7.1 to 1pg8.2 in the file compare.f90.