Skip to content

Commit

Permalink
Merge branch 'main' into plot-track
Browse files Browse the repository at this point in the history
  • Loading branch information
ocefpaf authored Jun 12, 2024
2 parents 80f6759 + 8de0bec commit dca1524
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Deploy
if: success() && github.event_name == 'release'
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: check-ast
Expand All @@ -14,7 +14,7 @@ repos:
files: requirements-dev.txt

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.10.0
hooks:
- id: mypy
exclude: docs/source/conf.py
Expand All @@ -27,14 +27,14 @@ repos:
- id: blackdoc

- repo: https://github.com/econchick/interrogate
rev: 237be78f9c6135fc1a620d211cdfdc5d3885082b
rev: 1.7.0
hooks:
- id: interrogate
exclude: ^(docs|tests)
args: [--config=pyproject.toml]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
exclude: >
Expand All @@ -50,14 +50,14 @@ repos:
- id: add-trailing-comma

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
rev: v0.4.7
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
rev: 1.8.5
hooks:
- id: nbqa-check-ast
- id: nbqa-black
Expand All @@ -73,7 +73,7 @@ repos:
- id: nb-strip-paths

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0
rev: 2.1.3
hooks:
- id: pyproject-fmt

Expand Down
5 changes: 2 additions & 3 deletions gliderpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
__version__ = "unknown"

from .plotting import plot_track
from .plotting import plot_transect
from .fetchers import GliderDataFetcher

from .plotting import plot_transect

__all__ = [
"GliderDataFetcher",
"plot_track",
"plot_transect",
]
]
5 changes: 4 additions & 1 deletion gliderpy/fetchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def standardise_df(glider_df: pd.DataFrame, dataset_url: str) -> pd.DataFrame:
glider_df.columns = glider_df.columns.str.lower()
glider_df = glider_df.set_index("time (utc)")
glider_df = glider_df.rename(columns=server_parameter_rename)
glider_df.index = pd.to_datetime(glider_df.index)
glider_df.index = pd.to_datetime(
glider_df.index,
format="%Y-%m-%dT%H:%M:%SZ",
)
# We need to sort b/c of the non-sequential submission of files due to
# the nature of glider data transmission.
glider_df = glider_df.sort_index()
Expand Down
2 changes: 0 additions & 2 deletions gliderpy/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,3 @@ def plot_transect(
cbar.ax.set_ylabel(var)
ax.set_ylabel("pressure")
return fig, ax


39 changes: 23 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=42",
"setuptools_scm[toml]>=3.4",
"setuptools-scm[toml]>=3.4",
"wheel",
]

[project]
name = "gliderpy"
description = "Glider Data Fetcher"
readme = "README.md"
license = {file = "LICENSE.txt"}
license = { file = "LICENSE.txt" }
maintainers = [
{name = "Callum Rollo", email = "[email protected]"},
{name = "Lindsay Abrams"},
{name = "Filipe Fernandes"},
{ name = "Callum Rollo", email = "[email protected]" },
{ name = "Lindsay Abrams" },
{ name = "Filipe Fernandes" },
]
requires-python = ">=3.10"
classifiers = [
Expand All @@ -27,18 +27,21 @@ dynamic = [
"dependencies",
"version",
]
[project.urls]
documentation = "https://ioos.github.io/gliderpy"
homepage = "https://github.com/ioos/gliderpy"
repository = "https://github.com/ioos/gliderpy"
urls.documentation = "https://ioos.github.io/gliderpy"
urls.homepage = "https://github.com/ioos/gliderpy"
urls.repository = "https://github.com/ioos/gliderpy"

[tool.setuptools]
packages = ["gliderpy"]
packages = [
"gliderpy",
]
include-package-data = true

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
readme = {file = "README.md", content-type = "text/markdown"}
dependencies = { file = [
"requirements.txt",
] }
readme = { file = "README.md", content-type = "text/markdown" }

[tool.setuptools_scm]
write_to = "gliderpy/_version.py"
Expand All @@ -60,9 +63,9 @@ ignore = [

[tool.pytest.ini_options]
filterwarnings = [
"error:::gliderpy.*",
"ignore::UserWarning",
"ignore::RuntimeWarning",
"error:::gliderpy.*",
"ignore::UserWarning",
"ignore::RuntimeWarning",
]

[tool.interrogate]
Expand All @@ -73,7 +76,11 @@ ignore-semiprivate = false
ignore-private = false
ignore-module = false
fail-under = 95
exclude = ["setup.py", "docs", "tests"]
exclude = [
"setup.py",
"docs",
"tests",
]
verbose = 1
quiet = false
color = true
Binary file modified tests/baseline/test_plot_transect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions tests/test_plotting.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
"""Test transect."""

import pytest
import matplotlib as mpl
from pathlib import Path

from gliderpy.plotting import plot_track
from gliderpy.plotting import plot_transect


import pytest

from gliderpy.fetchers import GliderDataFetcher

root = Path(__file__).parent


@pytest.mark.mpl_image_compare(baseline_dir=root.joinpath("baseline/"))
def test_plot_track():
glider_grab = GliderDataFetcher()
Expand All @@ -30,7 +34,7 @@ def test_plot_transect():
glider_grab.fetcher.dataset_id = "whoi_406-20160902T1700"
df = glider_grab.to_pandas()
# Generate the plot
fig, ax = plot_transect(df, 'temperature')
fig, ax = plot_transect(df, "temperature")

# Return the figure for pytest-mpl to compare
return fig

0 comments on commit dca1524

Please sign in to comment.