Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilipp committed Nov 7, 2018
2 parents c156690 + 6a94c94 commit ce4234a
Show file tree
Hide file tree
Showing 40 changed files with 173 additions and 44 deletions.
12 changes: 12 additions & 0 deletions .gitmodules
Expand Up @@ -98,3 +98,15 @@
path = tests/reference_figures/win32/py3.6/mpl2.2
url = https://github.com/Chilipp/psy-simple-references.git
branch = win32_py3.6_mpl2.2
[submodule "tests/reference_figures/linux/py3.7/mpl3.0"]
path = tests/reference_figures/linux/py3.7/mpl3.0
url = https://github.com/Chilipp/psy-simple-references.git
branch = linux_py3.7_mpl3.0
[submodule "tests/reference_figures/darwin/py3.7/mpl3.0"]
path = tests/reference_figures/darwin/py3.7/mpl3.0
url = https://github.com/Chilipp/psy-simple-references.git
branch = darwin_py3.7_mpl3.0
[submodule "tests/reference_figures/win32/py3.7/mpl3.0"]
path = tests/reference_figures/win32/py3.7/mpl3.0
url = https://github.com/Chilipp/psy-simple-references.git
branch = win32_py3.7_mpl3.0
25 changes: 25 additions & 0 deletions .travis.yml
Expand Up @@ -4,9 +4,15 @@ env:
- COMMIT_AUTHOR_EMAIL="philipp.sommer@unil.ch"
- QT_VERSION=""
- secure: "QocbcpzKkTWjFW8xKiws6W9cQrw+E+wY6dbH+IX7qnBw1OenPkInqMbquyNhmktPPEsnKfcZODDfHeXmvZYEdtTBWac1xMhT/ql4XiiEZY31JvXKsIRo/F6hcbVWjRFgl8vndv7IGiDaQAUys6VQ0yoS/0RRyIIzgzxb0mqedlZqGwc+hS50qXJSLM7TCgf8aFf7rrBK/I638Hq6GziAV8Zrg7dR+6CkaIkV9Lorz+suk/VcZSu1r1PCV4v54siY55FQhya/faEb4NPr5LGgtlLJ4v2trDxyc1jZTCbQtYm/rgpNP8KFMRHHPwlHBSjRHKdGiGnBwdPMKn7C//q0f/45ipnvVB439ku225juLO/ciq73FikOzmvlRCA+/FkR5QPdOhTmXLxrnvz5vKbaEoFncrw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=2.2
Expand Down Expand Up @@ -54,6 +60,10 @@ matrix:
- MPL_VERSION=1.4
os: linux
# osx environments
- env:
- PYTHON_VERSION=3.7
- MPL_VERSION=3.0
os: osx
- env:
- PYTHON_VERSION=3.6
- MPL_VERSION=2.2
Expand Down Expand Up @@ -117,6 +127,8 @@ install:
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# install conda build and anaconda-client for deploy
- conda install conda-build anaconda-client
# Useful for debugging any issues with conda
- conda info -a
- 'ENVKEY=py"${PYTHON_VERSION}"_mpl"${MPL_VERSION}"'
Expand Down Expand Up @@ -157,6 +169,9 @@ install:
- psyplot -aV
# export the token to make it available for the deploy
- export GH_REPO_TOKEN=$GH_REPO_TOKEN_SAVE
# add conda-forge channel for build
- conda config --add channels chilipp/label/$TRAVIS_BRANCH
- conda config --add channels conda-forge

script:
# create the necessary references
Expand All @@ -170,6 +185,7 @@ script:
coverage run --source=psy_simple --append setup.py test -a "-v tests/widgets" &&
coverage report;
fi'
- conda build ci/conda-recipe --python $PYTHON_VERSION --no-test

before_script:
- if [[ $TRAVIS_OS_NAME == "linux" && $QT_VERSION != "" ]]; then
Expand All @@ -181,6 +197,9 @@ before_script:
after_success:
- coveralls

before_deploy: # deactivate to use anaconda client
- conda deactivate

deploy:
- provider: script
script: ci/update_reference_submodule.py
Expand All @@ -194,3 +213,9 @@ deploy:
on:
condition: "-e deploy_references"
all_branches: true
- provider: script
script: ci/deploy_anaconda.sh
skip_cleanup: true
on:
condition: '$MPL_VERSION == 3.0'
all_branches: true
2 changes: 2 additions & 0 deletions appveyor.yml
Expand Up @@ -6,6 +6,8 @@ environment:
secure: if/KFvIyudicJz5Rf2DcM96xMItYbe5LSoYQ12jHPFcuvXmktD2zeE6DX8/pjOzn

matrix:
- PYTHON_VERSION: "3.7"
MPL_VERSION: "3.0"
- PYTHON_VERSION: "3.6"
MPL_VERSION: "2.2"
- PYTHON_VERSION: "3.6"
Expand Down
38 changes: 38 additions & 0 deletions ci/conda-recipe/meta.yaml
@@ -0,0 +1,38 @@
{% set name = "psy-simple" %}
{% set version = "1.2.0" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
path: ../../

build:
number: 0
script: python setup.py install --single-version-externally-managed --record record.txt

requirements:
build:
- python
- setuptools
run:
- python
- psyplot

test:
imports:
- psy_simple

about:
home: https://github.com/Chilipp/psy-simple
license: GPL-2.0
license_family: GPL
license_file: LICENSE
summary: Psyplot plugin for simple visualization tasks

description: |
This psyplot plugin provides plot methods for simple visualization tasks
like 2D plots, line plots, bar plots, etc.
doc_url: http://psyplot.readthedocs.io/projects/psy-simple
dev_url: https://github.com/Chilipp/psy-simple
2 changes: 2 additions & 0 deletions ci/deploy_anaconda.sh
@@ -0,0 +1,2 @@
#!/bin/bash
anaconda -t $CONDA_REPO_TOKEN upload -l $TRAVIS_BRANCH --force "$(ls $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64/*.tar.bz2)"
4 changes: 2 additions & 2 deletions ci/install_python.ps1
Expand Up @@ -10,10 +10,10 @@ $BASE_URL = "https://www.python.org/ftp/python/"

function DownloadMiniconda ($python_version, $platform_suffix) {
$webclient = New-Object System.Net.WebClient
if ($python_version -match "3.[456]") {
if ($python_version -match "3.[4567]") {
$filename = "Miniconda3-latest-Windows-" + $platform_suffix + ".exe"
} else {
$filename = "Miniconda-latest-Windows-" + $platform_suffix + ".exe"
$filename = "Miniconda2-latest-Windows-" + $platform_suffix + ".exe"
}
$url = $MINICONDA_URL + $filename

Expand Down
46 changes: 31 additions & 15 deletions psy_simple/plotters.py
Expand Up @@ -412,8 +412,20 @@ def _mid_data_ticks(self, step=None):
return ((arr[:-1] + arr[1:])/2.)[::step]

def _calc_vmin_vmax(self, percmin=None, percmax=None):
def nanmin(arr):
try:
return np.nanmin(arr)
except TypeError:
return arr.min()

def nanmax(arr):
try:
return np.nanmax(arr)
except TypeError:
return arr.max()

def minmax(arr):
return [arr.min(), arr.max()]
return [nanmin(arr), nanmax(arr)]

def shared_arrays():
for fmto in self.shared:
Expand All @@ -440,11 +452,11 @@ def shared_arrays():
[self.array], shared_arrays()))))
try:
if not percmin:
vmin = arr.min()
vmin = nanmin(arr)
else:
percentiles.append(percmin)
if percmax is None or percmax == 100:
vmax = arr.max()
vmax = nanmax(arr)
else:
percentiles.append(percmax)
except ValueError:
Expand Down Expand Up @@ -3786,20 +3798,30 @@ def draw_colorbar(self, pos):
kwargs['orientation'] = orientation
self.cbars[pos] = cbar = fig.colorbar(self.plot.mappable, **kwargs)
self._just_drawn.add(cbar)
self.set_label_pos(pos)

def set_label_pos(self, pos):
ax = self.cbars[pos].ax
if pos == 'fl':
# draw tick labels left
self.cbars[pos].ax.tick_params('y', labelleft=True,
labelright=False)
ax.tick_params('y', labelleft=True, labelright=False)
ax.yaxis.set_label_position('left')
ax.yaxis.tick_left()
elif pos == 'ft':
# draw ticklabels at the top
self.cbars[pos].ax.tick_params('x', labeltop=True,
labelbottom=False)
ax.tick_params('x', labeltop=True, labelbottom=False)
ax.xaxis.set_label_position('top')
ax.xaxis.tick_top()
elif pos == 'r':
# draw ticklabels on the right
self.cbars[pos].ax.tick_params('y', labelleft=False,
labelright=True)
ax.tick_params('y', labelleft=False, labelright=True)
ax.yaxis.set_label_position('right')
ax.yaxis.tick_right()

def finish_update(self):
# Set the label position again in case this has been changed
for pos, cbar in self.cbars.items():
self.set_label_pos(pos)
self._just_drawn.clear()


Expand Down Expand Up @@ -3843,12 +3865,6 @@ def update(self, value):
value, arr, attrs=self.get_enhanced_attrs(arr)))
self.texts.append(getattr(
cbar.ax, self.axis_locations[pos] + 'axis').get_label())
if pos == 'fl':
cbar.ax.yaxis.set_label_position('left')
elif pos == 'ft':
cbar.ax.xaxis.set_label_position('top')
elif pos == 'r':
cbar.ax.yaxis.set_label_position('right')


class VCLabel(CLabel):
Expand Down
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -48,6 +48,7 @@ def run_tests(self):
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Operating System :: OS Independent',
],
keywords='visualization netcdf raster cartopy earth-sciences psyplot',
Expand Down
2 changes: 1 addition & 1 deletion tests/envs/environment_py2.7_mpl2.0.yml
Expand Up @@ -5,7 +5,7 @@ dependencies:
- python=2.7
- matplotlib=2.0
- dask
- xarray
- xarray<0.10.0
- netCDF4
- seaborn
- pip:
Expand Down
2 changes: 1 addition & 1 deletion tests/envs/environment_py2.7_mpl2.0_qt4.yml
Expand Up @@ -5,7 +5,7 @@ dependencies:
- python=2.7
- matplotlib=2.0
- dask
- xarray
- xarray<0.10.0
- netCDF4
- seaborn
- qtconsole
Expand Down
13 changes: 13 additions & 0 deletions tests/envs/environment_py3.7_mpl3.0.yml
@@ -0,0 +1,13 @@
name: psyplot_py3.7_mpl3.0
channels:
- conda-forge
dependencies:
- python=3.7
- matplotlib=3.0
- dask
- pyqt
- xarray
- netCDF4
- seaborn
- pip:
- pytest
17 changes: 17 additions & 0 deletions tests/envs/environment_py3.7_mpl3.0_qt5.yml
@@ -0,0 +1,17 @@
name: psyplot_py3.7_mpl3.0_qt5
channels:
- conda-forge
dependencies:
- python=3.7
- matplotlib=3.0
- dask
- xarray
- netCDF4
- seaborn
- qtconsole
- pyqt=5
- sphinx
- pip:
- pytest
- fasteners
- sphinx_rtd_theme
2 changes: 1 addition & 1 deletion tests/reference_figures/darwin/py2.7/mpl1.5
2 changes: 1 addition & 1 deletion tests/reference_figures/darwin/py2.7/mpl2.0
2 changes: 1 addition & 1 deletion tests/reference_figures/darwin/py2.7/mpl2.1
2 changes: 1 addition & 1 deletion tests/reference_figures/darwin/py3.6/mpl1.5
2 changes: 1 addition & 1 deletion tests/reference_figures/darwin/py3.6/mpl2.0
2 changes: 1 addition & 1 deletion tests/reference_figures/darwin/py3.6/mpl2.1
2 changes: 1 addition & 1 deletion tests/reference_figures/darwin/py3.6/mpl2.2
1 change: 1 addition & 0 deletions tests/reference_figures/darwin/py3.7/mpl3.0
Submodule mpl3.0 added at 0ca915
2 changes: 1 addition & 1 deletion tests/reference_figures/linux/py3.5/mpl1.5
2 changes: 1 addition & 1 deletion tests/reference_figures/linux/py3.5/mpl2.0
2 changes: 1 addition & 1 deletion tests/reference_figures/linux/py3.5/mpl2.1
2 changes: 1 addition & 1 deletion tests/reference_figures/linux/py3.6/mpl1.5
2 changes: 1 addition & 1 deletion tests/reference_figures/linux/py3.6/mpl2.0
2 changes: 1 addition & 1 deletion tests/reference_figures/linux/py3.6/mpl2.1
2 changes: 1 addition & 1 deletion tests/reference_figures/linux/py3.6/mpl2.2
1 change: 1 addition & 0 deletions tests/reference_figures/linux/py3.7/mpl3.0
Submodule mpl3.0 added at 7af985
2 changes: 1 addition & 1 deletion tests/reference_figures/linux2/py2.7/mpl1.4
2 changes: 1 addition & 1 deletion tests/reference_figures/linux2/py2.7/mpl1.5
2 changes: 1 addition & 1 deletion tests/reference_figures/linux2/py2.7/mpl2.0
2 changes: 1 addition & 1 deletion tests/reference_figures/linux2/py2.7/mpl2.1
2 changes: 1 addition & 1 deletion tests/reference_figures/win32/py3.5/mpl1.5
2 changes: 1 addition & 1 deletion tests/reference_figures/win32/py3.5/mpl2.0
2 changes: 1 addition & 1 deletion tests/reference_figures/win32/py3.5/mpl2.1
2 changes: 1 addition & 1 deletion tests/reference_figures/win32/py3.6/mpl1.5
2 changes: 1 addition & 1 deletion tests/reference_figures/win32/py3.6/mpl2.0
2 changes: 1 addition & 1 deletion tests/reference_figures/win32/py3.6/mpl2.1
2 changes: 1 addition & 1 deletion tests/reference_figures/win32/py3.6/mpl2.2
1 change: 1 addition & 0 deletions tests/reference_figures/win32/py3.7/mpl3.0
Submodule mpl3.0 added at f420aa

0 comments on commit ce4234a

Please sign in to comment.