From c1a59a006ed2bf9e706474db827f3b628fc854cc Mon Sep 17 00:00:00 2001
From: jay <jlaura@asu.edu>
Date: Thu, 7 Jun 2018 12:49:45 -0700
Subject: [PATCH] Fixes version and north up

---
 plio/__init__.py   | 16 +++++++++++++++-
 plio/io/io_gdal.py |  9 +++++----
 setup.py           |  5 +----
 3 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/plio/__init__.py b/plio/__init__.py
index 34ae0a4..1269de6 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 ec87159..4515017 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 ba265c7..4a0da6f 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."),
-- 
GitLab