Skip to content
Snippets Groups Projects
Commit f59ebf64 authored by Kelvin Rodriguez's avatar Kelvin Rodriguez
Browse files
parents 5b063013 2ae8fd50
Branches
Tags
No related merge requests found
__version__ = "0.1.0" __version__ = "0.1.1"
# Submodule imports # Submodule imports
from . import io from . import io
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"info_file_handler": { "info_file_handler": {
"formatter": "simple", "formatter": "simple",
"backupCount": 10, "backupCount": 10,
"level": "INFO", "level": "DEBUG",
"encoding": "utf8", "encoding": "utf8",
"class": "logging.handlers.RotatingFileHandler", "class": "logging.handlers.RotatingFileHandler",
"maxBytes": 10485760, "maxBytes": 10485760,
......
...@@ -198,6 +198,12 @@ class GeoDataset(object): ...@@ -198,6 +198,12 @@ class GeoDataset(object):
self._gcs = self._srs.CloneGeogCS() self._gcs = self._srs.CloneGeogCS()
return self._srs return self._srs
@property
def nbands(self):
if not getattr(self, '_nbands', None):
self._nbands = self.dataset.RasterCount
return self._nbands
@property @property
def geospatial_coordinate_system(self): def geospatial_coordinate_system(self):
if not getattr(self, '_gcs', None): if not getattr(self, '_gcs', None):
...@@ -321,10 +327,8 @@ class GeoDataset(object): ...@@ -321,10 +327,8 @@ class GeoDataset(object):
@property @property
def coordinate_transformation(self): def coordinate_transformation(self):
if not getattr(self, '_ct', None): if not getattr(self, '_ct', None):
print('Getting CT')
self._ct = osr.CoordinateTransformation(self.spatial_reference, self._ct = osr.CoordinateTransformation(self.spatial_reference,
self.geospatial_coordinate_system) self.geospatial_coordinate_system)
print('CT', self._ct)
return self._ct return self._ct
@property @property
...@@ -332,7 +336,6 @@ class GeoDataset(object): ...@@ -332,7 +336,6 @@ class GeoDataset(object):
if not getattr(self, '_ict', None): if not getattr(self, '_ict', None):
self._ict = osr.CoordinateTransformation(self.geospatial_coordinate_system, self._ict = osr.CoordinateTransformation(self.geospatial_coordinate_system,
self.spatial_reference) self.spatial_reference)
print(self._ict)
return self._ict return self._ict
@property @property
...@@ -558,6 +561,7 @@ def match_rasters(match_to, match_from, destination, ...@@ -558,6 +561,7 @@ def match_rasters(match_to, match_from, destination,
GRA_Cubic, GRA_CubicSpline, GRA_Lanczos, GRA_Average, GRA_Cubic, GRA_CubicSpline, GRA_Lanczos, GRA_Average,
GRA_Mode} GRA_Mode}
""" """
import gdalconst # import here so Sphinx can build the docos, mocking is not working 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 # TODO: If a destination is not provided create an in-memory GeoDataSet object
match_to_srs = match_to.dataset.GetProjection() match_to_srs = match_to.dataset.GetProjection()
...@@ -567,8 +571,8 @@ def match_rasters(match_to, match_from, destination, ...@@ -567,8 +571,8 @@ def match_rasters(match_to, match_from, destination,
match_from__srs = match_from.dataset.GetProjection() match_from__srs = match_from.dataset.GetProjection()
match_from__gt = match_from.geotransform match_from__gt = match_from.geotransform
dst = gdal.GetDriverByName('GTiff').Create(destination, width, height, match_from.RasterCount, dst = gdal.GetDriverByName('GTiff').Create(destination, width, height, 1,
gdalconst.GDT_Float32) gdalconst.GDT_Float64)
dst.SetGeoTransform(match_to_gt) dst.SetGeoTransform(match_to_gt)
dst.SetProjection(match_to_srs) dst.SetProjection(match_to_srs)
......
...@@ -364,9 +364,9 @@ class ReadBin52(object): ...@@ -364,9 +364,9 @@ class ReadBin52(object):
self.nseasons) self.nseasons)
caseidx = np.repeat(np.arange(self.ncases), self.nseasons) caseidx = np.repeat(np.arange(self.ncases), self.nseasons)
seasonidx = np.repeat(np.arange(self.nseasons), self.ncases) 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.ncases * self.nseasons)
self.seasons = pd.DataFrame(flt_seasitems, self.seasons = pd.DataFrame(flt_seasitems.T,
index=[caseidx,seasonidx], index=[caseidx,seasonidx],
columns=columns) columns=columns)
self.seasons.index.names = ['Case', 'Season'] self.seasons.index.names = ['Case', 'Season']
...@@ -432,6 +432,9 @@ class ReadBin52(object): ...@@ -432,6 +432,9 @@ class ReadBin52(object):
#Extract the hourly temperature data #Extract the hourly temperature data
hourly2dataframe() hourly2dataframe()
# Extract the seasons
season2dataframe()
# Extract by layer data from the data cube # Extract by layer data from the data cube
layeritems = self.bin52data[: , self.ndx: , : , 5: 7, : ] layeritems = self.bin52data[: , self.ndx: , : , 5: 7, : ]
latitems2dataframe() latitems2dataframe()
......
...@@ -35,7 +35,7 @@ class TestWriteIsisControlNetwork(unittest.TestCase): ...@@ -35,7 +35,7 @@ class TestWriteIsisControlNetwork(unittest.TestCase):
io_controlnetwork.to_isis('test.net', dfs, mode='wb', targetname='Moon') io_controlnetwork.to_isis('test.net', dfs, mode='wb', targetname='Moon')
cls.header_message_size = 78 cls.header_message_size = 78
cls.point_start_byte = 65609 # 66949 cls.point_start_byte = 65614 # 66949
def test_create_buffer_header(self): def test_create_buffer_header(self):
self.npts = 5 self.npts = 5
...@@ -56,7 +56,7 @@ class TestWriteIsisControlNetwork(unittest.TestCase): ...@@ -56,7 +56,7 @@ class TestWriteIsisControlNetwork(unittest.TestCase):
io_controlnetwork.to_isis('test.net', dfs, mode='wb', targetname='Moon') io_controlnetwork.to_isis('test.net', dfs, mode='wb', targetname='Moon')
self.header_message_size = 78 self.header_message_size = 78
self.point_start_byte = 66104 # 66949 self.point_start_byte = 65614 # 66949
with open('test.net', 'rb') as f: with open('test.net', 'rb') as f:
f.seek(io_controlnetwork.HEADERSTARTBYTE) f.seek(io_controlnetwork.HEADERSTARTBYTE)
...@@ -73,13 +73,13 @@ class TestWriteIsisControlNetwork(unittest.TestCase): ...@@ -73,13 +73,13 @@ class TestWriteIsisControlNetwork(unittest.TestCase):
self.assertEqual('None', header_protocol.description) self.assertEqual('None', header_protocol.description)
self.assertEqual(self.modified_date, header_protocol.lastModified) self.assertEqual(self.modified_date, header_protocol.lastModified)
#Repeating #Repeating
self.assertEqual([99] * self.npts, header_protocol.pointMessageSizes) self.assertEqual([135] * self.npts, header_protocol.pointMessageSizes)
def test_create_point(self): def test_create_point(self):
with open('test.net', 'rb') as f: with open('test.net', 'rb') as f:
f.seek(self.point_start_byte) 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() point_protocol = cnf.ControlPointFileEntryV0002()
raw_point = f.read(length) raw_point = f.read(length)
point_protocol.ParseFromString(raw_point) point_protocol.ParseFromString(raw_point)
...@@ -99,7 +99,7 @@ class TestWriteIsisControlNetwork(unittest.TestCase): ...@@ -99,7 +99,7 @@ class TestWriteIsisControlNetwork(unittest.TestCase):
self.assertEqual(10, mpoints) self.assertEqual(10, mpoints)
points_bytes = find_in_dict(pvl_header, 'PointsBytes') 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') points_start_byte = find_in_dict(pvl_header, 'PointsStartByte')
self.assertEqual(self.point_start_byte, points_start_byte) self.assertEqual(self.point_start_byte, points_start_byte)
......
...@@ -42,11 +42,10 @@ def setup_package(): ...@@ -42,11 +42,10 @@ def setup_package():
'pvl', 'pvl',
'protobuf==3.0.0b2', 'protobuf==3.0.0b2',
'h5py', 'h5py',
'icu',
'pandas', 'pandas',
'sqlalchemy', 'sqlalchemy',
'pyyaml', 'pyyaml',
'certifi'], 'networkx'],
classifiers=[ classifiers=[
"Development Status :: 3 - Alpha", "Development Status :: 3 - Alpha",
"Topic :: Utilities", "Topic :: Utilities",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment