diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18b06ab..b5cd26f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: - name: tests run: | - python -m pytest + python -m pytest --mpl link-check: runs-on: ubuntu-latest diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 0731d88..0000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - branches: - - main - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - - uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index 8326f48..64e8815 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -49,7 +49,7 @@ jobs: python -m twine check dist/* - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@v1.9.0 + uses: pypa/gh-action-pypi-publish@v1.12.4 with: skip-existing: true verbose: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8174368..3688cec 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,19 @@ repos: -- repo: https://github.com/pre-commit/mirrors-yapf # To format the code to conform YAPF - rev: v0.31.0 +- repo: https://github.com/google/yapf # To format the code to conform YAPF + rev: v0.43.0 hooks: - id: yapf args: ['--in-place', '--recursive', '--style', 'google'] + require_serial: true -- repo: https://github.com/myint/docformatter # To format the doc strings to conform PEP257 - rev: v1.4 - hooks: - - id: docformatter - args: [--in-place] - +# - repo: https://github.com/PyCQA/docformatter # To format the doc strings to conform PEP257 +# rev: v1.7.5 +# hooks: +# - id: docformatter +# args: [--in-place] +# - repo: https://github.com/pre-commit/pre-commit-hooks # Some common pre-commit hooks - rev: v3.4.0 + rev: v5.0.0 hooks: - id: check-yaml # Checks the syntax of .yaml files. args: [--allow-multiple-documents] @@ -20,3 +21,8 @@ repos: - id: end-of-file-fixer # Makes sure files end with a newline. - id: trailing-whitespace # Checks for any tabs or spaces after the last non-whitespace character on the line. - id: check-docstring-first # Checks that code comes after the docstrings. + - id: check-yaml # Check valid yml file + +ci: + autofix_prs: false + autoupdate_schedule: monthly diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 0067790..e315366 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -25,7 +25,7 @@ Examples of behaviors that contribute to a positive environment include: Examples of unacceptable behavior include, but are not limited to: - Harassment, intimidation, or discrimination in any form -- Physical, verbal, or written abuse by anyone to anyone, including repeated use of pronouns other than those requested +- Physical, verbal, or written abuse by anyone to anyone - Unwelcome sexual attention or advances - Personal attacks directed at other guests, members, participants, etc. - Publishing others’ private information, such as a physical or electronic address, without explicit permission @@ -68,9 +68,8 @@ Upon receipt of a complaint, the project administrator(s) may take any action de circumstances. Such action can include things such as: removing, editing, or rejecting comments, commits, code, wiki edits, email, issues, and other contributions that are not aligned to this Code of Conduct, or banning temporarily or permanently any contributor for other behaviors that are deemed inappropriate, threatening, offensive, or harmful. Project administrators -also have the right to report violations to UCAR HR and/or UCAR’s Office of Diversity, Equity and Inclusion (ODEI), as well -as a participant’s home institution and/or law enforcement. In the event an incident is reported to UCAR, UCAR will follow -its Harassment Reporting and Complaint Procedure. +also have the right to report violations to UCAR HR, as well as a participant’s home institution and/or law enforcement. In +the event an incident is reported to UCAR, UCAR will follow its Harassment Reporting and Complaint Procedure. ## Attribution @@ -79,4 +78,4 @@ Participant Code of Conduct, which also borrows from the American Geophysical Un Code of Conduct applies to both UCAR employees as well as participants in activities run by UCAR. The original version of this for all software projects that have strong management from UCAR or UCAR staff is available on the UCAR website at [https://doi.org/10.5065/6w2c-a132](https://doi.org/10.5065/6w2c-a132). The date that it was adopted by this project was 2 -October 2023. When responding to complaints, UCAR HR and ODEI will do so based on the latest published version. +October 2023. When responding to complaints, UCAR HR will do so based on the latest published version. diff --git a/build_envs/docs.yml b/build_envs/docs.yml index 0d8b419..5694370 100644 --- a/build_envs/docs.yml +++ b/build_envs/docs.yml @@ -13,7 +13,7 @@ dependencies: - myst-nb - nbsphinx - sphinx-design - - xarray + - xarray!=2024.11.0 - geocat-datafiles - pip: - -e .. diff --git a/docs/citation.rst b/docs/citation.rst index 1e1b243..139cc53 100644 --- a/docs/citation.rst +++ b/docs/citation.rst @@ -11,33 +11,24 @@ users to access older releases. This ensures that users are not only able to cit software version through DOIs but are also able to download & use the corresponding release for reproducibility purposes. -Please find DOIs for all the GeoCAT-viz versions `here -`_. +DOIs for all the GeoCAT-viz versions can be found `here on Zenodo +`_. +Example citations +^^^^^^^^^^^^^^^^^ -If you would like to cite GeoCAT-viz as a whole (without referring to a specific version), use -the following text: - - **Visualization & Analysis Systems Technologies. (2020). - Geoscience Community Analysis Toolkit: GeoCAT-viz [Software]. - Boulder, CO: NSF NCAR Computational and Information Systems Lab. doi:10.5281/zenodo.6678345.** - -Instead, if you would like to cite a specific version of GeoCAT-viz, use the following text: - - **Visualization & Analysis Systems Technologies. (\). - Geoscience Community Analysis Toolkit: GeoCAT-viz (v\) [Software]. - Boulder, CO, USA: NSF NCAR Computational and Information Systems Lab. doi:\.** - -In the above citation text, update the year, GeoCAT-viz version, and DOI as appropriate. For -example: +Citing a specific version of GeoCAT-viz: **Visualization & Analysis Systems Technologies. (2022). Geoscience Community Analysis Toolkit: GeoCAT-viz (v2022.05.0) [Software]. Boulder, CO, USA: NSF NCAR Computational and Information Systems Lab. doi:10.5281/zenodo.6678351.** -Please note: The DOI minting service, Zenodo, might be suggesting their own citation text (as -they are the publisher of such DOIs) in their website. We prefer the text we recommend here to be used; -however, either way is acceptable. +.. attention:: + + Requires updating the year, GeoCAT-viz version, and DOI + +Citing GeoCAT-viz without referring to a specific version: -For further information, please refer to -`GeoCAT homepage - Citation `_. + **Visualization & Analysis Systems Technologies. (2020). + Geoscience Community Analysis Toolkit: GeoCAT-viz [Software]. + Boulder, CO: NSF NCAR Computational and Information Systems Lab. doi:10.5281/zenodo.6678345.** diff --git a/docs/conf.py b/docs/conf.py index 4a2eaf4..fa0e53f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -212,20 +212,30 @@ def __getattr__(cls, name): # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -html_theme_options = dict( - # analytics_id='' this is configured in rtfd.io - # canonical_url="", - repository_url="https://github.com/NCAR/geocat-viz", - repository_branch="main", - path_to_docs="docs", - use_edit_page_button=True, - use_repository_button=True, - use_issues_button=True, - home_page_in_toc=False, - navbar_footer_text="", - extra_footer= - "This material is based upon work supported by the NSF National Center for Atmospheric Research, a major facility sponsored by the U.S. National Science Foundation and managed by the University Corporation for Atmospheric Research. Any opinions, findings and conclusions or recommendations expressed in this material do not necessarily reflect the views of the U.S. National Science Foundation.", -) +html_theme_options = { + "repository_url": + "https://github.com/NCAR/geocat-viz", + "repository_branch": + "main", + "path_to_docs": + "docs", + "use_edit_page_button": + True, + "use_repository_button": + True, + "use_issues_button": + True, + "home_page_in_toc": + False, + "navbar_footer_text": + "", + "logo": { + "image_light": '_static/images/logos/NSF_NCAR_light.svg', + "image_dark": '_static/images/logos/NSF_NCAR_dark.svg', + }, + "extra_footer": + "This material is based upon work supported by the NSF National Center for Atmospheric Research, a major facility sponsored by the U.S. National Science Foundation and managed by the University Corporation for Atmospheric Research. Any opinions, findings and conclusions or recommendations expressed in this material do not necessarily reflect the views of the U.S. National Science Foundation.", +} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] @@ -237,15 +247,6 @@ def __getattr__(cls, name): # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -html_theme_options = { - "logo": { - "image_light": '_static/images/logos/NSF_NCAR_light.svg', - "image_dark": '_static/images/logos/NSF_NCAR_dark.svg', - } -} - # The name of an image file (relative to this directory) to use as a favicon of # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. diff --git a/docs/examples/taylor.ipynb b/docs/examples/taylor.ipynb index 1f51d21..4aaf2ae 100644 --- a/docs/examples/taylor.ipynb +++ b/docs/examples/taylor.ipynb @@ -6,7 +6,7 @@ "source": [ "# `TaylorDiagram`\n", "\n", - "This notebook is a simple example of the GeoCAT-viz class `TaylorDiagram` class." + "This notebook is a simple example of the GeoCAT-viz class `TaylorDiagram` class." ] }, { diff --git a/docs/index.rst b/docs/index.rst index f034b7c..d344466 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -86,7 +86,6 @@ plotting packages. Release Notes Contributor's Guide - Roadmap .. toctree:: :maxdepth: 2 diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 21ee2d5..c38447e 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -5,12 +5,21 @@ Release Notes ============= -v2024.07.0 (unreleased) +v2024.xx.0 (unreleased) --------------------------- +Documentation +^^^^^^^^^^^^^ +* Remove link to broken NCL_vector_5.py example by `Katelyn FitzGerald`_ in (:pr:`249`) +* Fix documentation theme configuration by `Katelyn FitzGerald`_ in (:pr:`253`) +* Minor updates and removal of broken link on citation page by `Katelyn FitzGerald`_ in (:pr:`260`) +* Fix broken link to Taylor Diagram documentation from usage example by `Katelyn FitzGerald`_ in (:pr:`270`) + Internal Changes ^^^^^^^^^^^^^^^^ +* Update pre-commit versions and configuration by `Katelyn FitzGerald`_ in (:pr:`247`) * Remove M1 workaround for CI and tokens that are no longer needed by `Katelyn FitzGerald`_ in (:pr:`232`) +* Modify tests to avoid hitting an unrelated Xarray bug and turn on image comparison testing by `Katelyn FitzGerald`_ in (:pr:`257`) Testing ^^^^^^^ diff --git a/src/geocat/viz/taylor.py b/src/geocat/viz/taylor.py index ee77fc4..0911c2d 100644 --- a/src/geocat/viz/taylor.py +++ b/src/geocat/viz/taylor.py @@ -506,7 +506,8 @@ def add_ygrid(self, *arr*. - This method will be deprecated in favor of `TaylorDiagram.add_std_grid()` + This method will be deprecated in favor of + `TaylorDiagram.add_std_grid()` """ warnings.warn( diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index d0a3bb1..9f01242 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -282,8 +282,6 @@ def add_height_from_pressure_axis(ax, - `NCL_h_lat_6.py `_ - `NCL_h_lat_7.py `_ - - - `NCL_h_vector_5.py `_ """ # Create the right hand axis, inheriting from the left diff --git a/tests/baseline/test_plot_contour_labels.png b/tests/baseline/test_plot_contour_labels.png index 5ee8411..5b26a8f 100644 Binary files a/tests/baseline/test_plot_contour_labels.png and b/tests/baseline/test_plot_contour_labels.png differ diff --git a/tests/baseline/test_xr_add_cyclic_longitudes.png b/tests/baseline/test_xr_add_cyclic_longitudes.png index 8e8a5c8..6c50d7f 100644 Binary files a/tests/baseline/test_xr_add_cyclic_longitudes.png and b/tests/baseline/test_xr_add_cyclic_longitudes.png differ diff --git a/tests/test_taylor.py b/tests/test_taylor.py index a76069b..de7b310 100644 --- a/tests/test_taylor.py +++ b/tests/test_taylor.py @@ -6,9 +6,7 @@ from geocat.viz.taylor import TaylorDiagram -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_add_model_set(): fig = plt.figure(figsize=(10, 10)) taylor = TaylorDiagram(fig=fig, label='REF') @@ -21,9 +19,7 @@ def test_add_model_set(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_add_legend(): fig = plt.figure(figsize=(10, 10)) taylor = TaylorDiagram(fig=fig, label='REF') @@ -50,9 +46,7 @@ def test_add_legend(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_add_bias_legend(): fig = plt.figure(figsize=(10, 10)) taylor = TaylorDiagram(fig=fig, label='REF') @@ -72,9 +66,7 @@ def test_add_bias_legend(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_add_model_name(): fig = plt.figure(figsize=(10, 10)) taylor = TaylorDiagram(fig=fig, label='REF') @@ -94,9 +86,7 @@ def test_add_model_name(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_add_corr_grid(): fig = plt.figure(figsize=(10, 10)) taylor = TaylorDiagram(fig=fig, label='REF') @@ -116,9 +106,7 @@ def test_add_corr_grid(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_add_contours(): fig = plt.figure(figsize=(10, 10)) taylor = TaylorDiagram(fig=fig, label='REF') diff --git a/tests/test_util.py b/tests/test_util.py index d43f524..9346eb1 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -13,9 +13,7 @@ from geocat.viz.util import set_tick_direction_spine_visibility, add_lat_lon_gridlines, add_right_hand_axis, add_height_from_pressure_axis, add_lat_lon_ticklabels, add_major_minor_ticks, set_titles_and_labels, set_axes_limits_and_ticks, truncate_colormap, xr_add_cyclic_longitudes, set_map_boundary, find_local_extrema, plot_contour_labels, plot_extrema_labels, set_vector_density, get_skewt_vars -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_set_tick_direction_spine_visibility(): fig, ax = plt.subplots(figsize=(6, 6)) @@ -26,9 +24,7 @@ def test_set_tick_direction_spine_visibility(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_add_lat_lon_gridlines(): fig = plt.figure(figsize=(10, 10)) @@ -44,9 +40,7 @@ def test_add_lat_lon_gridlines(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_add_right_hand_axis(): fig = plt.figure(figsize=(9, 10)) ax1 = plt.gca() @@ -60,9 +54,7 @@ def test_add_right_hand_axis(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_add_height_from_pressure_axis(): fig = plt.figure(figsize=(8, 8)) ax = plt.axes() @@ -73,9 +65,7 @@ def test_add_height_from_pressure_axis(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_add_lat_lon_ticklabels(): fig = plt.figure(figsize=(12, 6)) @@ -87,9 +77,7 @@ def test_add_lat_lon_ticklabels(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_add_major_minor_ticks(): fig = plt.figure(figsize=(12, 6)) ax = plt.axes() @@ -101,9 +89,7 @@ def test_add_major_minor_ticks(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_set_titles_and_labels(): fig = fig, ax = plt.subplots() @@ -117,9 +103,7 @@ def test_set_titles_and_labels(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_set_axes_limits_and_ticks(): fig = fig, ax = plt.subplots() @@ -169,9 +153,7 @@ def test_xr_add_cyclic_longitudes_length(): assert len(U.lon) == len(cyclic_lon) -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_xr_add_cyclic_longitudes(): ds = xr.open_dataset(gdf.get("netcdf_files/slp.1963.nc"), decode_times=False) @@ -187,14 +169,11 @@ def test_xr_add_cyclic_longitudes(): p = wrap_pressure.plot.contour(ax=ax, transform=ccrs.PlateCarree(), linewidths=0.5, - cmap='black', add_labels=False) return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_set_map_boundary(): fig = plt.figure(figsize=(8, 8)) ax = plt.axes(projection=ccrs.NorthPolarStereo()) @@ -216,9 +195,7 @@ def test_find_local_extrema(): assert lmin == (2, 2) -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_plot_contour_labels(): ds = xr.open_dataset(gdf.get("netcdf_files/slp.1963.nc"), decode_times=False) @@ -233,7 +210,6 @@ def test_plot_contour_labels(): p = pressure.plot.contour(ax=ax, transform=ccrs.PlateCarree(), linewidths=0.5, - cmap='black', add_labels=False) contour_label_locations = [ @@ -250,9 +226,7 @@ def test_plot_contour_labels(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_plot_extrema_labels(): ds = xr.open_dataset(gdf.get("netcdf_files/slp.1963.nc"), decode_times=False) @@ -274,9 +248,7 @@ def test_plot_extrema_labels(): return fig -@pytest.mark.mpl_image_compare(tolerance=0.02, - remove_text=True, - style='default') +@pytest.mark.mpl_image_compare(tolerance=2, remove_text=True, style='default') def test_set_vector_density(): file_in = xr.open_dataset(gdf.get("netcdf_files/uv300.nc")) ds = file_in.isel(time=1, lon=slice(0, -1, 3), lat=slice(1, -1, 3))