Skip to content

Commit ab17515

Browse files
authored
Merge pull request #190 from jswhit/v2.1.4rel
V2.1.4rel
2 parents 662e47c + b6b8074 commit ab17515

File tree

8 files changed

+74
-13
lines changed

8 files changed

+74
-13
lines changed

.github/workflows/build-conda.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build and Test Linux/Windows/MacOSX
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
run:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
python-version: [ "3.6", "3.7", "3.8", "3.9"]
14+
os: [ubuntu-latest, windows-latest, macos-latest]
15+
platform: [x64, x32]
16+
# debug on a single os/platform/python version
17+
# python-version: [ "3.9"]
18+
# os: [ubuntu-latest]
19+
# platform: [x64]
20+
exclude:
21+
- os: macos-latest
22+
platform: x32
23+
- os: macos-latest
24+
python-version: "3.6"
25+
- os: windows-latest
26+
python-version: "3.6"
27+
steps:
28+
- uses: actions/checkout@v2
29+
30+
- name: Setup Conda
31+
uses: s-weigand/setup-conda@v1
32+
with:
33+
activate-conda: false
34+
conda-channels: conda-forge
35+
36+
- name: Python ${{ matrix.python-version }}
37+
shell: bash -l {0}
38+
run: |
39+
conda create --name TEST python=${{ matrix.python-version }} numpy cython pip pytest wheel pyproj eccodes --strict-channel-priority
40+
source activate TEST
41+
pip install -e . --no-deps --force-reinstall
42+
conda info --all
43+
conda list
44+
45+
- name: Tests
46+
shell: bash -l {0}
47+
run: |
48+
source activate TEST
49+
#if [ "windows-latest" == "${{ matrix.os }}" ]; then
50+
# export ECCODES_DEFINITION_PATH=$CONDA_PREFIX/Library/share/eccodes/definitions
51+
#fi
52+
cd test
53+
python test.py
54+
pytest -vv test_latlons.py

.github/workflows/build.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ jobs:
99
PROJ_LIB: /usr/share/proj
1010
strategy:
1111
matrix:
12-
python-version: ["3.6", "3.7", "3.8", "3.9"]
12+
#python-version: ["3.6", "3.7", "3.8", "3.9"]
13+
python-version: ["3.9"]
1314
steps:
1415

1516
- uses: actions/checkout@v2
@@ -53,8 +54,8 @@ jobs:
5354
python setup.py install
5455
- name: Test
5556
run: |
56-
export MPLBACKEND=agg
5757
cd test
58+
export MPLBACKEND=agg
5859
pytest test*py --mpl --mpl-baseline-path=baseline_images
5960
# if no mpl/cartopy run this
6061
#pytest test.py test_latlons.py

Changelog

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version 2.1.4 (not yet released)
1+
version 2.1.4 (git tag v2.1.4rel)(
22
================================
33
* move conftest.py to test dir (so tests can be run from there)
44
* add check-manifest test to github actions workflow.
@@ -7,6 +7,7 @@ version 2.1.4 (not yet released)
77
* add windows and macos x tests.
88
* make sure gribmessage.__repr__ doesn't fail is shapeOfTheEarth parameter
99
is missing (issue #177).
10+
* move private eccodes dir inside 'share', so `import eccodes` doesn't import an empty package.
1011

1112
version 2.1.3 (git tag v2.1.3rel)
1213
================================

setup.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,19 @@ def extract_version(CYTHON_FNAME):
3131

3232

3333
def package_files(directory):
34+
owd = os.getcwd()
35+
os.chdir(os.path.join('src','pygrib'))
3436
paths = []
3537
for (path, directories, filenames) in os.walk(directory):
3638
for filename in filenames:
37-
paths.append(os.path.join("..", path, filename))
39+
paths.append(os.path.join(path, filename))
40+
os.chdir(owd)
3841
return paths
3942

40-
41-
package_data = {}
4243
if os.environ.get("PYGRIB_WHEEL") is not None:
43-
package_data[""] = package_files("eccodes")
44+
package_data={'':package_files('share')}
45+
else:
46+
package_data={}
4447

4548
cmdclass = {"build_ext": NumpyBuildExtCommand}
4649

src/pygrib/_pygrib.pyx

+4-2
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,16 @@ def set_definitions_path(object eccodes_definition_path):
262262
if 'ECCODES_DEFINITION_PATH' in os.environ:
263263
_eccodes_datadir = os.environ['ECCODES_DEFINITION_PATH']
264264
else:
265-
_tmp_path = os.path.join('eccodes','definitions')
266-
_definitions_path = os.path.join(os.path.join(os.path.dirname(__file__),'..'),_tmp_path)
265+
# definitions at level of package dir
266+
_tmp_path = os.path.join('share','eccodes','definitions')
267+
_definitions_path = os.path.join(os.path.dirname(__file__),_tmp_path)
267268
# if definitions path exists inside pygrib installation (as it does when installed
268269
# via a binary wheel) tell eccodes to use internal eccodes definitions.
269270
if os.path.isdir(_definitions_path):
270271
_eccodes_datadir = os.sep.join([_definitions_path])
271272
else:
272273
_eccodes_datadir = None
274+
273275
if _eccodes_datadir is not None:
274276
set_definitions_path(_eccodes_datadir)
275277

File renamed without changes.

test/test_gaussian.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
def test_gaussian():
2020
fig = plt.figure()
2121
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=0))
22-
ax.coastlines()
22+
ax.coastlines(zorder=2)
2323
ax.contourf(lons,lats,data,15)
2424
# plot location of every 4th grid point
2525
plt.scatter(lons[::4,::4].ravel(),lats[::4,::4].ravel(),1,marker='o',color='k',zorder=10)

test/test_reglatlon.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
def test_reglatlon1():
2323
fig = plt.figure()
2424
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=0))
25-
ax.coastlines()
25+
ax.coastlines(zorder=2)
2626
ax.contourf(lons,lats,data,15,cmap=plt.cm.hot_r)
2727
plt.title('%s Global Lat/Lon Grid' % grb.name)
2828
return fig
@@ -31,7 +31,7 @@ def test_reglatlon1():
3131
def test_reglatlon2():
3232
fig = plt.figure()
3333
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=0))
34-
ax.coastlines()
34+
ax.coastlines(zorder=2)
3535
ax.contourf(lons,lats,data2,15)
3636
plt.title('%s Global Lat/Lon Grid' % grb2.name)
3737
return fig
@@ -44,7 +44,7 @@ def test_reglatlon3():
4444
fig = plt.figure()
4545
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=0))
4646
ax.set_extent([lon1,lon2,lat1,lat2],crs=ccrs.PlateCarree())
47-
ax.coastlines()
47+
ax.coastlines(zorder=2)
4848
ax.contourf(lonsubset,latsubset,datsubset,15,cmap=plt.cm.hot_r)
4949
plt.title('%s Regional Lat/Lon Grid' % grb.name)
5050
return fig

0 commit comments

Comments
 (0)