diff --git a/plio/__init__.py b/plio/__init__.py index 34ae0a40792be57241bcdbeb3eb6e0c59a715aa2..1269de6a041f130b3fa53f8bf3bd1ca787e2677f 100755 --- a/plio/__init__.py +++ b/plio/__init__.py @@ -1,4 +1,18 @@ -__version__ = "0.1.2" +from pkg_resources import get_distribution, DistributionNotFound +import os.path + +try: + _dist = get_distribution('plio') + # Normalize case for Windows systems + dist_loc = os.path.normcase(_dist.location) + here = os.path.normcase(__file__) + if not here.startswith(os.path.join(dist_loc, 'plio')): + # not installed, but there is another version that *is* + raise DistributionNotFound +except DistributionNotFound: + __version__ = 'Please install this project with setup.py' +else: + __version__ = _dist.version # Submodule imports from . import io diff --git a/plio/io/io_gdal.py b/plio/io/io_gdal.py index ec87159a561e1fa9ea3d6c3e4a09bf5ec234920f..45150171cda86ed324e3ed875006797455c580ec 100644 --- a/plio/io/io_gdal.py +++ b/plio/io/io_gdal.py @@ -227,6 +227,7 @@ class GeoDataset(object): @property def north_up(self): + return True if self.footprint: return geofuncs.is_clockwise(json.loads(self.footprint.ExportToJson())['coordinates'][0][0]) else: @@ -496,15 +497,15 @@ class GeoDataset(object): if not pixels: array = band.ReadAsArray().astype(dtype) - if self.north_up == False: - array = np.flipud(array) + #if self.north_up == False: + # array = np.flipud(array) else: # Check that the read start is not outside of the image xstart, ystart, xcount, ycount = pixels xmax, ymax = map(int, self.xy_extent[1]) # If the image is south up, flip the roi - if self.north_up == False: - ystart = ymax - (ystart + ycount) + #if self.north_up == False: + # ystart = ymax - (ystart + ycount) if xstart < 0: xstart = 0 diff --git a/setup.py b/setup.py index ba265c744bafa95dcb79167406722c91f487a002..4a0da6f02b7e51773fa1828f48343ac6f38e2470 100644 --- a/setup.py +++ b/setup.py @@ -6,9 +6,6 @@ from plio.examples import available with open('README.rst', 'r') as f: long_description = f.read() - -VERSION = plio.__version__ - def setup_package(): examples = set() for i in available(): @@ -23,7 +20,7 @@ def setup_package(): setup( name = "plio", - version = VERSION, + version = '0.1.2', author = "Jay Laura", author_email = "jlaura@usgs.gov", description = ("I/O API to support planetary data formats."),