Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstrings for plotting.py #155

Merged
merged 5 commits into from
Jul 11, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 29 additions & 69 deletions tobac/plotting.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Provide methods for plotting analyzed data.

Plotting routines including both visualizations of the entire cloud field
and detailed visualizations for individual convective cells and their
properties.
Plotting routines including both visualizations for
the entire dataset including all tracks, and detailed
visualizations for individual cells and their properties.

References
----------
Expand Down Expand Up @@ -54,7 +54,7 @@ def plot_tracks_mask_field_loop(

mask : iris.cube.Cube
Cube containing mask (int id for tacked volumes, 0
everywhere else). Ouput of the segmentation step.
everywhere else). Output of the segmentation step.

features : pandas.DataFrame
Output of the feature detection.
Expand All @@ -63,13 +63,13 @@ def plot_tracks_mask_field_loop(
Not used. Default is None.

name : str, optional
First part of the filename. Same for all pngs. If None,
Filename without file extension. Same for all pngs. If None,
the name of the field is used. Default is None.

plot_dir : str, optional
Path where the plots will be saved. Default is './'.

figsize : tupel of float, optional
figsize : tuple of floats, optional
Width, height of the plot in inches.
Default is (10/2.54, 10/2.54).

Expand Down Expand Up @@ -186,18 +186,19 @@ def plot_tracks_mask_field(
Parameters
----------
track : pandas.DataFrame
One ore more framesof the output of linking_trackpy.
One or more timeframes of a dataframe generated by
linking_trackpy.

field : iris.cube.Cube
One frame of the original input data.
One frame/time step of the original input data.

mask : iris.cube.Cube
One frame of the Cube containing mask (int id for tacked
volumes 0 everywhere else), output of the segmentation
step.
One frame/time step of the Cube containing mask (int id
for tracked volumes 0 everywhere else), output of the
segmentation step.

features : pandas.DataFrame
Output of the feature detection, one or more frames.
Output of the feature detection, one or more frames/time steps.

axes : cartopy.mpl.geoaxes.GeoAxesSubplot, optional
GeoAxesSubplot to use for plotting. Default is None.
freemansw1 marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -208,11 +209,11 @@ def plot_tracks_mask_field(
[long_min, long_max, lat_min, lat_max]. Default is None.

plot_outline : bool, optional
Boolean defining wether the outlines of the segments are
Boolean defining whether the outlines of the segments are
plotted. Default is True.

plot_marker : bool, optional
Boolean defining wether the positions of the features from
Boolean defining whether the positions of the features from
the track dataframe are plotted. Default is True.

marker_track : str, optional
Expand Down Expand Up @@ -561,54 +562,9 @@ def plot_mask_cell_track_follow(
dpi=300,
**kwargs
):
"""Make plots for all cells centered around cell.

With one background field as filling and one background field as
contours.

Parameters
----------
cell : int
Integer id of cell to create masked cube for.

track

cog

features : pandas.DataFrame
Output from trackpy/maketrack.

mask_total : iris.cube.Cube

field_contour

field_filled

width : int, optional
Default is 10000.

name : str, optional
Default is 'test'.

plotdir : str, optional
Path where the plot will be saved. Default is './'.

file_format : {['png'], ['pdf']}, optional
Default is ['png'].

dpi : int, optional
Plot resolution. Default is 300.

**kwargs

Returns
-------
none

Notes
-----
unsure about features, mask_total
needs more descriptions
"""Make plots for all cells centred around cell and with one background field as filling and one background field as contrours
Input:
Output:
snilsn marked this conversation as resolved.
Show resolved Hide resolved
"""

mpl_backend = mpl.get_backend()
Expand Down Expand Up @@ -2019,7 +1975,7 @@ def map_tracks(
Parameters
----------
track : pandas.DataFrame
Dataframe conatining the linked features with a
Dataframe containing the linked features with a
column 'cell'.

axis_extent : matplotlib.axes, optional
Expand All @@ -2028,13 +1984,17 @@ def map_tracks(
[long_min, long_max, lat_min, lat_max].
Default is None.

figsize : tupel of float, optional
figsize : tuple of floats, optional
Width, height of the plot in inches.
Default is (10, 10).

axes : cartopy.mpl.geoaxes.GeoAxesSubplot, optional
GeoAxesSubplot to use for plotting. Default is None.

untracked_cell_value : int or np.nan, optional
Value of untracked cells in track['cell'].
Default is -1.

Returns
-------
axes : cartopy.mpl.geoaxes.GeoAxesSubplot
Expand Down Expand Up @@ -2158,7 +2118,7 @@ def plot_lifetime_histogram_bar(
shift=0.5,
**kwargs
):
"""Plot the liftetime histogram of a the cells as bar plot.
"""Plot the liftetime histogram of the cells as bar plot.

Parameters
----------
Expand Down Expand Up @@ -2216,7 +2176,7 @@ def plot_histogram_cellwise(
DataFrame of the features containing the variable
as column and a column 'cell'.

bin_edges : int or ndarray, optional
bin_edges : int or ndarray
If bin_edges is an int, it defines the number of
equal-width bins in the given range. If bins is
a sequence, it defines a monotonically increasing
Expand Down Expand Up @@ -2272,15 +2232,15 @@ def plot_histogram_featurewise(
DataFrame of the features containing the variable
as column.

bin_edges : int or ndarray, optional
bin_edges : int or ndarray
If bin_edges is an int, it defines the number of
equal-width bins in the given range. If bins is
a sequence, it defines a monotonically increasing
array of bin edges, including the rightmost edge.

variable : string
variable : str
Column of the DataFrame with the variable on which the
histogram is to be based on. Default is None.
histogram is to be based on.

axes : matplotlib.axes.Axes, optional
Matplotlib axes to plot on. Default is None.
Expand Down