Wrong detection of CF version when running on multiple files with different CF version
Opened this issue · 0 comments
When running the CF-Checker on multiple files with different CF versions using the auto-detection of the CF version (i.e. cfchecks -v auto file_cf_1_6.nc file_cf_1_7.nc
), the CF-Checker will check for compatibility with the CF version of the first file (in this example CF-1.6 ) for all files given.
The issue is related to the following code snippet:
cf-checker/src/cfchecker/cfchecks.py
Lines 474 to 480 in 3894014
The reason for this is that when the CF-Checker is being run on the first file, self.version
is being set to a vaild CF version. For the second file, self.version
is already set properly, so the code in the if
-statement is not executed, causing the CF version to remain unchanged.
A simple fix would be to put the initialization of the CFChecker
class into the file loop inside the main
function. In this case, self.version
gets reset every time a new file is processed and the CF version will be read from each file, but this could mess up the inst.get_total_counts()
, but I haven't looked into it.