Skip to content
Snippets Groups Projects
Commit 5db0cb20 authored by jlaura's avatar jlaura Committed by Jason R Laura
Browse files

Prints removed and fixes raster to raster matching to conform to GeoDataset API.

parent 3a7860ef
Branches
Tags
No related merge requests found
...@@ -533,10 +533,10 @@ def match_rasters(match_to, match_from, destination, ...@@ -533,10 +533,10 @@ def match_rasters(match_to, match_from, destination,
Parameters Parameters
========== ==========
match : object match_to : object
A GeoDataSet object to be matched to A GeoDataSet object to be matched to
source : object match_from : object
A GeoDataSet object to be clipped A GeoDataSet object to be clipped
destination : str destination : str
...@@ -549,15 +549,15 @@ def match_rasters(match_to, match_from, destination, ...@@ -549,15 +549,15 @@ def match_rasters(match_to, match_from, destination,
GRA_Mode} GRA_Mode}
""" """
# 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.ds.GetProjection() match_to_srs = match_to.dataset.GetProjection()
match_to_gt = match_to.geotransform match_to_gt = match_to.geotransform
width, height = match_to.rastersize width, height = match_to.raster_size
match_from__srs = match_from.ds.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, 1, gdalconst.GDT_Float32) dst = gdal.GetDriverByName('GTiff').Create(destination, width, height, 1, gdalconst.GDT_Float32)
dst.SetGeoTransform(match_to_gt) dst.SetGeoTransform(match_to_gt)
dst.SetProjection(match_to_srs) dst.SetProjection(match_to_srs)
gdal.ReprojectImage(match_from.ds, dst, None, None, getattr(gdalconst, resampling_method)) gdal.ReprojectImage(match_from.dataset, dst, None, None, getattr(gdalconst, resampling_method))
...@@ -24,9 +24,7 @@ def setup_logging(path=get_path('logging.json'), ...@@ -24,9 +24,7 @@ def setup_logging(path=get_path('logging.json'),
if value: if value:
path = value path = value
print(level)
level = getattr(logging, level.upper()) level = getattr(logging, level.upper())
print(level)
if os.path.exists(path): if os.path.exists(path):
logtype = os.path.splitext(os.path.basename(path))[1] logtype = os.path.splitext(os.path.basename(path))[1]
with open(path, 'rt') as f: with open(path, 'rt') as f:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment