1- import cdippy .utils .utils as ut
2- import cdippy .plots .utils as pu
1+ import cdippy .utils .utils as cdip_utils
2+ import cdippy .plots .utils as plot_utils
33from datetime import datetime
44import numpy as np
55import calendar
1515
1616
1717def make_plot (
18- stns : str , start : datetime , end : datetime , params : str , x_inch : int
18+ stns : str , start : datetime , end : datetime , params : str , x_inch : int = None
1919) -> tuple :
2020 """CDIP's classic compendium plot for multiple stations and parameters.
2121
@@ -66,7 +66,7 @@ def make_plot(
6666 return fig , "Error: start is not set"
6767
6868 if type (start ) is str :
69- start = ut .cdip_datetime (start )
69+ start = cdip_utils .cdip_datetime (start )
7070
7171 month_plot = False
7272 if end is None : # Month compendium plot
@@ -81,7 +81,7 @@ def make_plot(
8181 )
8282 month_plot = True
8383 elif type (end ) is str :
84- end = ut .cdip_datetime (end )
84+ end = cdip_utils .cdip_datetime (end )
8585
8686 if params is None :
8787 params = "waveHs,waveTp,waveDp"
@@ -123,7 +123,7 @@ def make_plot(
123123
124124 # Get the color for the station (circular list)
125125 if multiple_stns :
126- stn_color = pu .stn_colors [stn_idx ]
126+ stn_color = plot_utils .stn_colors [stn_idx ]
127127 else :
128128 stn_color = "k"
129129 stn_idx += 1
@@ -155,13 +155,13 @@ def make_plot(
155155
156156 # Prepare data to show gaps where there is no data
157157 index_name = "waveTime"
158- data = pu .prepare_gaps_dict (data , index_name )
158+ data = plot_utils .prepare_gaps_dict (data , index_name )
159159
160160 # Plot the processed data.
161161 if len (data ) > 0 :
162- wT = [ut .timestamp_to_datetime (x ) for x in data ["waveTime" ]]
162+ wT = [cdip_utils .timestamp_to_datetime (x ) for x in data ["waveTime" ]]
163163 for idx in range (len (params )):
164- attr = pu .pm_data [params [idx ]]
164+ attr = plot_utils .pm_data [params [idx ]]
165165 ax = pm_axes [idx ]
166166 if multiple_stns :
167167 plot_color = stn_color
@@ -201,12 +201,16 @@ def make_plot(
201201 plt .minorticks_on ()
202202 for idx in range (len (params )):
203203 ax = pm_axes [idx ]
204- attr = pu .pm_data [params [idx ]]
204+ attr = plot_utils .pm_data [params [idx ]]
205205 # Grids
206206 ax .grid (
207- axis = "x" , which = "major" , color = pu .grid_color , linestyle = "-" , linewidth = 2
207+ axis = "x" ,
208+ which = "major" ,
209+ color = plot_utils .grid_color ,
210+ linestyle = "-" ,
211+ linewidth = 2 ,
208212 )
209- ax .grid (axis = "y" , which = "major" , color = pu .grid_color , linestyle = "-" )
213+ ax .grid (axis = "y" , which = "major" , color = plot_utils .grid_color , linestyle = "-" )
210214 # Ticks
211215 ax .tick_params (axis = "x" , which = "minor" , length = 4 , top = "off" )
212216 ax .tick_params (
@@ -227,12 +231,12 @@ def make_plot(
227231 # Note waveHs may not be in current stn data, hence check if in params.
228232 if "waveHs" in params :
229233 hs_ax = pm_axes [params .index ("waveHs" )]
230- low = pu .pm_data ["waveHs" ]["ylim" ][0 ]
231- high = pu .pm_data ["waveHs" ]["ylim" ][1 ]
234+ low = plot_utils .pm_data ["waveHs" ]["ylim" ][0 ]
235+ high = plot_utils .pm_data ["waveHs" ]["ylim" ][1 ]
232236 if hs_ylim_max < high :
233237 hs_ax .set_ylim (low , high )
234238 # Add second Hs axes
235- attr = pu .pm_data ["waveHs" ]
239+ attr = plot_utils .pm_data ["waveHs" ]
236240 pHs2 = hs_ax .twinx ()
237241 pHs2 .set_ylabel (attr ["ylabel_ft" ], fontsize = label_font_size )
238242 pHs2 .tick_params (axis = "y" , which = "major" , labelsize = label_font_size )
@@ -241,7 +245,7 @@ def make_plot(
241245
242246 if "waveDp" in params :
243247 dp_ax = pm_axes [params .index ("waveDp" )]
244- attr = pu .pm_data ["waveDp" ]
248+ attr = plot_utils .pm_data ["waveDp" ]
245249 pDp2 = dp_ax .twinx ()
246250 pDp2 .set_ylabel (attr ["ylabel_compass" ], fontsize = label_font_size )
247251 pDp2 .tick_params (axis = "y" , which = "major" , labelsize = label_font_size )
0 commit comments