Commit 5c4cab03 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Bugfix warp_ndarray. Changed downsampling threshold of geo.raster.conversion.raster2polygon.

parent b44465fb
Pipeline #1360 passed with stages
in 1 minute and 18 seconds
# -*- coding: utf-8 -*-
from __future__ import (division, print_function, absolute_import, unicode_literals)
__version__ = '0.9.1'
__versionalias__ = '20171009_02'
__version__ = '0.9.2'
__versionalias__ = '20171012_01'
__author__ = 'Daniel Scheffler'
# Validate GDAL version
......
......@@ -40,8 +40,8 @@ def raster2polygon(array, gt, prj, DN2extract=1, exact=True, maxfeatCount=None,
assert array.ndim == 2, "Only 2D arrays are supported. Got a %sD array." % array.ndim
# downsample input array in case is has more than 144e6 pixels to prevent crash
if not exact and array.size > 144e6: # 12000 x 12000 px
# downsample input array in case is has more than 1e8 pixels to prevent crash
if not exact and array.size > 1e8: # 10000 x 10000 px
zoom_factor = 0.5
# downsample to half size, nearest neighbour
......
......@@ -30,7 +30,7 @@ __author__ = "Daniel Scheffler"
def warp_ndarray_OLD(ndarray, in_gt, in_prj, out_prj, out_gt=None, outRowsCols=None, outUL=None, out_res=None,
out_extent=None, out_dtype=None, rsp_alg=0, in_nodata=None, out_nodata=None,
outExtent_within=True):
outExtent_within=True): # pragma: no cover
"""Reproject / warp a numpy array with given geo information to target coordinate system.
:param ndarray: numpy.ndarray [rows,cols,bands]
......@@ -222,7 +222,7 @@ def warp_ndarray_OLD(ndarray, in_gt, in_prj, out_prj, out_gt=None, outRowsCols=N
return out_arr, out_gt, out_prj
def warp_GeoArray(geoArr, **kwargs):
def warp_GeoArray(geoArr, **kwargs): # pragma: no cover
# TODO remove that function
warnings.warn("warp_GeoArray is deprecated. Use geoarray.GeoArray.reproject_to_new_grid instead.",
DeprecationWarning)
......@@ -282,8 +282,10 @@ def warp_ndarray(ndarray, in_gt, in_prj=None, out_prj=None, out_dtype=None,
# how to implement: https://svn.osgeo.org/gdal/trunk/autotest/utilities/test_gdalwarp_lib.py
# assume local coordinates if no projections are given
in_prj = in_prj or "LOCAL_CS[\"MAP\"]"
out_prj = out_prj or "LOCAL_CS[\"MAP\"]"
if not in_prj and not out_prj:
if out_bounds_prj and not out_bounds_prj.startswith('LOCAL_CS'):
raise ValueError("'out_bounds_prj' cannot have a projection if 'in_prj' and 'out_prj' are not given.")
in_prj = out_prj = out_bounds_prj = "LOCAL_CS[\"MAP\"]"
# assertions
assert str(np.dtype(ndarray.dtype)) in dTypeDic_NumPy2GDAL, "Unknown target datatype '%s'." % ndarray.dtype
......
......@@ -18,7 +18,7 @@ test_requirements = requirements + ["coverage", "nose", "nose2", "nose-htmloutpu
setup(
name='py_tools_ds',
version='0.9.1',
version='0.9.2',
description="A collection of Python tools by Daniel Scheffler.",
long_description=readme + '\n\n' + history,
author="Daniel Scheffler",
......
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