Commit 5b44730f authored by Marco Kurzynski's avatar Marco Kurzynski
Browse files

changed log variable

parent 639b0557
......@@ -10,7 +10,7 @@ import matplotlib as mpl
mpl.use('agg')
import matplotlib.pyplot as plt
_log = logging.getLogger(__name__)
LOG = logging.getLogger(__name__)
def get_img_filename(begin, end, site='', description='', tag=''):
inst = 'ceilo'
......@@ -49,7 +49,7 @@ def make_plot(ncfiles=None, quality=1, site="", description="", start_date=None,
try:
yield Dataset(fn)
except FileNotFoundError:
_log.warning(f"{os.path.basename(fn)} not found, skipping quicklook");
LOG.warning(f"{os.path.basename(fn)} not found, skipping quicklook");
# yields vars of datasets added together, only added together for time_offset + base_time
def get_data(datasets,vs):
......@@ -58,7 +58,7 @@ def make_plot(ncfiles=None, quality=1, site="", description="", start_date=None,
datasets = tuple(get_datasets(ncfiles))
if not datasets:
_log.error("No valid nc files found")
LOG.error("No valid nc files found")
exit(1)
combine = lambda arrs : reduce(lambda a,b : numpy.append(a,b,axis=0), arrs)
......@@ -97,7 +97,7 @@ def make_plot(ncfiles=None, quality=1, site="", description="", start_date=None,
try:
created_files = _plot_quicklook(x, y, z, fcbh, scbh, tcbh, dt, quality, out_dir, site=site, description=description, daily=daily)
except Exception as e:
_log.exception("Error in matplotlib or pylab during plotting")
LOG.exception("Error in matplotlib or pylab during plotting")
raise e
finally:
plt.close('all')
......@@ -154,7 +154,7 @@ def _plot_quicklook(x, y, z, fcbh, scbh, tcbh, dt, quality, image_dir, site="",
filename = get_img_filename(dt, end, tag='tn', site=site, description=description)
tn_file = os.path.join(image_dir, filename)
plt.savefig(tn_file)
_log.debug("Ceilometer Backscatter Thumbnail saved as %s" % tn_file)
LOG.debug("Ceilometer Backscatter Thumbnail saved as %s" % tn_file)
# generate quicklook
# reset to default margins
......@@ -175,7 +175,7 @@ def _plot_quicklook(x, y, z, fcbh, scbh, tcbh, dt, quality, image_dir, site="",
filename = get_img_filename(dt, end, site=site, description=description)
ql_file = os.path.join(image_dir, filename)
plt.savefig(ql_file)
_log.debug("Ceilometer Backscatter Quicklook saved as %s" % ql_file)
LOG.debug("Ceilometer Backscatter Quicklook saved as %s" % ql_file)
plt.close(fig=fig)
return (tn_file, ql_file)
......@@ -261,7 +261,7 @@ def main():
quality = int(args.quality)
if args.filenames is None:
_log.error("Filenames must be passed")
LOG.error("Filenames must be passed")
return -1
filenames = tuple(map(os.path.abspath, args.filenames))
description = args.description
......@@ -270,9 +270,9 @@ def main():
# Run the make_plot function to create the images with arguments specified at command-line
make_plot(ncfiles=filenames, quality=quality, site=args.site, description=description, start_date=args.start_date, end_date=args.end_date, daily=args.daily, out_dir=args.out_dir)
except file.FileLockedError as e:
_log.warning("function already locked with %s", e)
LOG.warning("function already locked with %s", e)
finally:
_log.debug("terminating", exc_info=True)
LOG.debug("terminating", exc_info=True)
logging.shutdown()
if __name__ == '__main__':
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment