Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Scheffler
py_tools_ds
Commits
5c4cab03
Commit
5c4cab03
authored
Oct 12, 2017
by
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
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
py_tools_ds/__init__.py
View file @
5c4cab03
# -*- coding: utf-8 -*-
from
__future__
import
(
division
,
print_function
,
absolute_import
,
unicode_literals
)
__version__
=
'0.9.
1
'
__versionalias__
=
'201710
09
_0
2
'
__version__
=
'0.9.
2
'
__versionalias__
=
'201710
12
_0
1
'
__author__
=
'Daniel Scheffler'
# Validate GDAL version
...
...
py_tools_ds/geo/raster/conversion.py
View file @
5c4cab03
...
...
@@ -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 1
44e6
pixels to prevent crash
if
not
exact
and
array
.
size
>
1
44e6
:
# 1
2
000 x 1
2
000 px
# downsample input array in case is has more than 1
e8
pixels to prevent crash
if
not
exact
and
array
.
size
>
1
e8
:
# 1
0
000 x 1
0
000 px
zoom_factor
=
0.5
# downsample to half size, nearest neighbour
...
...
py_tools_ds/geo/raster/reproject.py
View file @
5c4cab03
...
...
@@ -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
...
...
setup.py
View file @
5c4cab03
...
...
@@ -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"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment