Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
SorooshMani-NOAA authored Jun 26, 2024
2 parents 18b6a92 + 0209bcd commit 48c6ecd
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: '3.x'
python-version: "3.x"
- uses: actions/cache@main
with:
path: ${{ env.pythonLocation }}
key: build-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'setup.*') }}
- run: pip wheel . --no-deps -w dist
- uses: pypa/gh-action-pypi-publish@master
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ repos:
- id: "shellcheck"

- repo: "https://github.com/python-jsonschema/check-jsonschema"
rev: "0.28.5"
rev: "0.28.6"
hooks:
- id: "check-github-workflows"
- id: "check-readthedocs"
Expand All @@ -60,7 +60,7 @@ repos:

- repo: "https://github.com/charliermarsh/ruff-pre-commit"
# Ruff version.
rev: 'v0.4.9'
rev: 'v0.4.10'
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:
pytest --nbmake --nbmake-timeout=60 --nbmake-kernel=python3 $$(git ls-files | grep ipynb)
pytest --ff --nbmake --nbmake-timeout=90 --nbmake-kernel=python3 $$(git ls-files | grep ipynb)

docs:
make -C docs html
Expand Down
32 changes: 20 additions & 12 deletions examples/IOC_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"source": [
"## Retrieve Station Metadata\n",
"\n",
"In order to retrieve station metadata we need to use the `get_ioc_stations()` function:"
"In order to retrieve station metadata we need to use the `get_ioc_stations()` function which returns a `geopandas.GeoDataFrame`:"
]
},
{
Expand All @@ -55,7 +55,7 @@
},
"outputs": [],
"source": [
"ioc_stations.sample(3).sort_index()"
"ioc_stations.columns"
]
},
{
Expand All @@ -67,7 +67,8 @@
},
"outputs": [],
"source": [
"ioc_stations.columns"
"with pd.option_context('display.max_columns', None):\n",
" ioc_stations.sample(3).sort_index()"
]
},
{
Expand Down Expand Up @@ -105,8 +106,8 @@
"outputs": [],
"source": [
"east_coast = shapely.geometry.box(-85, 25, -65, 45)\n",
"east_stations = searvey.get_ioc_stations(region=east_coast)\n",
"len(east_stations)"
"east_coast_stations = searvey.get_ioc_stations(region=east_coast)\n",
"len(east_coast_stations)"
]
},
{
Expand All @@ -118,7 +119,7 @@
},
"outputs": [],
"source": [
"east_stations.hvplot.points(geo=True, tiles=True)"
"east_coast_stations.hvplot.points(geo=True, tiles=True)"
]
},
{
Expand All @@ -128,7 +129,7 @@
"source": [
"## Retrieve IOC station data\n",
"\n",
"The function for retrieving data is called `fetch_ioc_station()`. \n",
"The function for retrieving data is called `fetch_ioc_station()` and it returns \n",
"\n",
"In its simplest form it only requires the station_id (i.e. IOC_CODE) and it will retrieve the last week of data:"
]
Expand Down Expand Up @@ -163,7 +164,6 @@
" station_id=\"alva\",\n",
" start_date=pd.Timestamp(\"2024-05-01\"),\n",
" end_date=pd.Timestamp(\"2024-05-10\"),\n",
" progress_bar=False,\n",
")\n",
"df"
]
Expand All @@ -175,7 +175,7 @@
"source": [
"If we request more than 30 days, then multiple HTTP requests are send to the IOC servers via multithreading and the responses are merged to a single dataframe. \n",
"\n",
"In this case, setting `progress_bar=True` can be useful in monitoring the progress of HTTP requests. \n",
"In this case, setting `progress_bar=True` can be helpful in monitoring the progress of the HTTP requests. \n",
"For example to retrieve data for the first 6 months of 2020:"
]
},
Expand All @@ -200,7 +200,7 @@
"id": "15",
"metadata": {},
"source": [
"Keep in mind that each IOC station may return dataframes with different sensors/columns. For example the station in Bahamas returns a bunch of them:"
"Keep in mind that each IOC station may return dataframes with different sensors/columns. For example the `setp1` station in Bahamas returns a bunch of them:"
]
},
{
Expand All @@ -224,7 +224,7 @@
"id": "17",
"metadata": {},
"source": [
"Furthermore, not all of these timeseries are ready to be used. \n",
"Nevertheless, the returned timeseries are **not** ready to be used. \n",
"\n",
"E.g. we see that in the last days of May the `rad` sensor was offline for some time:"
]
Expand All @@ -236,7 +236,15 @@
"metadata": {},
"outputs": [],
"source": [
"bahamas.rad.hvplot()"
"bahamas.rad.hvplot(grid=True)"
]
},
{
"cell_type": "markdown",
"id": "19",
"metadata": {},
"source": [
"So the IOC data **do** need some data-cleaning."
]
}
],
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ sphinx = "*"
sphinx-autodoc-typehints = "*"
sphinxext-opengraph = "*"
toml = "*"
sphinx-autodoc-typehints = "*"

[tool.poetry.group.jupyter.dependencies]
hvplot = {version = "*", extras = ["geo"]}
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ covdefaults==2.3.0 ; python_version >= "3.9" and python_version < "4.0"
coverage==7.5.3 ; python_version >= "3.9" and python_version < "4.0"
coverage[toml]==7.5.3 ; python_version >= "3.9" and python_version < "4.0"
cycler==0.12.1 ; python_version >= "3.9" and python_version < "4.0"
dask==2024.6.0 ; python_version >= "3.9" and python_version < "4.0"
dask==2024.6.2 ; python_version >= "3.9" and python_version < "4.0"
dataretrieval==1.0.9 ; python_version >= "3.9" and python_version < "4.0"
debugpy==1.8.1 ; python_version >= "3.9" and python_version < "4.0"
decorator==5.1.1 ; python_version >= "3.9" and python_version < "4.0"
Expand Down

0 comments on commit 48c6ecd

Please sign in to comment.