Commit 2d893275 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixed warning within output validation of warp_ndarray in case out_bounds_prj...


Fixed warning within output validation of  warp_ndarray in case out_bounds_prj is provided in a different projection.
Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 341c7bce
Pipeline #26386 passed with stages
in 2 minutes and 18 seconds
......@@ -2,6 +2,12 @@
History
=======
0.17.7 (2021-08-09)
-------------------
* Fixed warning within output validation of warp_ndarray in case out_bounds_prj is provided in a different projection.
0.17.6 (2021-07-12)
-------------------
......
......@@ -32,7 +32,7 @@ from osgeo import gdal, gdalnumeric
from ...dtypes.conversion import dTypeDic_NumPy2GDAL
from ..projection import WKT2EPSG, isProjectedOrGeographic, prj_equal
from ..coord_trafo import pixelToLatLon
from ..coord_trafo import pixelToLatLon, transform_any_prj
from ..coord_calc import corner_coord_to_minmax, get_corner_coordinates
from ...io.raster.gdal import get_GDAL_ds_inmem
from ...processing.progress_mon import ProgressBar
......@@ -503,9 +503,17 @@ def warp_ndarray(ndarray, in_gt, in_prj=None, out_prj=None, out_dtype=None,
# output bounds verification
if out_bounds:
if out_bounds_prj and not prj_equal(out_bounds_prj, res_prj):
out_xmin, out_ymin = transform_any_prj(out_bounds_prj, res_prj, *out_bounds[:2])
out_xmax, out_ymax = transform_any_prj(out_bounds_prj, res_prj, *out_bounds[2:])
else:
out_xmin, out_ymin, out_xmax, out_ymax = out_bounds
xmin, xmax, ymin, ymax = \
corner_coord_to_minmax(get_corner_coordinates(gt=res_gt, rows=res_arr.shape[0], cols=res_arr.shape[1]))
if False in np.isclose(out_bounds, (xmin, ymin, xmax, ymax)):
warnings.warn('The output bounds of warp_ndarray do not match the requested bounds!')
if False in np.isclose((out_xmin, out_ymin, out_xmax, out_ymax), (xmin, ymin, xmax, ymax)):
warnings.warn('The output bounds of warp_ndarray do not exactly match the requested bounds!')
return res_arr, res_gt, res_prj
......@@ -19,5 +19,5 @@
# You should have received a copy of the GNU Lesser General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '0.17.6'
__versionalias__ = '20210712_01'
__version__ = '0.17.7'
__versionalias__ = '20210809_01'
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