Commit 99b84781 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Merge branch 'master' into Tests

Conflicts:
	tests/test_geoarray.py
parents 0a4abf2d b8f7fe0b
......@@ -2,8 +2,8 @@
__author__ = """Daniel Scheffler"""
__email__ = 'danschef@gfz-potsdam.de'
__version__ = '0.2.3'
__versionalias__ = 'v20170529.04'
__version__ = '0.2.4'
__versionalias__ = 'v20170609.01'
from .baseclasses import GeoArray
......
......@@ -24,20 +24,20 @@ except ImportError:
import gdalnumeric
from geopandas import GeoDataFrame, GeoSeries
from pandas import DataFrame
from py_tools_ds.ptds.convenience.object_oriented import alias_property
from py_tools_ds.ptds.geo.coord_calc import get_corner_coordinates
from py_tools_ds.ptds.geo.coord_grid import snap_bounds_to_pixGrid
from py_tools_ds.ptds.geo.coord_trafo import mapXY2imXY, imXY2mapXY, transform_any_prj, reproject_shapelyGeometry
from py_tools_ds.ptds.geo.projection import prj_equal, WKT2EPSG, EPSG2WKT
from py_tools_ds.ptds.geo.raster.conversion import raster2polygon
from py_tools_ds.ptds.geo.vector.topology \
from py_tools_ds.convenience.object_oriented import alias_property
from py_tools_ds.geo.coord_calc import get_corner_coordinates
from py_tools_ds.geo.coord_grid import snap_bounds_to_pixGrid
from py_tools_ds.geo.coord_trafo import mapXY2imXY, imXY2mapXY, transform_any_prj, reproject_shapelyGeometry
from py_tools_ds.geo.projection import prj_equal, WKT2EPSG, EPSG2WKT
from py_tools_ds.geo.raster.conversion import raster2polygon
from py_tools_ds.geo.vector.topology \
import get_footprint_polygon, polyVertices_outside_poly, fill_holes_within_poly
from py_tools_ds.ptds.geo.vector.geometry import boxObj
from py_tools_ds.ptds.io.raster.gdal import get_GDAL_ds_inmem
from py_tools_ds.ptds.numeric.array import find_noDataVal
from py_tools_ds.ptds.compatibility.python.exceptions \
from py_tools_ds.geo.vector.geometry import boxObj
from py_tools_ds.io.raster.gdal import get_GDAL_ds_inmem
from py_tools_ds.numeric.array import find_noDataVal
from py_tools_ds.compatibility.python.exceptions \
import TimeoutError as TimeoutError_comp, FileNotFoundError as FileNotFoundError_comp
from py_tools_ds.ptds.compatibility.gdal import get_gdal_func
from py_tools_ds.compatibility.gdal import get_gdal_func
# internal imports
from .subsetting import get_array_at_mapPos
......@@ -898,7 +898,7 @@ class GeoArray(object):
xdim, ydim = int(xdim), int(ydim)
if xdim or ydim or out_prj:
from py_tools_ds.ptds.geo.raster.reproject import warp_ndarray
from py_tools_ds.geo.raster.reproject import warp_ndarray
image2plot, gt, prj = warp_ndarray(image2plot, self.geotransform, self.projection,
out_XYdims=(xdim, ydim), in_nodata=nodataVal, out_nodata=nodataVal,
transformerOptions=transOpt, out_prj=out_prj, q=True)
......@@ -929,7 +929,8 @@ class GeoArray(object):
:param vmax:
:param cmap:
:param nodataVal:
:param res_factor:
:param res_factor: <float> resolution factor for downsampling of the image to be plotted in order to save
plotting time and memory (default=None -> downsampling is performed to 1000x1000)
:param interactive: <bool> activates interactive plotting based on 'holoviews' library.
NOTE: this deactivates the magic '% matplotlib inline' in Jupyter Notebook
:return:
......@@ -939,9 +940,9 @@ class GeoArray(object):
# get image to plot
nodataVal = nodataVal if nodataVal is not None else self.nodata
image2plot, gt, prj = self._get_plottable_image(xlim, ylim, band, boundsMap=boundsMap,
boundsMapPrj=boundsMapPrj, res_factor=res_factor,
nodataVal=nodataVal)
image2plot, gt, prj = \
self._get_plottable_image(xlim, ylim, band, boundsMap=boundsMap, boundsMapPrj=boundsMapPrj,
res_factor=res_factor, nodataVal=nodataVal)
# set color palette
palette = cmap if cmap else plt.cm.gray
......@@ -1006,7 +1007,8 @@ class GeoArray(object):
:param vmax:
:param cmap:
:param nodataVal:
:param res_factor:
:param res_factor: <float> resolution factor for downsampling of the image to be plotted in order to save
plotting time and memory (default=None -> downsampling is performed to 1000x1000)
:param return_map:
:param zoomable: <bool> enable or disable zooming via mpld3
:return:
......@@ -1225,12 +1227,12 @@ class GeoArray(object):
def get_subset(self, xslice=None, yslice=None, zslice=None, return_GeoArray=True):
# type: (slice, slice, slice, bool) -> GeoArray
"""Returns a new instatnce of GeoArray representing a subset of the initial one wit respect to given array position.
:param xslice: a slice providing the X-position for the subset in the form slice(xstart, xend, xstep)
:param yslice: a slice providing the Y-position for the subset in the form slice(ystart, yend, ystep)
:param zslice: a slice providing the Z-position for the subset in the form slice(zstart, zend, zstep)
:param return_GeoArray: whether to return an instance of GeoArray (default) or a tuple(np.ndarray, gt, prj)
:return:
:return:
"""
sub_arr = self[xslice if xslice else slice(None),
......@@ -1280,7 +1282,7 @@ class GeoArray(object):
gt = (tgt_xygrid[0][0], tgt_xgsd, 0, max(tgt_xygrid[1]), 0, -tgt_ygsd)
xmin, ymin, xmax, ymax = snap_bounds_to_pixGrid(tgt_bounds, gt, roundAlg='on')
from py_tools_ds.ptds.geo.raster.reproject import warp_ndarray
from py_tools_ds.geo.raster.reproject import warp_ndarray
self.arr, self.gt, self.prj = \
warp_ndarray(self[:], self.gt, self.prj, tgt_prj,
out_gsd = (tgt_xgsd, tgt_ygsd),
......
......@@ -5,12 +5,12 @@ __author__='Daniel Scheffler'
import warnings
import numpy as np
from shapely.geometry import box, Polygon
from py_tools_ds.ptds.geo.coord_calc import get_corner_coordinates, calc_FullDataset_corner_positions
from py_tools_ds.ptds.geo.coord_grid import snap_bounds_to_pixGrid
from py_tools_ds.ptds.geo.coord_trafo import mapXY2imXY, transform_any_prj, imXY2mapXY
from py_tools_ds.ptds.geo.projection import prj_equal
from py_tools_ds.ptds.geo.vector.topology import get_overlap_polygon
from py_tools_ds.ptds.numeric.array import get_outFillZeroSaturated
from py_tools_ds.geo.coord_calc import get_corner_coordinates, calc_FullDataset_corner_positions
from py_tools_ds.geo.coord_grid import snap_bounds_to_pixGrid
from py_tools_ds.geo.coord_trafo import mapXY2imXY, transform_any_prj, imXY2mapXY
from py_tools_ds.geo.projection import prj_equal
from py_tools_ds.geo.vector.topology import get_overlap_polygon
from py_tools_ds.numeric.array import get_outFillZeroSaturated
......@@ -157,7 +157,7 @@ def get_array_at_mapPosOLD(arr, arr_gt, arr_prj, mapBounds, mapBounds_prj, band2
out_cols = int(abs((xmax - xmin) / arr_gt[1])) # FIXME using out_gt and outRowsCols is a workaround for not beeing able to pass output extent in the OUTPUT projection
# reproject temporary data to target projection (the projection of mapBounds)
from py_tools_ds.ptds.geo.raster.reproject import warp_ndarray
from py_tools_ds.geo.raster.reproject import warp_ndarray
out_arr, out_gt, out_prj = warp_ndarray(temp_arr, temp_gt, arr_prj, mapBounds_prj,
in_nodata=fillVal, out_nodata=fillVal, out_gt=out_gt,
outRowsCols=(out_rows, out_cols), outExtent_within=True,rsp_alg=0) # FIXME resampling alg
......@@ -210,7 +210,7 @@ def get_array_at_mapPos(arr, arr_gt, arr_prj, out_prj, mapBounds, mapBounds_prj=
arr = arr[:,:,band2get] if band2get else arr[:] # also converts GeoArray to numpy.ndarray
from py_tools_ds.ptds.geo.raster.reproject import warp_ndarray
from py_tools_ds.geo.raster.reproject import warp_ndarray
out_arr, out_gt, out_prj = \
warp_ndarray(arr, arr_gt, arr_prj, out_prj=out_prj, out_bounds=mapBounds, out_bounds_prj=mapBounds_prj,
in_nodata=fillVal, out_nodata=fillVal, rspAlg=rspAlg, out_gsd=out_gsd, progress=progress)
......
......@@ -20,7 +20,7 @@ test_requirements = [
setup(
name='geoarray',
version='0.2.3',
version='0.2.4',
description="Fast Python interface for geodata - either on disk or in memory.",
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