Commit 785e70df authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Silenced DEM generator

io.Input_reader:
- get_dem_by_extent(): silenced stdout output

- updated __version__


Former-commit-id: cb07972c
parent e0107c5c
......@@ -15,7 +15,7 @@ from . import config
from .processing.process_controller import process_controller
__version__ = '20170124.06'
__version__ = '20170124.07'
__author__ = 'Daniel Scheffler'
__all__ = ['algorithms',
'io',
......
......@@ -278,7 +278,6 @@ def get_dem_by_extent(cornerCoords_tgt, prj, tgt_xgsd, tgt_ygsd):
tgt_corners_lonlat= tgt_corner_coord_lonlat,
conditions = ['datasetid=%s' % dsID_srtm])
sceneIDs_srtm = [i[0] for i in sceneIDs_srtm]
print(sceneIDs_srtm)
assert sceneIDs_srtm, 'No matching SRTM scene IDs found.'
# get corresponding filenames on disk and generate GDALvsiPathes pointing to raster files within archives
......@@ -296,8 +295,8 @@ def get_dem_by_extent(cornerCoords_tgt, prj, tgt_xgsd, tgt_ygsd):
cmd = 'gdal_merge.py -o %s -of Gtiff -ul_lr %s %s %s %s %s' % \
(path_tmp_merged, t_xmin, t_ymax, t_xmax, t_ymin, ' '.join(gdalBILPaths))
out, exitcode, err = HLP_F.subcall_with_output(cmd)
if err:
print('err1', err.decode('utf8'))
if exitcode!=0:
print('Error merging DEM tiles:', err.decode('utf8'))
assert os.path.exists(path_tmp_merged)
# run gdalwarp to match target grid and extent # TODO replace by in_mem warping
......@@ -307,8 +306,8 @@ def get_dem_by_extent(cornerCoords_tgt, prj, tgt_xgsd, tgt_ygsd):
cmd = 'gdalwarp -r average -of ENVI -overwrite -tr %s %s -s_srs %s -t_srs %s -te %s %s %s %s %s %s' \
% (tgt_xgsd, tgt_ygsd, merged_prj, prj, t_xmin, t_ymin, t_xmax, t_ymax, path_tmp_merged, path_tmp_warped)
out, exitcode, err = HLP_F.subcall_with_output(cmd)
if err:
print('err2', err.decode('utf8'))
if exitcode!=0:
print('Error warping DEM to target grid:', err.decode('utf8'))
assert os.path.exists(path_tmp_warped)
# create output GeoArray
......
......@@ -335,6 +335,7 @@ def get_pgSQL_geospatial_query_cond(conn_params, table2query, geomCol2use='bound
def get_overlapping_scenes_from_postgreSQLdb(conn_params, table='scenes_proc', scene_ID=None,
tgt_corners_lonlat=None, conditions=None, add_cmds='', timeout=15000):
# type: (str, str, int, list, list, str, int) -> list
"""Queries the postgreSQL database in order to find those scenes of a specified reference satellite (Landsat-8 or
Sentinel-2) that have an overlap to the given corner coordinates AND that fulfill the given conditions.
......@@ -348,6 +349,7 @@ def get_overlapping_scenes_from_postgreSQLdb(conn_params, table='scenes_proc', s
:param add_cmds: <str> additional pgSQL commands to be added to the pgSQL query
:param timeout: <int> allows to set a custom statement timeout (milliseconds)
"""
conditions = [] if conditions is None else conditions if isinstance(conditions,list) else [conditions]
conn_params = "%s options = '-c statement_timeout=%s'" % (conn_params, timeout)
connection = psycopg2.connect(conn_params)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment