You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
#if 'auto' version, check the CF version in the file
#if none found, use the default
ifnotself.version:
self.version=self.getFileCFVersion()
ifnotself.version:
self._add_warn("Cannot determine CF version from the Conventions attribute; checking against latest CF version: %s"%newest_version)
self.version=newest_version
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.
The text was updated successfully, but these errors were encountered:
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 theif
-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 themain
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 theinst.get_total_counts()
, but I haven't looked into it.The text was updated successfully, but these errors were encountered: