@@ -53,17 +53,17 @@ def print_var_content(table_config_file: IO[str],
5353
5454 table_name = None
5555 try :
56- table_name = proj_table_vars [" Header" ].get ('table_id' ).split (' ' )[1 ]
56+ table_name = proj_table_vars [' Header' ].get ('table_id' ).split (' ' )[1 ]
5757 except KeyError :
58- fre_logger .warning (" couldn't get header and table_name field" )
58+ fre_logger .warning (' couldn\ ' t get header and table_name field' )
5959
6060 if table_name is not None :
6161 fre_logger .info ('looking for %s data in table %s!' , var_name , table_name )
6262 else :
6363 fre_logger .info ('looking for %s data in table %s, but could not find its table_name!' ,
6464 var_name , table_config_file .name )
6565
66- var_content = proj_table_vars .get (" variable_entry" , {}).get (var_name )
66+ var_content = proj_table_vars .get (' variable_entry' , {}).get (var_name )
6767 if var_content is None :
6868 fre_logger .debug ('variable %s not found in %s, moving on!' , var_name , Path (table_config_file .name ).name )
6969 return
@@ -107,7 +107,7 @@ def cmor_find_subtool( json_var_list: Optional[str] = None,
107107
108108 var_list = None
109109 if json_var_list is not None :
110- with open (json_var_list , "r" , encoding = " utf-8" ) as var_list_file :
110+ with open (json_var_list , 'r' , encoding = ' utf-8' ) as var_list_file :
111111 var_list = json .load (var_list_file )
112112
113113 if opt_var_name is None and var_list is None :
@@ -116,14 +116,14 @@ def cmor_find_subtool( json_var_list: Optional[str] = None,
116116 if opt_var_name is not None :
117117 fre_logger .info ('opt_var_name is not None: looking for only ONE variables worth of info!' )
118118 for json_table_config in json_table_configs :
119- with open (json_table_config , "r" , encoding = " utf-8" ) as table_config_file :
119+ with open (json_table_config , 'r' , encoding = ' utf-8' ) as table_config_file :
120120 print_var_content (table_config_file , opt_var_name )
121121
122122 elif var_list is not None :
123123 fre_logger .info ('opt_var_name is None, and var_list is not None, looking for many variables worth of info!' )
124124 for var in var_list :
125125 for json_table_config in json_table_configs :
126- with open (json_table_config , "r" , encoding = " utf-8" ) as table_config_file :
126+ with open (json_table_config , 'r' , encoding = ' utf-8' ) as table_config_file :
127127 print_var_content (table_config_file , str (var_list [var ]))
128128
129129
@@ -132,7 +132,7 @@ def make_simple_varlist( dir_targ: str,
132132 json_mip_table : Optional [str ] = None ) -> Optional [Dict [str , str ]]:
133133 """
134134 Generate a JSON file containing a list of variable names from NetCDF files in a specified directory.
135- This function searches for NetCDF files in the given directory, or a subdirectory, " ts/monthly/5yr" ,
135+ This function searches for NetCDF files in the given directory, or a subdirectory, ' ts/monthly/5yr' ,
136136 if not already included. It then extracts variable names from the filenames, and writes these variable
137137 names to a JSON file.
138138
@@ -154,22 +154,22 @@ def make_simple_varlist( dir_targ: str,
154154
155155 """
156156 # if the variable is in the filename, it's likely delimited by another period.
157- all_nc_files = glob .glob (os .path .join (dir_targ , " *.*.nc" ))
157+ all_nc_files = glob .glob (os .path .join (dir_targ , ' *.*.nc' ))
158158 if not all_nc_files :
159- fre_logger .error (" No files found in the directory." ) #uncovered
159+ fre_logger .error (' No files found in the directory.' ) #uncovered
160160 return None
161161
162162 if len (all_nc_files ) == 1 :
163- fre_logger .warning (" Warning: Only one file found matching the pattern." )
163+ fre_logger .warning (' Warning: Only one file found matching the pattern.' )
164164
165- fre_logger .info (" Files found matching pattern. Number of files: %d" , len (all_nc_files ))
165+ fre_logger .info (' Files found matching pattern. Number of files: %d' , len (all_nc_files ))
166166
167167 mip_vars = None
168168 if json_mip_table is not None :
169169 try :
170170 # read in mip vars to check against later
171171 fre_logger .debug ('attempting to read in variable entries in specified mip table' )
172- full_mip_vars_list = get_json_file_data (json_mip_table )[" variable_entry" ].keys ()
172+ full_mip_vars_list = get_json_file_data (json_mip_table )[' variable_entry' ].keys ()
173173
174174 except Exception as exc :
175175 raise Exception ( 'problem opening mip table and getting variable entry data.'
0 commit comments