Skip to content

Commit

Permalink
Merge pull request #125 from oceanmodeling/dev
Browse files Browse the repository at this point in the history
Unify IOC/COOPS API
  • Loading branch information
pmav99 authored Jun 26, 2024
2 parents 5c4dd83 + 536ddbc commit e29e879
Show file tree
Hide file tree
Showing 26 changed files with 3,193 additions and 855 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/install_from_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Test installation from PyPI"

on:
workflow_dispatch:
schedule:
- cron: "4 5 * * *" # Every day at 05:04

jobs:
test_pypi_installation:
name: test PyPI installation
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: "ubuntu-latest"
python: "3.12"
steps:
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: ${{ matrix.python }}
# Debug
- run: type -a python
- run: python --version
- run: python -m pip --version
- run: python -m pip cache info
# Install the package from pypi
- run: python -m pip install searvey
- run: python -m pip freeze
# Checkout the version of code that got installed from PyPI
- run: git fetch --tags
- run: git checkout v$(python -c 'import importlib.metadata; print(importlib.metadata.version("searvey"))')
# Install test dependencies
- run: pip install -U $(cat requirements/requirements-dev.txt| grep --extended-regexp 'pytest=|pytest-recording=|urllib3=' | cut -d ';' -f1)
# Remove the source code (just to be sure that it is not being used)
- run: rm -rf searvey
# Run the tests
- run: make test
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ repos:
- id: "shellcheck"

- repo: "https://github.com/python-jsonschema/check-jsonschema"
rev: "0.28.3"
rev: "0.28.5"
hooks:
- id: "check-github-workflows"
- id: "check-readthedocs"

- repo: "https://github.com/asottile/reorder_python_imports"
rev: "v3.12.0"
rev: "v3.13.0"
hooks:
- id: "reorder-python-imports"
args:
Expand All @@ -60,7 +60,7 @@ repos:

- repo: "https://github.com/charliermarsh/ruff-pre-commit"
# Ruff version.
rev: 'v0.4.4'
rev: 'v0.4.9'
hooks:
- id: "ruff"

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ clean_notebooks:
pre-commit run nbstripout -a

exec_notebooks:
python -m nbconvert --to notebook --execute --ExecutePreprocessor.kernel_name=python3 --stdout examples/* >/dev/null
pytest --ff --nbmake --nbmake-timeout=90 --nbmake-kernel=python3 $$(git ls-files | grep ipynb)

docs:
make -C docs html
Expand Down
7 changes: 7 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,17 @@ def repository_root(path: PathLike = None) -> Path:
"sphinx.ext.autosummary",
# The Napoleon extension allows for nicer argument formatting.
"sphinx.ext.napoleon",
"sphinx_autodoc_typehints",
"sphinxext.opengraph",
"m2r2",
]

# sphinx_autodoc_typehints settings
always_use_bars_union = True
typehints_use_rtype = False
typehints_use_signature = False
typehints_use_signature_return = False

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down
6 changes: 6 additions & 0 deletions docs/source/coops.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@ CO-OPS query class
The ``COOPS_Query`` class lets you send an individual query to the CO-OPS API by specifying a station, data product, and time interval.

.. autoclass:: searvey.coops.COOPS_Query

New API
-------

.. autofunction:: searvey.get_coops_stations
.. autofunction:: searvey.fetch_coops_station
13 changes: 9 additions & 4 deletions docs/source/ioc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ website is focused on operational monitoring of sea level measuring stations acr
`Intergovernmental Oceanographic Commission (IOC) <https://ioc.unesco.org>`_ aggregating data from more than 170 providers.


A list of IOC stations is provided with the ``get_ioc_stations()`` function with various subsetting options.
A DataFrame with the IOC station metadata can be retrieved with ``get_ioc_stations()``
while the station data can be fetched with ``fetch_ioc_station()``:

.. autofunction:: searvey.ioc.get_ioc_stations
.. autofunction:: searvey.get_ioc_stations

The station data can be retrieved with

.. autofunction:: searvey.ioc.get_ioc_data
.. autofunction:: searvey.fetch_ioc_station

Deprecated API
``````````````

.. autofunction:: searvey.get_ioc_data
Loading

0 comments on commit e29e879

Please sign in to comment.