@@ -53,7 +53,7 @@ def extract_overview_output_json(ifile_in):
5353 return summary
5454
5555
56- def extracts_error_summary_cf_check (ifile_in , cf_verion_in , errors_in , warn_in , incorrect_formula_term_error_in ):
56+ def extracts_error_summary_cf_check (ifile_in , cf_verion_in , errors_in , warn_in , cf_to_be_ignored_errors_in ):
5757 """extracts information from given txt file and returns them as a string"""
5858 std_name = 'Using Standard Name Table Version '
5959 with open (ifile_in ) as f :
@@ -62,19 +62,21 @@ def extracts_error_summary_cf_check(ifile_in, cf_verion_in, errors_in, warn_in,
6262 if std_name in line :
6363 std_name_table_out = line .replace (std_name , '' ).split (' ' )[0 ]
6464 if line .startswith ('ERROR:' ):
65- if '4.3.3' not in line :
66- errors_in += 1
65+ if '4.3.3' in line :
66+ cf_to_be_ignored_errors_in ['formula_terms' ] = True
67+ elif 'Invalid attribute name: _CoordinateAxisType' in line :
68+ cf_to_be_ignored_errors_in ['invalid_attribute_name' ] = True
6769 else :
68- incorrect_formula_term_error_in = True
70+ errors_in += 1
6971 elif line .startswith ('WARN:' ):
7072 warn_in += 1
7173 elif line .startswith ('Checking against CF Version ' ):
7274 cf_verion_in .append (line .split ('Checking against CF Version ' )[1 ])
7375
74- return cf_verion_in , errors_in , warn_in , std_name_table_out , incorrect_formula_term_error_in
76+ return cf_verion_in , errors_in , warn_in , std_name_table_out , cf_to_be_ignored_errors_in
7577
7678
77- def write_short_summary (json_summary , cf_version , cf_errors , cf_warns , incorrect_formula_term_error_in ,
79+ def write_short_summary (json_summary , cf_version , cf_errors , cf_warns , cf_to_be_ignored_errors_in ,
7880 file_counter , std_name_table_in , opath_in ):
7981 """create file which contains the short version of the summary"""
8082 prio_dict = {'high_priorities' : 'Mandatory' , 'medium_priorities' : 'Recommended' , 'low_priorities' : 'Optional' }
@@ -136,11 +138,16 @@ def write_short_summary(json_summary, cf_version, cf_errors, cf_warns, incorrect
136138 f"missing, { passed_checks [prio ][3 ]} error(s))\n " )
137139 f .write ("\n " )
138140 if cf_errors is not None :
139- if incorrect_formula_term_error_in :
141+ if cf_to_be_ignored_errors_in . get ( 'formula_terms' , False ) :
140142 f .write (f"CF checker errors: { str (cf_errors )} (Ignoring errors related to formula_terms in boundary "
141143 f"variables. See Known Issues section "
142144 f"https://github.com/AtMoDat/atmodat_data_checker#known-issues )\n " )
143- else :
145+ if cf_to_be_ignored_errors_in .get ('invalid_attribute_name' , False ):
146+ f .write (f"CF checker errors: { str (cf_errors )} (Ignoring errors related to the leading underscore "
147+ f"in the attribute _CoordinateAxisType, which, according to CF convention 2.3 "
148+ f"(Naming Conventions), is recommended but not prohibited.)\n " )
149+ if (not cf_to_be_ignored_errors_in .get ('formula_terms' , False )
150+ and not cf_to_be_ignored_errors_in .get ('invalid_attribute_name' , False )):
144151 f .write (f"CF checker errors: { str (cf_errors )} \n " )
145152 if cf_warns is not None :
146153 f .write (f"CF checker warnings: { str (cf_warns )} " )
@@ -200,12 +207,12 @@ def create_output_summary(file_counter, opath, check_types_in):
200207
201208 std_name_table = None
202209 if 'CF' in check_types_in :
203- incorrect_formula_term_error = False
210+ cf_to_be_ignored_errors_in = { 'formula_terms' : False , 'invalid_attribute_name' : False }
204211 cf_errors , cf_warns = 0 , 0
205212 cf_version = []
206213 else :
207214 cf_errors , cf_warns = None , None
208- incorrect_formula_term_error = None
215+ cf_to_be_ignored_errors_in = None
209216 cf_version = None
210217
211218 files = output_directory .return_files_in_directory_tree (opath )
@@ -214,10 +221,10 @@ def create_output_summary(file_counter, opath, check_types_in):
214221 json_summary = pd .concat ([json_summary , pd .DataFrame .from_dict (extract_overview_output_json (file ),
215222 orient = 'index' ).transpose ()], axis = 0 )
216223 elif file .endswith ("_CF_result.txt" ):
217- cf_version , cf_errors , cf_warns , std_name_table , incorrect_formula_term_error = \
218- extracts_error_summary_cf_check (file , cf_version , cf_errors , cf_warns , incorrect_formula_term_error )
224+ cf_version , cf_errors , cf_warns , std_name_table , cf_to_be_ignored_errors_in = \
225+ extracts_error_summary_cf_check (file , cf_version , cf_errors , cf_warns , cf_to_be_ignored_errors_in )
219226
220- write_short_summary (json_summary , cf_version , cf_errors , cf_warns , incorrect_formula_term_error , file_counter ,
227+ write_short_summary (json_summary , cf_version , cf_errors , cf_warns , cf_to_be_ignored_errors_in , file_counter ,
221228 std_name_table , opath )
222229 write_long_summary (json_summary , opath )
223230 return
0 commit comments