Skip to content

Commit f950e33

Browse files
committed
Enhanced documentation for plotting and visualization functions #23
1 parent 21d7e4d commit f950e33

1 file changed

Lines changed: 63 additions & 29 deletions

File tree

cdippy/plotting.py

Lines changed: 63 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,83 @@
44

55
def make_annual_hs_boxplot(stn: str, year: int) -> Figure:
66
"""
7-
Create a boxplot of annual significant wave heights for a station.
8-
9-
Args:
10-
stn (str): A 5-char station identifier, e.g. '100p1'.
11-
year (int): The year to plot.
12-
13-
Returns:
14-
fig (Figure): A matplotlib.pyplot.Figure object for the created plot.
7+
Create a boxplot of annual significant wave heights for a given station and year.
8+
9+
Parameters
10+
----------
11+
stn : str
12+
A 5-character station identifier, e.g., '100p1'.
13+
year : int
14+
The year for which the boxplot is generated.
15+
16+
Returns
17+
-------
18+
fig : Figure
19+
A matplotlib Figure object representing the annual wave height boxplot.
20+
21+
Example
22+
-------
23+
>>> fig = make_annual_hs_boxplot('100p1', 2023)
24+
>>> fig.show()
1525
"""
16-
1726
return plots.annual_hs_boxplot.make_plot(stn, year)
1827

1928

2029
def make_compendium_plot(
2130
stns: str, start: str, end: str, params: str, x_inch: int
2231
) -> Figure:
23-
"""CDIP's classic compendium plot for multiple stations and parameters.
24-
25-
Args:
26-
stns (str): A comma-delimited list of 5-char station identifiers, e.g. '100p1,201p1'.
27-
start (str): Start time of data series formatted as 'yyyymm[ddHHMMss]' where 'ddHHMMss' are optional components.
28-
end (str): End time of data series ('yyyymm[ddHHMMss]') If 'None' is provided, defaults to the current date and time.
29-
params (str): A comma-delimited string of parameter names, e.g. 'waveHs,waveTp'.
30-
31-
Returns:
32-
fig (Figure): A matplotlib.pyplot.Figure object for the created plot.
33-
3432
"""
35-
33+
Generate CDIP's classic compendium plot for multiple stations and parameters over a time range.
34+
35+
Parameters
36+
----------
37+
stns : str
38+
Comma-delimited list of 5-character station identifiers, e.g., '100p1,201p1'.
39+
start : str
40+
Start time formatted as 'yyyymm[ddHHMMss]'; optional components default to zero.
41+
end : str
42+
End time formatted as 'yyyymm[ddHHMMss]'. If None, defaults to current date/time.
43+
params : str
44+
Comma-delimited string of parameter names, e.g., 'waveHs,waveTp'.
45+
x_inch : int
46+
Width of the figure in inches.
47+
48+
Returns
49+
-------
50+
fig : Figure
51+
A matplotlib Figure object representing the compendium plot.
52+
53+
Example
54+
-------
55+
>>> fig = make_compendium_plot('100p1,201p1', '202301', '202312', 'waveHs,waveTp', 10)
56+
>>> fig.show()
57+
"""
3658
return plots.compendium.make_plot(stns, start, end, params, x_inch)
3759

3860

3961
def make_sst_climatology_plot(
4062
stn: str, x_inch: int = None, y_inch: int = None
4163
) -> Figure:
4264
"""
43-
Create a plot of yearly climatology of sea surface temperature at a station for all years of available data.
44-
45-
Args:
46-
stn (str): A 5-char station identifier, e.g. '100p1'.
47-
48-
Returns:
49-
fig (Figure): A matplotlib.pyplot.Figure object for the created plot.
65+
Plot the yearly climatology of sea surface temperature for a given station over all available years.
66+
67+
Parameters
68+
----------
69+
stn : str
70+
A 5-character station identifier, e.g., '100p1'.
71+
x_inch : int, optional
72+
Width of the figure in inches. Default is None.
73+
y_inch : int, optional
74+
Height of the figure in inches. Default is None.
75+
76+
Returns
77+
-------
78+
fig : Figure
79+
A matplotlib Figure object representing the SST climatology plot.
80+
81+
Example
82+
-------
83+
>>> fig = make_sst_climatology_plot('100p1', x_inch=8, y_inch=6)
84+
>>> fig.show()
5085
"""
51-
5286
return plots.sst_climatology.make_plot(stn, x_inch, y_inch)

0 commit comments

Comments
 (0)