-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_imageslurper.py
34 lines (30 loc) · 1.07 KB
/
test_imageslurper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pytest
import PIL
import numpy as np
import matplotlib.pyplot as plt
import imageslurper
@pytest.mark.parametrize("error_threshold", (None, 20))
def test_autoslurp(error_threshold):
"""
Test of the whole process.
"""
plt.ion()
imageslurper.autoslurp(file="img/world-temp.jpg",
map_corners=np.array([ 50., 50., 1000., 550.]),
colorbar_corners=np.array([150., 560., 900., 576.]),
error_threshold=error_threshold, # In clim units
xlim = (-180, 180),
ylim = (90, -90),
clim = (180, 280),
norm_order=2,
updater=None,
)
@pytest.mark.parametrize("max_pixels", (100, 1e99))
def test_auto_resize(max_pixels):
"""
Test of auto resize as it is not part of the usual slurp.
"""
imageslurper.auto_resize(
PIL.Image.open("img/world-temp.jpg"),
max_pixels=max_pixels,
resample=PIL.Image.NEAREST)