Commit f59ebf64 authored by Kelvin Rodriguez's avatar Kelvin Rodriguez
Browse files
parents 5b063013 2ae8fd50
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
__version__ = "0.1.0"
__version__ = "0.1.1"

# Submodule imports
from . import io
+19 −19
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
    "info_file_handler": {
      "formatter": "simple",
      "backupCount": 10,
      "level": "INFO", 
      "level": "DEBUG", 
      "encoding": "utf8",
      "class": "logging.handlers.RotatingFileHandler",
      "maxBytes": 10485760,
+9 −5
Original line number Diff line number Diff line
@@ -198,6 +198,12 @@ class GeoDataset(object):
            self._gcs = self._srs.CloneGeogCS()
        return self._srs

    @property
    def nbands(self):
        if not getattr(self, '_nbands', None):
            self._nbands = self.dataset.RasterCount
        return self._nbands

    @property
    def geospatial_coordinate_system(self):
        if not getattr(self, '_gcs', None):
@@ -321,10 +327,8 @@ class GeoDataset(object):
    @property
    def coordinate_transformation(self):
        if not getattr(self, '_ct', None):
            print('Getting CT')
            self._ct = osr.CoordinateTransformation(self.spatial_reference,
                                                    self.geospatial_coordinate_system)
            print('CT', self._ct)
        return self._ct

    @property
@@ -332,7 +336,6 @@ class GeoDataset(object):
        if not getattr(self, '_ict', None):
            self._ict = osr.CoordinateTransformation(self.geospatial_coordinate_system,
                                                     self.spatial_reference)
            print(self._ict)
        return self._ict

    @property
@@ -558,6 +561,7 @@ def match_rasters(match_to, match_from, destination,
                        GRA_Cubic, GRA_CubicSpline, GRA_Lanczos, GRA_Average,
                        GRA_Mode}
    """

    import gdalconst  # import here so Sphinx can build the docos, mocking is not working
    # TODO: If a destination is not provided create an in-memory GeoDataSet object
    match_to_srs = match_to.dataset.GetProjection()
@@ -567,8 +571,8 @@ def match_rasters(match_to, match_from, destination,
    match_from__srs = match_from.dataset.GetProjection()
    match_from__gt = match_from.geotransform

    dst = gdal.GetDriverByName('GTiff').Create(destination, width, height, match_from.RasterCount,
                                               gdalconst.GDT_Float32)
    dst = gdal.GetDriverByName('GTiff').Create(destination, width, height, 1,
                                               gdalconst.GDT_Float64)
    dst.SetGeoTransform(match_to_gt)
    dst.SetProjection(match_to_srs)

+6 −3
Original line number Diff line number Diff line
@@ -364,9 +364,9 @@ class ReadBin52(object):
                                                                      self.nseasons)
            caseidx = np.repeat(np.arange(self.ncases), self.nseasons)
            seasonidx = np.repeat(np.arange(self.nseasons), self.ncases)
            flt_seasitems = seasitems.reshape(len(self.vlabels),
            flt_seasitems = seasitems.reshape(len(columns),
                                              self.ncases * self.nseasons)
            self.seasons = pd.DataFrame(flt_seasitems,
            self.seasons = pd.DataFrame(flt_seasitems.T,
                                          index=[caseidx,seasonidx],
                                          columns=columns)
            self.seasons.index.names = ['Case', 'Season']
@@ -432,6 +432,9 @@ class ReadBin52(object):
        #Extract the hourly temperature data
        hourly2dataframe()

        # Extract the seasons
        season2dataframe()

        # Extract by layer data from the data cube
        layeritems = self.bin52data[: , self.ndx: , : , 5: 7, : ]
        latitems2dataframe()
+5 −5
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ class TestWriteIsisControlNetwork(unittest.TestCase):
        io_controlnetwork.to_isis('test.net', dfs, mode='wb', targetname='Moon')

        cls.header_message_size = 78
        cls.point_start_byte = 65609 # 66949
        cls.point_start_byte = 65614 # 66949

    def test_create_buffer_header(self):
        self.npts = 5
@@ -56,7 +56,7 @@ class TestWriteIsisControlNetwork(unittest.TestCase):
        io_controlnetwork.to_isis('test.net', dfs, mode='wb', targetname='Moon')

        self.header_message_size = 78
        self.point_start_byte = 66104 # 66949
        self.point_start_byte = 65614 # 66949

        with open('test.net', 'rb') as f:
            f.seek(io_controlnetwork.HEADERSTARTBYTE)
@@ -73,13 +73,13 @@ class TestWriteIsisControlNetwork(unittest.TestCase):
            self.assertEqual('None', header_protocol.description)
            self.assertEqual(self.modified_date, header_protocol.lastModified)
            #Repeating
            self.assertEqual([99] * self.npts, header_protocol.pointMessageSizes)
            self.assertEqual([135] * self.npts, header_protocol.pointMessageSizes)

    def test_create_point(self):

        with open('test.net', 'rb') as f:
            f.seek(self.point_start_byte)
            for i, length in enumerate([99] * self.npts):
            for i, length in enumerate([135] * self.npts):
                point_protocol = cnf.ControlPointFileEntryV0002()
                raw_point = f.read(length)
                point_protocol.ParseFromString(raw_point)
@@ -99,7 +99,7 @@ class TestWriteIsisControlNetwork(unittest.TestCase):
        self.assertEqual(10, mpoints)

        points_bytes = find_in_dict(pvl_header, 'PointsBytes')
        self.assertEqual(495, points_bytes)
        self.assertEqual(675, points_bytes)

        points_start_byte = find_in_dict(pvl_header, 'PointsStartByte')
        self.assertEqual(self.point_start_byte, points_start_byte)
Loading