Skip to content

Commit

Permalink
Merge pull request #190 from jswhit/v2.1.4rel
Browse files Browse the repository at this point in the history
V2.1.4rel
  • Loading branch information
jswhit authored Sep 17, 2021
2 parents 662e47c + b6b8074 commit ab17515
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 13 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Test Linux/Windows/MacOSX

on:
pull_request:
push:
branches: [master]

jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ "3.6", "3.7", "3.8", "3.9"]
os: [ubuntu-latest, windows-latest, macos-latest]
platform: [x64, x32]
# debug on a single os/platform/python version
# python-version: [ "3.9"]
# os: [ubuntu-latest]
# platform: [x64]
exclude:
- os: macos-latest
platform: x32
- os: macos-latest
python-version: "3.6"
- os: windows-latest
python-version: "3.6"
steps:
- uses: actions/checkout@v2

- name: Setup Conda
uses: s-weigand/setup-conda@v1
with:
activate-conda: false
conda-channels: conda-forge

- name: Python ${{ matrix.python-version }}
shell: bash -l {0}
run: |
conda create --name TEST python=${{ matrix.python-version }} numpy cython pip pytest wheel pyproj eccodes --strict-channel-priority
source activate TEST
pip install -e . --no-deps --force-reinstall
conda info --all
conda list
- name: Tests
shell: bash -l {0}
run: |
source activate TEST
#if [ "windows-latest" == "${{ matrix.os }}" ]; then
# export ECCODES_DEFINITION_PATH=$CONDA_PREFIX/Library/share/eccodes/definitions
#fi
cd test
python test.py
pytest -vv test_latlons.py
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ jobs:
PROJ_LIB: /usr/share/proj
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9"]
#python-version: ["3.6", "3.7", "3.8", "3.9"]
python-version: ["3.9"]
steps:

- uses: actions/checkout@v2
Expand Down Expand Up @@ -53,8 +54,8 @@ jobs:
python setup.py install
- name: Test
run: |
export MPLBACKEND=agg
cd test
export MPLBACKEND=agg
pytest test*py --mpl --mpl-baseline-path=baseline_images
# if no mpl/cartopy run this
#pytest test.py test_latlons.py
Expand Down
3 changes: 2 additions & 1 deletion Changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version 2.1.4 (not yet released)
version 2.1.4 (git tag v2.1.4rel)(
================================
* move conftest.py to test dir (so tests can be run from there)
* add check-manifest test to github actions workflow.
Expand All @@ -7,6 +7,7 @@ version 2.1.4 (not yet released)
* add windows and macos x tests.
* make sure gribmessage.__repr__ doesn't fail is shapeOfTheEarth parameter
is missing (issue #177).
* move private eccodes dir inside 'share', so `import eccodes` doesn't import an empty package.

version 2.1.3 (git tag v2.1.3rel)
================================
Expand Down
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ def extract_version(CYTHON_FNAME):


def package_files(directory):
owd = os.getcwd()
os.chdir(os.path.join('src','pygrib'))
paths = []
for (path, directories, filenames) in os.walk(directory):
for filename in filenames:
paths.append(os.path.join("..", path, filename))
paths.append(os.path.join(path, filename))
os.chdir(owd)
return paths


package_data = {}
if os.environ.get("PYGRIB_WHEEL") is not None:
package_data[""] = package_files("eccodes")
package_data={'':package_files('share')}
else:
package_data={}

cmdclass = {"build_ext": NumpyBuildExtCommand}

Expand Down
6 changes: 4 additions & 2 deletions src/pygrib/_pygrib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,16 @@ def set_definitions_path(object eccodes_definition_path):
if 'ECCODES_DEFINITION_PATH' in os.environ:
_eccodes_datadir = os.environ['ECCODES_DEFINITION_PATH']
else:
_tmp_path = os.path.join('eccodes','definitions')
_definitions_path = os.path.join(os.path.join(os.path.dirname(__file__),'..'),_tmp_path)
# definitions at level of package dir
_tmp_path = os.path.join('share','eccodes','definitions')
_definitions_path = os.path.join(os.path.dirname(__file__),_tmp_path)
# if definitions path exists inside pygrib installation (as it does when installed
# via a binary wheel) tell eccodes to use internal eccodes definitions.
if os.path.isdir(_definitions_path):
_eccodes_datadir = os.sep.join([_definitions_path])
else:
_eccodes_datadir = None

if _eccodes_datadir is not None:
set_definitions_path(_eccodes_datadir)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/test_gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
def test_gaussian():
fig = plt.figure()
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=0))
ax.coastlines()
ax.coastlines(zorder=2)
ax.contourf(lons,lats,data,15)
# plot location of every 4th grid point
plt.scatter(lons[::4,::4].ravel(),lats[::4,::4].ravel(),1,marker='o',color='k',zorder=10)
Expand Down
6 changes: 3 additions & 3 deletions test/test_reglatlon.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
def test_reglatlon1():
fig = plt.figure()
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=0))
ax.coastlines()
ax.coastlines(zorder=2)
ax.contourf(lons,lats,data,15,cmap=plt.cm.hot_r)
plt.title('%s Global Lat/Lon Grid' % grb.name)
return fig
Expand All @@ -31,7 +31,7 @@ def test_reglatlon1():
def test_reglatlon2():
fig = plt.figure()
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=0))
ax.coastlines()
ax.coastlines(zorder=2)
ax.contourf(lons,lats,data2,15)
plt.title('%s Global Lat/Lon Grid' % grb2.name)
return fig
Expand All @@ -44,7 +44,7 @@ def test_reglatlon3():
fig = plt.figure()
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=0))
ax.set_extent([lon1,lon2,lat1,lat2],crs=ccrs.PlateCarree())
ax.coastlines()
ax.coastlines(zorder=2)
ax.contourf(lonsubset,latsubset,datsubset,15,cmap=plt.cm.hot_r)
plt.title('%s Regional Lat/Lon Grid' % grb.name)
return fig
Expand Down

0 comments on commit ab17515

Please sign in to comment.