Skip to content

Commit

Permalink
Merge pull request #70 from ocefpaf/update_numpy
Browse files Browse the repository at this point in the history
use numpy >=1.20
  • Loading branch information
kwilcox authored Mar 13, 2023
2 parents 11ad6b8 + a286f2d commit 39a3767
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 101 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
labels:
- "Bot"
84 changes: 0 additions & 84 deletions .github/workflows/push.yml

This file was deleted.

18 changes: 11 additions & 7 deletions .github/workflows/publish.yml → .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@
name: Publish to PyPI

on:
pull_request:
push:
branches:
- main
release:
types:
- published

jobs:

pypi-build:
packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.x
python-version: "3.10"

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
Expand All @@ -37,12 +40,13 @@ jobs:

- name: Test wheels
run: |
cd dist && python -m pip install pocean_core*.whl
cd dist && python -m pip install *.whl
python -m twine check *
shell: bash

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
if: success() && github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
38 changes: 38 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Tests

on:
pull_request:
push:
branches: [main]

jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: [windows-latest, ubuntu-latest, macos-latest]
fail-fast: false

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Micromamba
uses: mamba-org/provision-with-micromamba@v15
with:
environment-file: false

- name: Python ${{ matrix.python-version }}
shell: bash -l {0}
run: >
micromamba create --name TEST python=${{ matrix.python-version }} --file requirements.txt --file requirements-dev.txt --channel conda-forge
&& micromamba activate TEST
&& python -m pip install -e . --no-deps --force-reinstall
- name: Tests
shell: bash -l {0}
run: >
micromamba activate TEST
&& python -m pytest --disable-warnings
4 changes: 2 additions & 2 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.1.0
rev: v4.4.0
hooks:
- id: end-of-file-fixer
files: .*\.*.py
Expand All @@ -18,6 +18,6 @@ repos:
- requirements-dev.txt

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
rev: 6.0.0
hooks:
- id: flake8
2 changes: 1 addition & 1 deletion pocean/dsg/timeseriesProfile/r.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def from_dataframe(cls, df, output, **kwargs):
profile[j] = pname
row_size[j] = len(pfg)
if s_ind is not None:
s_ind[j] = np.asscalar(np.argwhere(station[:] == pfg[axes.station].dropna().iloc[0]))
s_ind[j] = np.argwhere(station[:] == pfg[axes.station].dropna().iloc[0]).item()

# Add back in the z axes that was removed when calculating data_columns
# and ignore variables that were stored in the profile index
Expand Down
3 changes: 3 additions & 0 deletions pocean/dsg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def get_geographic_attributes(df, axes=None):

if len(set(coords)) == 1:
geoclass = Point
# The set is to workaround the fact tht pocean
# relied in a shapely<2 bug to pass a vector here instead of a point.
coords = set(coords)
elif len(coords) > 2:
geoclass = Polygon
else:
Expand Down
2 changes: 1 addition & 1 deletion pocean/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def create_ncvar_from_series(ncd, var_name, dimensions, series, **kwargs):
elif series.dtype.kind in ['U', 'S'] or series.dtype in [str]:
# AttributeError: cannot set _FillValue attribute for VLEN or compound variable
v = ncd.createVariable(var_name, get_dtype(series), dimensions, **kwargs)
elif series.dtype == np.object:
elif series.dtype == object:
# Try to downcast to an int and then just take the type of the result
# If we can't convert to a numeric use a string
try:
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cftime>=1.2.1
netcdf4
numpy>=1.15
netcdf4<1.6.1
numpy>=1.20
pandas>=1.0.5
python-dateutil
pytz
Expand Down
9 changes: 5 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ classifiers =
packages = find:
install_requires =
cftime>=1.2.1
netcdf4
numpy>=1.15
netcdf4<1.6.1
numpy>=1.20
pandas>=1.0.5
python-dateutil
pytz
Expand All @@ -53,8 +53,9 @@ filterwarnings =
max-line-length = 100
ignore =
E265 E501 E221 E203 E201 E124 E202 E241 E251 W293 W291 W504
pocean/tests/*.py F403 F405
pocean/tests/*.py F403 F405
per-file-ignores =
pocean/tests/*.py: F403 F405
pocean/tests/*.py: F403 F405
exclude =
docs/
.git/
Expand Down

0 comments on commit 39a3767

Please sign in to comment.