Skip to content

Commit

Permalink
Workflow fix 1 (#144)
Browse files Browse the repository at this point in the history
* Remove deprecated Basemap references
* Update conda environment file
* Update actions/checkout to v3, setup-miniconda to v2.2
* Leave shapely to dependencies
* Remove cartopy version, bump python version
* Stringify python version
  • Loading branch information
wcarthur authored Feb 12, 2024
1 parent 34e4aca commit 8793053
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 228 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tcrm-pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up environment
uses: conda-incubator/setup-miniconda@v2.0.0
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.7
mamba-version: "*"
miniforge-variant: Mambaforge
channels: conda-forge,defaults
channel-priority: true
activate-environment: tcrm
Expand All @@ -32,7 +32,7 @@ jobs:
pylint --rcfile pylintrc --fail-under=7 `find -regextype egrep -regex '(.*.py)$'` |
tee pylint.txt
- name: Upload pylint.txt as artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: pylint report
path: pylint.txt
9 changes: 5 additions & 4 deletions .github/workflows/tcrm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ['3.9', '3.10']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up environment
uses: conda-incubator/setup-miniconda@v2.0.0
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: MambaForge
python-version: ${{ matrix.python-version }}
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
activate-environment: tcrm
environment-file: tcrmenv.yml
auto-activate-base: false
use-only-tar-bz2: true


- name: Test with pytest
env:
PYTHONPATH: ~/tcrm;~/tcrm/Utilities
Expand Down
65 changes: 29 additions & 36 deletions Evaluate/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@

from matplotlib import pyplot, cm
from matplotlib.dates import date2num
from mpl_toolkits.basemap import Basemap
from cartopy import crs as ccrs
from cartopy import feature as cfeature
from scipy.stats import scoreatpercentile as percentile
from datetime import datetime

Expand Down Expand Up @@ -76,7 +77,7 @@
[ProcessMultipliers]
MaxWorkingThreads = 4
ProcessMultiVersion = 2
ProcessingSegmentSize = 256
ProcessingSegmentSize = 256
WarpMemoryLimit = 500
[Logging]
Expand Down Expand Up @@ -169,57 +170,49 @@ def plotDensity(x, y, data, llLon=None, llLat=None, urLon=None, urLat=None,
else:
urcrnrlat = y.max()

meridians = np.arange(dl * np.floor(llcrnrlon / dl),
dl * np.ceil(urcrnrlon / dl), dl)
parallels = np.arange(dl * np.floor(llcrnrlat / dl),
dl * np.ceil(urcrnrlat / dl), dl)

m = Basemap(projection='cyl',
resolution=res,
llcrnrlon=llcrnrlon,
urcrnrlon=urcrnrlon,
llcrnrlat=llcrnrlat,
urcrnrlat=urcrnrlat)

# Set the colour map:
if hasattr(cm, cmap):
cmap = getattr(cm, cmap)
else:
cmap = colours.colourMap(cmap, 'stretched')

if maskocean:
try:
from mpl_toolkits.basemap import maskoceans
except ImportError:
log.debug("Maskoceans module unavailable, skipping this command")
else:
datam = maskoceans(xx, yy, data, inlands=False)
m.pcolormesh(xx, yy, datam, edgecolors='None',
vmin=datarange[0], vmax=datarange[1],
cmap=cmap)
else:
m.pcolormesh(xx, yy, data, edgecolors='None',
vmin=datarange[0], vmax=datarange[1],
cmap=cmap)
ax = pyplot.axes(projection=ccrs.PlateCarree())
pyplot.pcolormesh(xx, yy, data, edgecolors='None',
vmin=datarange[0], vmax=datarange[1],
cmap=cmap, transfom=ccrs.PlateCarree())

m.drawcoastlines(linewidth=0.5)
if maskland:
m.fillcontinents(color='white')
ax.add_feature(cfeature.LAND, zorder=100, edgecolor='k')

if maskocean:
ax.add_feature(cfeature.OCEAN, zorder=100, edgecolor='k')

ax.coastlines(linewidth=0.5)
gl = ax.gridlines(draw_labels=True, crs=ccrs.PlateCarree(), linewidth=0.2)
gl.top_labels = False
gl.right_labels = False

ax.set_extent([llcrnrlon, urcrnrlon,
llcrnrlat, urcrnrlat])

cb = pyplot.colorbar(shrink=0.5, aspect=30,
orientation='horizontal',
extend='max', pad=0.1)

if cb.orientation == 'horizontal':
for t in cb.ax.get_xticklabels():
t.set_fontsize(8)

m.drawparallels(parallels, labels=[1, 0, 0, 0],
fontsize=7.5, linewidth=0.2)
m.drawmeridians(meridians, labels=[0, 0, 0, 1],
fontsize=7.5, linewidth=0.2)
if clabel:
cb.set_label(clabel)
if ylab:
pyplot.ylabel(ylab, fontsize=7.5)
if xlab:
pyplot.xlabel(xlab, fontsize=7.5)
if title:
pyplot.title(title)

pyplot.grid(True)
pyplot.tick_params(direction='out', right='off', top='off')

cb = pyplot.colorbar(shrink=0.5, aspect=30,
orientation='horizontal',
extend='max', pad=0.1)
Expand Down
4 changes: 1 addition & 3 deletions tcrmenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ dependencies:
- numpy
- scipy
- matplotlib
- basemap
- shapely
- nose
- netcdf4
- cftime
Expand All @@ -23,7 +21,7 @@ dependencies:
- sqlite
- statsmodels
- configparser
- cartopy>=0.18.0
- cartopy
- affine
- tqdm
- xarray
Expand Down
70 changes: 0 additions & 70 deletions tests/kde/kde2.py

This file was deleted.

112 changes: 0 additions & 112 deletions tests/kde/kde3.py

This file was deleted.

0 comments on commit 8793053

Please sign in to comment.