@@ -197,7 +197,7 @@ def get_op_id(msc_url, token, op_name):
197197
198198
199199class Plotting :
200- def __init__ (self , cpath , msc_url = None , msc_auth_password = None , username = None , password = None , pdlg = None ):
200+ def __init__ (self , cpath , msc_url = None , msc_auth_password = None , username = None , password = None , pdlg = None , raw = False ):
201201 """
202202 Initialize the Plotting object with the provided parameters.
203203
@@ -300,8 +300,8 @@ def read_operation(self, op_name, msc_url, msc_auth_password, username, password
300300
301301
302302class TopViewPlotting (Plotting ):
303- def __init__ (self , cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg ):
304- super (TopViewPlotting , self ).__init__ (cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg )
303+ def __init__ (self , cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg , raw = False ):
304+ super (TopViewPlotting , self ).__init__ (cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg , raw )
305305 self .pdlg = pdlg
306306 self .myfig = qt .TopViewPlotter ()
307307 self .myfig .fig .canvas .draw ()
@@ -313,6 +313,7 @@ def __init__(self, cpath, msc_url, msc_auth_password, msc_username, msc_password
313313 self .password = msc_password
314314 self .msc_auth = msc_auth_password
315315 self .url = msc_url
316+ self .raw = raw
316317
317318 def setup (self ):
318319 pass
@@ -356,17 +357,20 @@ def draw(self, flight, section, vertical, filename, init_time, time, url, layer,
356357 img = wms .getmap (** kwargs )
357358 image_io = io .BytesIO (img .read ())
358359 img = PIL .Image .open (image_io )
359- self .myfig .draw_image (img )
360360 t = str (time )
361361 date_time = re .sub (r'\W+' , '' , t )
362362 plot_filename = slugify (f"{ flight } _{ layer } _{ section } _{ date_time } _{ no_of_plots } _{ elevation } " ) + ".png"
363- self .myfig .fig .savefig (plot_filename )
363+ if self .raw :
364+ img .save (plot_filename )
365+ else :
366+ self .myfig .draw_image (img )
367+ self .myfig .fig .savefig (plot_filename )
364368 print (f"The image is saved at: { os .getcwd ()} /{ plot_filename } " )
365369
366370
367371class SideViewPlotting (Plotting ):
368- def __init__ (self , cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg ):
369- super (SideViewPlotting , self ).__init__ (cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg )
372+ def __init__ (self , cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg , raw = False ):
373+ super (SideViewPlotting , self ).__init__ (cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg , raw )
370374 self .pdlg = pdlg
371375 self .myfig = qt .SideViewPlotter ()
372376 self .ax = self .myfig .ax
@@ -481,8 +485,8 @@ def draw(self, flight, section, vertical, filename, init_time, time, url, layer,
481485
482486class LinearViewPlotting (Plotting ):
483487 # ToDo Implement access of MSColab
484- def __init__ (self , cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg ):
485- super (LinearViewPlotting , self ).__init__ (cpath , msc_url , msc_auth_password , msc_username , msc_password )
488+ def __init__ (self , cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg , raw = False ):
489+ super (LinearViewPlotting , self ).__init__ (cpath , msc_url , msc_auth_password , msc_username , msc_password , raw )
486490 self .pdlg = pdlg
487491 self .myfig = qt .LinearViewPlotter ()
488492 self .ax = self .myfig .ax
@@ -584,8 +588,9 @@ def draw(self, flight, section, vertical, filename, init_time, time, url, layer,
584588@click .option ('--intv' , default = 0 , help = 'Time interval.' )
585589@click .option ('--stime' , default = "" , help = 'Starting time for downloading multiple plots with a fixed interval.' )
586590@click .option ('--etime' , default = "" , help = 'Ending time for downloading multiple plots with a fixed interval.' )
591+ @click .option ('--raw' , default = False , help = 'Saves the raw image with its projection in topview' )
587592@click .pass_context
588- def main (ctx , cpath , view , ftrack , itime , vtime , intv , stime , etime ):
593+ def main (ctx , cpath , view , ftrack , itime , vtime , intv , stime , etime , raw ):
589594 pdlg = None
590595
591596 def close_process_dialog (pdlg ):
@@ -623,13 +628,13 @@ def close_process_dialog(pdlg):
623628
624629 # Choose view (top or side)
625630 if view == "top" :
626- top_view = TopViewPlotting (cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg )
631+ top_view = TopViewPlotting (cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg , raw )
627632 sec = "automated_plotting_hsecs"
628633 elif view == "side" :
629- side_view = SideViewPlotting (cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg )
634+ side_view = SideViewPlotting (cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg , raw )
630635 sec = "automated_plotting_vsecs"
631636 elif view == "linear" :
632- linear_view = LinearViewPlotting (cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg )
637+ linear_view = LinearViewPlotting (cpath , msc_url , msc_auth_password , msc_username , msc_password , pdlg , raw )
633638 sec = "automated_plotting_lsecs"
634639 else :
635640 print ("Invalid view" )
0 commit comments