Skip to content

Commit

Permalink
Release 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Sep 29, 2023
2 parents 0e7c475 + 14f3f51 commit ac08ddf
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 58 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: cd

on:
push:
tags:
- '**'

jobs:
pypi:
uses: ecmwf-actions/reusable-workflows/.github/workflows/cd-pypi.yml@v2
secrets: inherit
49 changes: 7 additions & 42 deletions .github/workflows/check-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
method: ["conda", "ecmwflibs"]
python-version: ['3.8', '3.9', '3.10', '3.11']
method: ['conda', 'ecmwflibs']
exclude:
- platform: macos-latest
python-version: "3.9"
method: "ecmwflibs"
python-version: '3.9'
method: 'ecmwflibs'

name: Python ${{ matrix.python-version }} on ${{ matrix.platform }} (${{ matrix.method }})
runs-on: ${{ matrix.platform }}
Expand Down Expand Up @@ -79,8 +79,8 @@ jobs:
- run: pytest
if: matrix.method == 'conda' && matrix.platform == 'windows-latest'
env:
ECCODES_DEFINITION_PATH: "C:/Miniconda/Library/share/eccodes/definitions"
ECCODES_SAMPLES_PATH: "C:/Miniconda/Library/share/eccodes/samples"
ECCODES_DEFINITION_PATH: 'C:/Miniconda/Library/share/eccodes/definitions'
ECCODES_SAMPLES_PATH: 'C:/Miniconda/Library/share/eccodes/samples'

- run: pytest
if: matrix.method != 'conda' || matrix.platform != 'windows-latest'
Expand All @@ -89,39 +89,4 @@ jobs:

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: "false"

deploy:
if: ${{ github.event_name == 'release' }}

name: Upload to Pypi
needs: checks

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Check version
run: |
release=${GITHUB_REF##*/}
version=$(python setup.py --version)
test "$release" == "$version"
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist
twine upload dist/*
if: 'false'
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Changelog for eccodes-python
============================

1.6.1 (2023-10-02)
--------------------

- ECC-1693: Update minimum recommended version
- Fix flake8 warning E721

1.6.0 (2023-07-11)
--------------------
Expand Down
4 changes: 2 additions & 2 deletions gribapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from .gribapi import __version__, lib

# The minimum recommended version for the ecCodes package
min_recommended_version_str = "2.21.0"
min_recommended_version_int = 22100
min_recommended_version_str = "2.31.0"
min_recommended_version_int = 23100

if lib.grib_get_api_version() < min_recommended_version_int:
import warnings
Expand Down
2 changes: 1 addition & 1 deletion gribapi/bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import cffi

__version__ = "1.6.0"
__version__ = "1.6.1"

LOG = logging.getLogger(__name__)

Expand Down
6 changes: 3 additions & 3 deletions gribapi/gribapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ def grib_index_get_long(indexid, key):
\b Examples: \ref grib_index.py "grib_index.py"
@param indexid id of an index created from a file. The index must have been created with the key in argument.
@param key key for wich the values are returned
@param key key for which the values are returned
@return tuple with values of key in index
@exception CodesInternalError
"""
Expand All @@ -1475,7 +1475,7 @@ def grib_index_get_string(indexid, key):
\b Examples: \ref grib_index.py "grib_index.py"
@param indexid id of an index created from a file. The index must have been created with the key in argument.
@param key key for wich the values are returned
@param key key for which the values are returned
@return tuple with values of key in index
@exception CodesInternalError
"""
Expand All @@ -1502,7 +1502,7 @@ def grib_index_get_double(indexid, key):
\b Examples: \ref grib_index.py "grib_index.py"
@param indexid id of an index created from a file. The index must have been created with the key in argument.
@param key key for wich the values are returned
@param key key for which the values are returned
@return tuple with values of key in index
@exception CodesInternalError
"""
Expand Down
30 changes: 20 additions & 10 deletions tests/test_eccodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ def test_codes_set_samples_path():

def test_api_version():
vs = eccodes.codes_get_api_version()
assert type(vs) == str
assert type(vs) is str
assert len(vs) > 0
assert vs == eccodes.codes_get_api_version(str)
vi = eccodes.codes_get_api_version(int)
assert type(vi) == int
assert type(vi) is int
assert vi > 20000
print(vi)

Expand Down Expand Up @@ -276,23 +276,27 @@ def test_grib_get_array():
assert pls == ["ecmf"]
dvals = eccodes.codes_get_array(gid, "values")
assert len(dvals) == 138346
assert type(dvals[0]) == np.float64
assert type(dvals[0]) is np.float64
eccodes.codes_release(gid)


def _test_grib_get_array_single_precision():
def test_grib_get_array_single_precision():
if eccodes.codes_get_api_version(int) < 23100:
print("Test skipped (ecCodes version too old)")
return

gid = eccodes.codes_grib_new_from_samples("reduced_gg_pl_160_grib2")

dvals = eccodes.codes_get_array(gid, "values", ktype=float)
assert type(dvals[0]) == np.float64
assert type(dvals[0]) is np.float64
fvals = eccodes.codes_get_array(gid, "values", ktype=np.float32)
assert type(fvals[0]) == np.float32
assert type(fvals[0]) is np.float32
fvals = eccodes.codes_get_float_array(gid, "values")
assert type(fvals[0]) == np.float32
assert type(fvals[0]) is np.float32
dvals = eccodes.codes_get_values(gid)
assert type(dvals[0]) == np.float64
assert type(dvals[0]) is np.float64
fvals = eccodes.codes_get_values(gid, np.float32)
assert type(fvals[0]) == np.float32
assert type(fvals[0]) is np.float32

eccodes.codes_release(gid)

Expand Down Expand Up @@ -853,7 +857,11 @@ def test_codes_bufr_key_is_header():
assert not eccodes.codes_bufr_key_is_header(bid, "#6#brightnessTemperature")


def _test_codes_bufr_key_is_coordinate():
def test_codes_bufr_key_is_coordinate():
if eccodes.codes_get_api_version(int) < 23100:
print("Test skipped (ecCodes version too old)")
return

bid = eccodes.codes_bufr_new_from_samples("BUFR4")
assert not eccodes.codes_bufr_key_is_coordinate(bid, "edition")

Expand All @@ -865,6 +873,8 @@ def _test_codes_bufr_key_is_coordinate():
assert eccodes.codes_bufr_key_is_coordinate(bid, "#14#timePeriod")
assert not eccodes.codes_bufr_key_is_coordinate(bid, "dewpointTemperature")

eccodes.codes_release(bid)


def test_bufr_extract_headers():
fpath = get_sample_fullpath("BUFR4_local.tmpl")
Expand Down

0 comments on commit ac08ddf

Please sign in to comment.