Permalink
Browse files

Automated merge with https://ecometrica.kilnhg.com/Code/Public/group/…

  • Loading branch information...
Maxime Dupuis
Maxime Dupuis committed Nov 28, 2012
2 parents bea40c0 + 11b9b5c commit 7c960c30ec48134f44f9e2da49106a61a1536530
Showing with 10 additions and 10 deletions.
  1. +1 −1 gdal2mbtiles/gdal.py
  2. +4 −4 gdal2mbtiles/vips.py
  3. +5 −5 tests/test_gdal.py
View
@@ -599,7 +599,7 @@ def GetTiledExtents(self, transform=None, resolution=None):
return Extents(lower_left=XY(left, bottom),
upper_right=XY(right, top))
- def GetTileScalingRatios(self, resolution=None, places=None):
+ def GetScalingRatios(self, resolution=None, places=None):
"""
Get the scaling ratios required to upsample an image to `resolution`.
View
@@ -577,7 +577,7 @@ def ReadAsArray(self, xoff=0, yoff=0, win_xsize=None, win_ysize=None,
if win_ysize is None:
win_ysize = image.Ysize() - yoff
- band = image.extract_bands(self._band_no, 1)
+ band = image.extract_bands(band=self._band_no, nbands=1)
area = band.extract_area(left=xoff, top=yoff,
width=win_xsize, height=win_ysize)
@@ -615,8 +615,8 @@ def image(self):
return self._image
def GetRasterBand(self, i):
- return VipsBand(band=super(Dataset, self).GetRasterBand(i),
- dataset=self, band_no=i-1)
+ return VipsBand(band=super(VipsDataset, self).GetRasterBand(i),
+ dataset=self, band_no=(i - 1))
def ReadAsArray(self, xoff=0, yoff=0, xsize=None, ysize=None,
buf_obj=None):
@@ -671,7 +671,7 @@ def _upsample(self, ratios):
def upsample(self, resolution=None):
"""Upsamples the image to `resolution`."""
return self._upsample(
- ratios=self.GetTileScalingRatios(resolution=resolution, places=5)
+ ratios=self.GetScalingRatios(resolution=resolution, places=5)
)
def upsample_to_world(self):
View
@@ -785,29 +785,29 @@ def test_get_tiled_extents_partial_spanning(self):
def test_get_tile_scaling_ratios(self):
# bluemarble.tif is a 1024 × 1024 whole-world map
dataset = Dataset(inputfile=self.inputfile)
- ratio = dataset.GetTileScalingRatios()
+ ratio = dataset.GetScalingRatios()
self.assertAlmostEqual(ratio.x, 1.0)
self.assertAlmostEqual(ratio.y, 1.0)
# Test rounding
- ratio = dataset.GetTileScalingRatios(places=5)
+ ratio = dataset.GetScalingRatios(places=5)
self.assertEqual(ratio.x, 1.0)
self.assertEqual(ratio.y, 1.0)
# upsampling.tif is a 256 × 256 whole-world map
dataset = Dataset(inputfile=self.upsamplingfile)
- ratio = dataset.GetTileScalingRatios()
+ ratio = dataset.GetScalingRatios()
self.assertAlmostEqual(ratio.x, 1.0)
self.assertAlmostEqual(ratio.y, 1.0)
# bluemarble-spanning-foreign.tif is a 154 × 154 partial map
dataset = Dataset(inputfile=self.foreignfile)
- ratio = dataset.GetTileScalingRatios()
+ ratio = dataset.GetScalingRatios()
self.assertAlmostEqual(ratio.x, 4.0 / 3.0)
self.assertAlmostEqual(ratio.y, 4.0 / 3.0)
# Test rounding
- ratio = dataset.GetTileScalingRatios(places=5)
+ ratio = dataset.GetScalingRatios(places=5)
self.assertEqual(ratio.x, 1.33333)
self.assertEqual(ratio.y, 1.33333)

0 comments on commit 7c960c3

Please sign in to comment.