Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
python -m pip install -r docs/requirements.txt
- name: Build docs
run: ./.github/jobs/build_documentation.sh
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
if: always()
with:
name: documentation
path: artifact/documentation
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
if: failure()
with:
name: documentation_warnings.log
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Linkcheck
on:
schedule:
- cron: '0 6 * * 1'
pull_request:
paths:
- 'docs/**'
workflow_dispatch: {}

jobs:
linkcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtcenter/metplus-action-linkcheck@v1
with:
fail-on-broken-links: 'true'
upload-artifact: 'true'
install-package: 'true'
25 changes: 24 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,29 @@
numfig_format = {
'figure': 'Figure %s',
}


# -- linkcheck builder configuration ----------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-the-linkcheck-builder

linkcheck_timeout = 10
linkcheck_retries = 2
linkcheck_workers = 8

linkcheck_ignore = [
# add regex patterns for URLs that should be skipped, e.g.:
# r'https://dtcenter\.org/.*', # if this site blocks automated requests
# r'https://matplotlib\.org/.*', # occasionally rate-limits automated clients
# r'https://scitools\.org\.uk/cartopy/.*', # occasionally slow
# r'https://doi\.org/.*', # DOI redirectors often 403 non-browser requests
]

linkcheck_allowed_redirects = {
# map of regex -> regex for redirects that are fine to follow
}

linkcheck_anchors = True
linkcheck_anchors_ignore = ['^!']

# -- Export variables --------------------------------------------------------

rst_epilog = """
Expand All @@ -110,3 +132,4 @@
release_datestr = release_date,
release_yearstr = release_year)


5 changes: 5 additions & 0 deletions metplotpy/plots/base_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ def _add_legend(self, ax: plt.Axes, handles_and_labels=None, loc='upper center')

if not handles:
print("Warning: No labels found. Use ax.plot(..., label='name')")
return

# handle plots that only have a single boolean for show legend
show_legend = self.config_obj.show_legend
Expand All @@ -379,6 +380,10 @@ def _add_legend(self, ax: plt.Axes, handles_and_labels=None, loc='upper center')
filtered_handles = [h for h, show in zip(handles, show_legend) if show == 1]
filtered_labels = [l for l, show in zip(labels, show_legend) if show == 1]

# Check if there are any handles left to plot
if not filtered_handles:
return

legend = ax.legend(
handles=filtered_handles,
labels=filtered_labels,
Expand Down
2 changes: 1 addition & 1 deletion metplotpy/plots/taylor_diagram/taylor_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def _create_figure(self) -> None:

# in Matplotlib 3.10, the default for apply_theta_transforms=True has been deprecated, explicitly set this
# to True
tr = PolarAxes.PolarTransform(apply_theta_transforms=False)
tr = PolarAxes.PolarTransform()

# Correlation labels
rlocs = np.array([0, 0.2, 0.4, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99, 1])
Expand Down
2 changes: 1 addition & 1 deletion metplotpy/plots/tcmpr_plots/tcmpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def _add_legend(self, ax=None, handles_and_labels=None) -> None:
"""
if ax is None:
ax = self.ax
super()._add_legend(ax)
super()._add_legend(ax, handles_and_labels=handles_and_labels)

def _get_nstats(self) -> list:
"""
Expand Down
Loading