Skip to content
Snippets Groups Projects
Commit f59ebf64 authored by Kelvin Rodriguez's avatar Kelvin Rodriguez
Browse files
parents 5b063013 2ae8fd50
No related branches found
No related tags found
No related merge requests found
......@@ -10,4 +10,4 @@ dependencies:
- pandas
- sqlalchemy
- pyyaml
- networkx
- networkx
__version__ = "0.1.0"
__version__ = "0.1.1"
# Submodule imports
from . import io
......
{
"loggers": {
"my_module": {
"level": "DEBUG",
"propagate": false,
"level": "DEBUG",
"propagate": false,
"handlers": [
"console"
]
}
},
"version": 1,
"disable_existing_loggers": false,
},
"version": 1,
"disable_existing_loggers": false,
"handlers": {
"console": {
"formatter": "simple",
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout",
"formatter": "simple",
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout",
"level": "DEBUG"
},
},
"info_file_handler": {
"formatter": "simple",
"backupCount": 10,
"level": "INFO",
"encoding": "utf8",
"class": "logging.handlers.RotatingFileHandler",
"maxBytes": 10485760,
"formatter": "simple",
"backupCount": 10,
"level": "DEBUG",
"encoding": "utf8",
"class": "logging.handlers.RotatingFileHandler",
"maxBytes": 10485760,
"filename": "info.log"
}
},
},
"root": {
"level": "DEBUG",
"level": "DEBUG",
"handlers": [
"console",
"console",
"info_file_handler"
]
},
},
"formatters": {
"simple": {
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
......
......@@ -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)
......
......@@ -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()
......@@ -458,4 +461,4 @@ class ReadTds(object):
self.filename = filename
self.readbin5(headerlen)
print(self.ncases)
assert(self.ncases == self.bin52data.shape[0])
\ No newline at end of file
assert(self.ncases == self.bin52data.shape[0])
......@@ -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)
......
......@@ -42,11 +42,10 @@ def setup_package():
'pvl',
'protobuf==3.0.0b2',
'h5py',
'icu',
'pandas',
'sqlalchemy',
'pyyaml',
'certifi'],
'networkx'],
classifiers=[
"Development Status :: 3 - Alpha",
"Topic :: Utilities",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment