src/tropycal/tracks/storm.py
def plot_tors(self,dist_thresh=1000,Tors=None,domain="dynamic",plotPPH=False,plot_all=False,\
                  ax=None,cartopy_proj=None,save_path=None,prop={},map_prop={}):
                
        r"""
        Creates a plot of the storm and associated tornado tracks.
        
        Parameters
        ----------
        dist_thresh : int
            Distance threshold (in kilometers) from the tropical cyclone track over which to attribute tornadoes to the TC. Default is 1000 km.
        Tors : pandas.DataFrame
            DataFrame containing tornado data associated with the storm. If None, data is automatically retrieved from TornadoDatabase. A dataframe of tornadoes associated with the TC will then be saved to this instance of storm
                for future use.
        domain : str
            Domain for the plot. Default is "dynamic". Please refer to :ref:`options-domain` for available domain options.
        plotPPH : bool or str
            Whether to plot practically perfect forecast (PPH). True defaults to "daily". Default is False.

            * **False** - no PPH plot.
            * **True** - defaults to "daily".
            * **"total"** - probability of a tornado within 25mi of a point during the period of time selected.
            * **"daily"** - average probability of a tornado within 25mi of a point during a day starting at 12 UTC.
        plot_all : bool
            Whether to plot dots for all observations along the track. If false, dots will be plotted every 6 hours. Default is false.
        ax : axes
            Instance of axes to plot on. If none, one will be generated. Default is none.
        cartopy_proj : ccrs
            Instance of a cartopy projection to use. If none, one will be generated. Default is none.
        save_path : str
            Relative or full path of directory to save the image in. If none, image will not be saved.
        
        Other Parameters
        ----------------
        prop : dict
            Customization properties of plot.
        map_prop : dict
            Customization properties of Cartopy map. Please refer to :ref:`options-map-prop` for available options.
        
        Returns
        -------
        ax
            Instance of axes containing the plot is returned.
        """
        
        #Set default colormap for TC plots to Wistia
        try:
            prop['PPHcolors']
        except:
            prop['PPHcolors']='Wistia'
        
        if Tors is None:
            try:
                self.stormTors
            except:
                warn_message = "Reading in tornado data for this storm. If you seek to analyze tornado data for multiple storms, run \"TrackDataset.assign_storm_tornadoes()\" to avoid this warning in the future."
                warnings.warn(warn_message)
                Tors = TornadoDataset()
                self.stormTors = Tors.get_storm_tornadoes(self,dist_thresh)
    
        #Error check if no tornadoes are found
        if len(self.stormTors) == 0:
            raise RuntimeError("No tornadoes were found with this storm.")
    
        #Warning if few tornadoes were found
        if len(self.stormTors) < 5:
            warn_message = f"{len(self.stormTors)} tornadoes were found with this storm. Default domain to east_conus."
            warnings.warn(warn_message)
            domain = 'east_conus'
    
        #Create instance of plot object
        self.plot_obj_tc = TrackPlot()
        try:
            self.plot_obj_tor = TornadoPlot()
        except:
            from ..tornado.plot import TornadoPlot
            self.plot_obj_tor = TornadoPlot()
        
        #Create cartopy projection
        if cartopy_proj is None:
            if max(self.dict['lon']) > 150 or min(self.dict['lon']) < -150:
                self.plot_obj_tor.create_cartopy(proj='PlateCarree',central_longitude=180.0)
                self.plot_obj_tc.create_cartopy(proj='PlateCarree',central_longitude=180.0)
            else:
                self.plot_obj_tor.create_cartopy(proj='PlateCarree',central_longitude=0.0)
                self.plot_obj_tc.create_cartopy(proj='PlateCarree',central_longitude=0.0)
                
        #Plot tornadoes
        plot_ax,leg_tor,domain = self.plot_obj_tor.plot_tornadoes(self.stormTors,domain,ax=ax,return_ax=True,return_domain=True,\
                                             plotPPH=plotPPH,prop=prop,map_prop=map_prop)
        tor_title = plot_ax.get_title('left')

        #Plot storm
        plot_ax = self.plot_obj_tc.plot_storm(self.dict,domain=domain,ax=plot_ax,prop=prop,map_prop=map_prop)
        
        plot_ax.add_artist(leg_tor)
        
        storm_title = plot_ax.get_title('left')
        plot_ax.set_title(f'{storm_title}\n{tor_title}',loc='left',fontsize=17,fontweight='bold')
        
        #Save plot
        if save_path is not None and isinstance(save_path,str):
            plt.savefig(save_path,bbox_inches='tight')
        
        #Return axis
        return plot_ax
r"""
        Creates a plot of the storm and associated tornado tracks.
        
        Parameters
        ----------
        dist_thresh : int
            Distance threshold (in kilometers) from the tropical cyclone track over which to attribute tornadoes to the TC. Default is 1000 km.
        Tors : pandas.DataFrame
            DataFrame containing tornado data associated with the storm. If None, data is automatically retrieved from TornadoDatabase. A dataframe of tornadoes associated with the TC will then be saved to this instance of storm
                for future use.
        domain : str
            Domain for the plot. Default is "dynamic". Please refer to :ref:`options-domain` for available domain options.
        plotPPH : bool or str
            Whether to plot practically perfect forecast (PPH). True defaults to "daily". Default is False.

            * **False** - no PPH plot.
            * **True** - defaults to "daily".
            * **"total"** - probability of a tornado within 25mi of a point during the period of time selected.
            * **"daily"** - average probability of a tornado within 25mi of a point during a day starting at 12 UTC.
        plot_all : bool
            Whether to plot dots for all observations along the track. If false, dots will be plotted every 6 hours. Default is false.
        ax : axes
            Instance of axes to plot on. If none, one will be generated. Default is none.
        cartopy_proj : ccrs
            Instance of a cartopy projection to use. If none, one will be generated. Default is none.
        save_path : str
            Relative or full path of directory to save the image in. If none, image will not be saved.
        
        Other Parameters
        ----------------
        prop : dict
            Customization properties of plot.
        map_prop : dict
            Customization properties of Cartopy map. Please refer to :ref:`options-map-prop` for available options.
        
        Returns
        -------
        ax
            Instance of axes containing the plot is returned.
        
r"""
Creates a plot of the storm and associated tornado tracks.

Parameters

dist_thresh : int
Distance threshold (in kilometers) from the tropical cyclone track over which to attribute tornadoes to the TC. Default is 1000 km.
Tors : pandas.DataFrame
DataFrame containing tornado data associated with the storm. If None, data is automatically retrieved from TornadoDatabase. A dataframe of tornadoes associated with the TC will then be saved to this instance of storm
for future use.
domain : str
Domain for the plot. Default is "dynamic". Please refer to :ref:`options-domain` for available domain options.
plotPPH : bool or str
Whether to plot practically perfect forecast (PPH). True defaults to "daily". Default is False.

False** - no PPH plot.
True** - defaults to "daily".
"total"** - probability of a tornado within 25mi of a point during the period of time selected.
"daily"** - average probability of a tornado within 25mi of a point during a day starting at 12 UTC.
plot_all : bool
Whether to plot dots for all observations along the track. If false, dots will be plotted every 6 hours. Default is false.
ax : axes
Instance of axes to plot on. If none, one will be generated. Default is none.
cartopy_proj : ccrs
Instance of a cartopy projection to use. If none, one will be generated. Default is none.
save_path : str
Relative or full path of directory to save the image in. If none, image will not be saved.

Other Parameters

prop : dict
Customization properties of plot.
map_prop : dict
Customization properties of Cartopy map. Please refer to :ref:`options-map-prop` for available options.

Returns

ax
Instance of axes containing the plot is returned.
r " " " Creates a plot of the storm and associated tornado tracks . Parameters dist_thresh : int Distance threshold ( in kilometers ) from the tropical cyclone track over which to attribute tornadoes to the TC . Default is 1000 km . Tors : pandas . DataFrame DataFrame containing tornado data associated with the storm . If None data is automatically retrieved from TornadoDatabase . A dataframe of tornadoes associated with the TC will then be saved to this instance of storm for future use . domain : str Domain for the plot . Default is " dynamic " . Please refer to : ref : ` options - domain ` for available domain options . plotPPH : bool or str Whether to plot practically perfect forecast ( PPH ) . True defaults to " daily " . Default is False . False ** - no PPH plot . True ** - defaults to " daily " . " total " ** - probability of a tornado within 25mi of a point during the period of time selected . " daily " ** - average probability of a tornado within 25mi of a point during a day starting at 12 UTC . plot_all : bool Whether to plot dots for all observations along the track . If false dots will be plotted every 6 hours . Default is false . ax : axes Instance of axes to plot on . If none one will be generated . Default is none . cartopy_proj : ccrs Instance of a cartopy projection to use . If none one will be generated . Default is none . save_path : str Relative or full path of directory to save the image in . If none image will not be saved . Other Parameters prop : dict Customization properties of plot . map_prop : dict Customization properties of Cartopy map . Please refer to : ref : ` options - map - prop ` for available options . Returns ax Instance of axes containing the plot is returned .
def plot_tors(self,dist_thresh=1000,Tors=None,domain="dynamic",plotPPH=False,plot_all=False,\
                  ax=None,cartopy_proj=None,save_path=None,prop={},map_prop={}):
        try:
            prop['PPHcolors']
        except:
            prop['PPHcolors']='Wistia'
        if Tors is None:
            try:
                self.stormTors
            except:
                warn_message = "Reading in tornado data for this storm. If you seek to analyze tornado data for multiple storms, run \"TrackDataset.assign_storm_tornadoes()\" to avoid this warning in the future."
                warnings.warn(warn_message)
                Tors = TornadoDataset()
                self.stormTors = Tors.get_storm_tornadoes(self,dist_thresh)
        if len(self.stormTors) == 0:
            raise RuntimeError("No tornadoes were found with this storm.")
        if len(self.stormTors) < 5:
            warn_message = f"{len(self.stormTors)} tornadoes were found with this storm. Default domain to east_conus."
            warnings.warn(warn_message)
            domain = 'east_conus'
        self.plot_obj_tc = TrackPlot()
        try:
            self.plot_obj_tor = TornadoPlot()
        except:
            from ..tornado.plot import TornadoPlot
            self.plot_obj_tor = TornadoPlot()
        if cartopy_proj is None:
            if max(self.dict['lon']) > 150 or min(self.dict['lon']) < -150:
                self.plot_obj_tor.create_cartopy(proj='PlateCarree',central_longitude=180.0)
                self.plot_obj_tc.create_cartopy(proj='PlateCarree',central_longitude=180.0)
            else:
                self.plot_obj_tor.create_cartopy(proj='PlateCarree',central_longitude=0.0)
                self.plot_obj_tc.create_cartopy(proj='PlateCarree',central_longitude=0.0)
        plot_ax,leg_tor,domain = self.plot_obj_tor.plot_tornadoes(self.stormTors,domain,ax=ax,return_ax=True,return_domain=True,\
                                             plotPPH=plotPPH,prop=prop,map_prop=map_prop)
        tor_title = plot_ax.get_title('left')
        plot_ax = self.plot_obj_tc.plot_storm(self.dict,domain=domain,ax=plot_ax,prop=prop,map_prop=map_prop)
        plot_ax.add_artist(leg_tor)
        storm_title = plot_ax.get_title('left')
        plot_ax.set_title(f'{storm_title}\n{tor_title}',loc='left',fontsize=17,fontweight='bold')
        if save_path is not None and isinstance(save_path,str):
            plt.savefig(save_path,bbox_inches='tight')
        return plot_ax
def plot_tors ( self , dist_thresh = 1000 , Tors = None , domain = "dynamic" , plotPPH = False , plot_all = False , ax = None , cartopy_proj = None , save_path = None , prop = { } , map_prop = { } ) : try : prop [ 'PPHcolors' ] except : prop [ 'PPHcolors' ] = 'Wistia' if Tors is None : try : self . stormTors except : warn_message = "Reading in tornado data for this storm. If you seek to analyze tornado data for multiple storms, run \"TrackDataset.assign_storm_tornadoes()\" to avoid this warning in the future." warnings . warn ( warn_message ) Tors = TornadoDataset ( ) self . stormTors = Tors . get_storm_tornadoes ( self , dist_thresh ) if len ( self . stormTors ) == 0 : raise RuntimeError ( "No tornadoes were found with this storm." ) if len ( self . stormTors ) < 5 : warn_message = f"{len(self.stormTors)} tornadoes were found with this storm. Default domain to east_conus." warnings . warn ( warn_message ) domain = 'east_conus' self . plot_obj_tc = TrackPlot ( ) try : self . plot_obj_tor = TornadoPlot ( ) except : from . . tornado . plot import TornadoPlot self . plot_obj_tor = TornadoPlot ( ) if cartopy_proj is None : if max ( self . dict [ 'lon' ] ) > 150 or min ( self . dict [ 'lon' ] ) < - 150 : self . plot_obj_tor . create_cartopy ( proj = 'PlateCarree' , central_longitude = 180.0 ) self . plot_obj_tc . create_cartopy ( proj = 'PlateCarree' , central_longitude = 180.0 ) else : self . plot_obj_tor . create_cartopy ( proj = 'PlateCarree' , central_longitude = 0.0 ) self . plot_obj_tc . create_cartopy ( proj = 'PlateCarree' , central_longitude = 0.0 ) plot_ax , leg_tor , domain = self . plot_obj_tor . plot_tornadoes ( self . stormTors , domain , ax = ax , return_ax = True , return_domain = True , plotPPH = plotPPH , prop = prop , map_prop = map_prop ) tor_title = plot_ax . get_title ( 'left' ) plot_ax = self . plot_obj_tc . plot_storm ( self . dict , domain = domain , ax = plot_ax , prop = prop , map_prop = map_prop ) plot_ax . add_artist ( leg_tor ) storm_title = plot_ax . get_title ( 'left' ) plot_ax . set_title ( f'{storm_title}\n{tor_title}' , loc = 'left' , fontsize = 17 , fontweight = 'bold' ) if save_path is not None and isinstance ( save_path , str ) : plt . savefig ( save_path , bbox_inches = 'tight' ) return plot_ax
r"""
Creates a plot of the storm and associated tornado tracks.
r " " " Creates a plot of the storm and associated tornado tracks .
r"""
        Creates a plot of the storm and associated tornado tracks.
        
        Parameters
        ----------
        dist_thresh : int
            Distance threshold (in kilometers) from the tropical cyclone track over which to attribute tornadoes to the TC. Default is 1000 km.
        Tors : pandas.DataFrame
            DataFrame containing tornado data associated with the storm. If None, data is automatically retrieved from TornadoDatabase. A dataframe of tornadoes associated with the TC will then be saved to this instance of storm
                for future use.
        domain : str
            Domain for the plot. Default is "dynamic". Please refer to :ref:`options-domain` for available domain options.
        plotPPH : bool or str
            Whether to plot practically perfect forecast (PPH). True defaults to "daily". Default is False.

            * **False** - no PPH plot.
            * **True** - defaults to "daily".
            * **"total"** - probability of a tornado within 25mi of a point during the period of time selected.
            * **"daily"** - average probability of a tornado within 25mi of a point during a day starting at 12 UTC.
        plot_all : bool
            Whether to plot dots for all observations along the track. If false, dots will be plotted every 6 hours. Default is false.
        ax : axes
            Instance of axes to plot on. If none, one will be generated. Default is none.
        cartopy_proj : ccrs
            Instance of a cartopy projection to use. If none, one will be generated. Default is none.
        save_path : str
            Relative or full path of directory to save the image in. If none, image will not be saved.
        
        Other Parameters
        ----------------
        prop : dict
            Customization properties of plot.
        map_prop : dict
            Customization properties of Cartopy map. Please refer to :ref:`options-map-prop` for available options.
        
        Returns
        -------
        ax
            Instance of axes containing the plot is returned.
        """ #Set default colormap for TC plots to Wistia #Error check if no tornadoes are found #Warning if few tornadoes were found #Create instance of plot object #Create cartopy projection #Plot tornadoes #Plot storm #Save plot #Return axis
self
dist_thresh
Tors
domain
plotPPH
plot_all
ax
cartopy_proj
save_path
prop
map_prop