Commit ba3f5047 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Merge branch 'enhancement/improve_test_cov' into 'master'

Enhancement/improve test cov

See merge request !21
parents bf03bd02 6d295c2f
Pipeline #19578 canceled with stages
in 4 minutes and 53 seconds
......@@ -2,6 +2,13 @@
History
=======
0.10.10 (coming soon)
---------------------
* Added test for GeoArray.show().
* Fixed holoviews DeprecationWarning within GeoArray.show().
0.10.9 (2021-02-19)
-------------------
......
......@@ -1210,8 +1210,12 @@ class GeoArray(object):
# get image to plot
nodataVal = nodataVal if nodataVal is not None else self.nodata if self.nodata is not None else -9999
image2plot, gt, prj = \
self._get_plottable_image(xlim, ylim, band, boundsMap=boundsMap, boundsMapPrj=boundsMapPrj,
res_factor=res_factor, nodataVal=nodataVal, ignore_rotation=ignore_rotation)
self._get_plottable_image(xlim, ylim, band,
boundsMap=boundsMap,
boundsMapPrj=boundsMapPrj,
res_factor=res_factor,
nodataVal=nodataVal,
ignore_rotation=ignore_rotation)
palette, vmin, vmax = self._get_cmap_vmin_vmax(cmap, vmin, vmax, pmin, pmax, image2plot, nodataVal)
if nodataVal is not None and np.std(image2plot.astype(float)) != 0:
......@@ -1236,12 +1240,16 @@ class GeoArray(object):
def get_hv_image(b):
# FIXME ylabels have the wrong order
return hv.Image(image2plot[:, :, b] if b is not None else image2plot,
bounds=(cS, rS, cE, rE))(
style={'cmap': 'gray'}, plot={'fig_inches': 4 if figsize is None else figsize, 'show_grid': True})
hv_image = hv.Image(image2plot[:, :, b] if b is not None else image2plot,
bounds=(cS, rS, cE, rE))
return hv_image.opts(style={'cmap': 'gray'},
plot={'fig_inches': 4 if figsize is None else figsize,
'show_grid': True})
# hvIm = hv.Image(image2plot)(style={'cmap': 'gray'}, figure_inches=figsize)
hmap = hv.HoloMap([(band, get_hv_image(band)) for band in range(image2plot.shape[2])], kdims=['band'])
hmap = hv.HoloMap([(band, get_hv_image(band))
for band in range(image2plot.shape[2])],
kdims=['band'])
return hmap
......
......@@ -427,11 +427,21 @@ class Test_GeoArray(TestCase):
self.assertIsInstance(gA_copy, GeoArray)
self.assertTrue(np.array_equal(gA[:], gA_copy[:], equal_nan=True))
def test_PlottingFunctions(self):
def test_show(self):
# test 3D case
self.gA.show()
# self.gA.show(interactive=True) # only works if test is started with ipython.
self.gA.show(interactive=True) # only works if test is started with ipython.
# test 2D case
gA = GeoArray(self.gA[:, :, 0])
gA.show()
with self.assertWarnsRegex(UserWarning, 'Currently there is no interactive mode for single-band arrays.'):
gA.show(interactive=True)
def test_show_map(self):
self.gA.show_map()
def test_show_histogram(self):
self.gA.show_histogram()
def test_get_mapPos(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment