3232except Exception as e :
3333 raise ImportError ('python_colormap module is necessary.' )
3434
35+ import logging
36+ logging .basicConfig (level = logging .ERROR )
37+
3538# generating figure without X server
3639plt .switch_backend ('Agg' )
3740
@@ -189,7 +192,7 @@ def main():
189192 print ('plotting ATT_BETA_1064nm + cloudinfo:' )
190193 display_3d .pollyDisplayATT_BSC_cloudinfo (nc_dict , config_dict , polly_conf_dict , outputfolder , wavelength = 1064 ,donefilelist_dict = donefilelist_dict )
191194 except Exception as e :
192- print ("An error occurred:" , e )
195+ logging . exception ("An error occurred" )
193196
194197 if ('all' in args .retrieval ) or ('attbsc' in args .retrieval ):
195198 ## plotting ATT_BETA_FR plots
@@ -204,8 +207,8 @@ def main():
204207 print ('plotting ATT_BETA_1064nm:' )
205208 display_3d .pollyDisplayAttnBsc (nc_dict , config_dict , polly_conf_dict , outputfolder , wavelength = 1064 , param = 'FR' ,donefilelist_dict = donefilelist_dict )
206209 except Exception as e :
207- print ("An error occurred:" , e )
208-
210+ logging . exception ("An error occurred" )
211+
209212 ## plotting ATT_BETA_NR plots
210213 try :
211214 nc_files = readout .get_nc_filename (date , device , inputfolder , param = 'NR_att_bsc' )
@@ -216,7 +219,7 @@ def main():
216219 print ('plotting ATT_BETA_NR_532nm:' )
217220 display_3d .pollyDisplayAttnBsc (nc_dict , config_dict , polly_conf_dict , outputfolder , wavelength = 532 , param = 'NR' ,donefilelist_dict = donefilelist_dict )
218221 except Exception as e :
219- print ("An error occurred:" , e )
222+ logging . exception ("An error occurred" )
220223
221224 ## plotting ATT_BETA_OC plots
222225 try :
@@ -230,7 +233,7 @@ def main():
230233 print ('plotting ATT_BETA_OC_1064nm:' )
231234 display_3d .pollyDisplayAttnBsc (nc_dict , config_dict , polly_conf_dict , outputfolder , wavelength = 1064 , param = 'OC' ,donefilelist_dict = donefilelist_dict )
232235 except Exception as e :
233- print ("An error occurred:" , e )
236+ logging . exception ("An error occurred" )
234237
235238 if ('all' in args .retrieval ) or ('voldepol' in args .retrieval ):
236239 ## plotting VolDepol plots
@@ -243,7 +246,7 @@ def main():
243246 print ('plotting VDR_532nm:' )
244247 display_3d .pollyDisplayVDR (nc_dict , config_dict , polly_conf_dict , outputfolder , wavelength = 532 ,donefilelist_dict = donefilelist_dict )
245248 except Exception as e :
246- print ("An error occurred:" , e )
249+ logging . exception ("An error occurred" )
247250
248251 if ('all' in args .retrieval ) or ('wvmr_rh' in args .retrieval ):
249252 ## plotting WVMR_RH plots
@@ -256,7 +259,7 @@ def main():
256259 print ('plotting RH:' )
257260 display_3d .pollyDisplayRH (nc_dict , config_dict , polly_conf_dict , outputfolder ,donefilelist_dict = donefilelist_dict )
258261 except Exception as e :
259- print ("An error occurred:" , e )
262+ logging . exception ("An error occurred" )
260263
261264 if ('all' in args .retrieval ) or ('target_class' in args .retrieval ):
262265 ## plotting Target classification V1
@@ -267,8 +270,7 @@ def main():
267270 print ('plotting Target classification V1:' )
268271 display_3d .pollyDisplayTargetClass (nc_dict , config_dict , polly_conf_dict , outputfolder ,c_version = 'V1' ,donefilelist_dict = donefilelist_dict )
269272 except Exception as e :
270- print ("An error occurred:" , e )
271-
273+ logging .exception ("An error occurred" )
272274 ## plotting Target classification V2
273275 try :
274276 nc_files = readout .get_nc_filename (date , device , inputfolder , param = 'target_classification_V2' )
@@ -277,8 +279,7 @@ def main():
277279 print ('plotting Target classification V2:' )
278280 display_3d .pollyDisplayTargetClass (nc_dict , config_dict , polly_conf_dict , outputfolder ,c_version = 'V2' ,donefilelist_dict = donefilelist_dict )
279281 except Exception as e :
280- print ("An error occurred:" , e )
281-
282+ logging .exception ("An error occurred" )
282283 if ('all' in args .retrieval ) or ('quasi_results' in args .retrieval ):
283284 ## plotting Quasi results V1
284285 try :
@@ -289,8 +290,7 @@ def main():
289290 for qp in q_params_ls :
290291 display_3d .pollyDisplayQR (nc_dict , config_dict , polly_conf_dict , outputfolder ,q_param = qp , q_version = 'V1' ,donefilelist_dict = donefilelist_dict )
291292 except Exception as e :
292- print ("An error occurred:" , e )
293-
293+ logging .exception ("An error occurred" )
294294 ## plotting Quasi results V2
295295 try :
296296 nc_files = readout .get_nc_filename (date , device , inputfolder , param = 'quasi_results_V2' )
@@ -299,8 +299,7 @@ def main():
299299 for qp in q_params_ls :
300300 display_3d .pollyDisplayQR (nc_dict , config_dict , polly_conf_dict , outputfolder , q_param = qp , q_version = 'V2' ,donefilelist_dict = donefilelist_dict )
301301 except Exception as e :
302- print ("An error occurred:" , e )
303-
302+ logging .exception ("An error occurred" )
304303
305304 if ('profiles' in args .retrieval ):
306305 ## plotting profiles
@@ -353,8 +352,8 @@ def main():
353352 print (f"{ profilename } " )
354353 display_profiles .pollyDisplay_profile (nc_dict_profile_POLI ,POLIPHON_profile_translator ,profilename ,config_dict ,polly_conf_dict ,outputfolder ,donefilelist_dict = donefilelist_dict )
355354 except Exception as e :
356- print ("An error occurred:" , e )
357-
355+ logging . exception ("An error occurred" )
356+
358357 if ('all' in args .retrieval ) or ('poliphon' in args .retrieval ):
359358 ## plotting profiles
360359 ## using profile_translator
@@ -373,8 +372,7 @@ def main():
373372 print (f"{ profilename } " )
374373 display_profiles .pollyDisplay_profile (nc_dict_profile_POLI ,POLIPHON_profile_translator ,profilename ,config_dict ,polly_conf_dict ,outputfolder ,donefilelist_dict = donefilelist_dict )
375374 except Exception as e :
376- print ("An error occurred:" , e )
377-
375+ logging .exception ("An error occurred" )
378376 ## add plotted files to donefile
379377 if write2donefile == True :
380378 print ('Write image files to donefile...' )
@@ -400,7 +398,8 @@ def main():
400398 LC ['LC532' ] = readout .get_LC_from_sql_db (db_path = str (db_path ),table_name = 'lidar_calibration_constant' ,wavelength = '532' ,method = 'Method' ,telescope = 'far' )
401399 LC ['LC1064' ] = readout .get_LC_from_sql_db (db_path = str (db_path ),table_name = 'lidar_calibration_constant' ,wavelength = '1064' ,method = 'Method' ,telescope = 'far' )
402400 except Exception as e :
403- print ("An error occurred:" , e )
401+ logging .exception ("An error occurred" )
402+
404403 calib_profile_translator = p_translator .calib_profile_translator_function ()
405404 try :
406405 nc_files = readout .get_nc_filename (date , device , inputfolder , param = 'overlap' )
@@ -410,8 +409,7 @@ def main():
410409 for profilename in calib_profile_translator .keys ():
411410 display_profiles .pollyDisplay_calibration_constants (nc_dict ,LC [profilename ],calib_profile_translator ,profilename ,config_dict ,polly_conf_dict ,outputfolder ,donefilelist_dict = donefilelist_dict )
412411 except Exception as e :
413- print ("An error occurred:" , e )
414-
412+ logging .exception ("An error occurred" )
415413 if ('all' in args .retrieval ) or ('longterm_cali' in args .retrieval ):
416414 ## plotting Lidar constants from db-file
417415 base_dir = Path (config_dict ['results_folder' ])
@@ -429,7 +427,7 @@ def main():
429427 ETA ['ETA532' ] = readout .get_depol_from_sql_db (db_path = str (db_path ),table_name = 'depol_calibration_constant' ,wavelength = '532' )
430428 ETA ['ETA1064' ] = readout .get_depol_from_sql_db (db_path = str (db_path ),table_name = 'depol_calibration_constant' ,wavelength = '1064' )
431429 except Exception as e :
432- print ("An error occurred:" , e )
430+ logging . exception ("An error occurred" )
433431 calib_profile_translator = p_translator .calib_profile_translator_function ()
434432 profilename = 'longterm_LC'
435433 try :
@@ -439,7 +437,7 @@ def main():
439437 print ('plotting LongTermCalibration:' )
440438 display_profiles .pollyDisplay_longtermcalibration (nc_dict ,logbookFile_df ,LC ,ETA ,calib_profile_translator ,profilename ,config_dict ,polly_conf_dict ,outputfolder ,donefilelist_dict = donefilelist_dict )
441439 except Exception as e :
442- print ("An error occurred:" , e )
440+ logging . exception ("An error occurred" )
443441
444442 if ('all' in args .retrieval ) or ('HKD' in args .retrieval ):
445443 laserlogbook = readout .get_pollyxt_logbook_files (date ,device ,args .base_dir ,outputfolder )
@@ -451,8 +449,7 @@ def main():
451449 nc_dict = readout .read_nc_file (data_file )
452450 display_profiles .pollyDisplay_HKD (laserlogbook_df ,nc_dict ,config_dict ,polly_conf_dict ,outputfolder ,donefilelist_dict = donefilelist_dict )
453451 except Exception as e :
454- print ("An error occurred:" , e )
455-
452+ logging .exception ("An error occurred" )
456453 if ('all' in args .retrieval ) or ('profile_summary' in args .retrieval ):
457454 ## plotting profiles
458455 ## using profile_translator
@@ -485,7 +482,7 @@ def main():
485482 display_profiles .pollyDisplay_profile_summary (nc_dict_profile = nc_dict_profile ,nc_dict_profile_NR = nc_dict_profile_NR ,config_dict = config_dict ,polly_conf_dict = polly_conf_dict ,outdir = outputfolder ,method = 'klett' ,ymax = 'high_range' ,donefilelist_dict = donefilelist_dict )
486483 display_profiles .pollyDisplay_profile_summary (nc_dict_profile = nc_dict_profile ,nc_dict_profile_NR = nc_dict_profile_NR ,config_dict = config_dict ,polly_conf_dict = polly_conf_dict ,outdir = outputfolder ,method = 'klett' ,ymax = 'low_range' ,donefilelist_dict = donefilelist_dict )
487484 except Exception as e :
488- print ("An error occurred:" , e )
485+ logging . exception ("An error occurred" )
489486
490487
491488 ## add plotted files to donefile
0 commit comments