Commit 70118ff8 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Merge branch 'bugfix/implement_pyresample_changes' into 'master'

Bugfix/implement pyresample changes

See merge request !5
parents 5a12e412 c9da9e59
Pipeline #3796 passed with stages
in 9 minutes and 42 seconds
......@@ -26,7 +26,6 @@ test_py_tools_ds:
- source activate ci_env
- export GDAL_DATA=/root/miniconda3/envs/ci_env/share/gdal
- export PYTHONPATH=$PYTHONPATH:/root # /root <- directory needed later
- pip install pyresample>=1.11.0 # TODO: remove that as soon as docker container is rebuilt
- make nosetests
- make docs
artifacts:
......@@ -61,7 +60,7 @@ test_py_tools_ds_install:
- conda create -y -q --name py_tools_ds_testinstall python=3
- source activate py_tools_ds_testinstall
# resolve some requirements with conda
- conda install --yes -q -c conda-forge numpy gdal scikit-image pyproj rasterio shapely geopandas
- conda install --yes -q -c conda-forge numpy gdal scikit-image pyproj rasterio shapely geopandas pyresample>=1.11.0
- conda install --yes -q -c conda-forge libgdal ncurses # Fix for libgdal installed from defaults channel causing libkea.so.1.4.7: cannot open shared object file: No such file or directory
# - conda install --yes -q -c conda-forge kealib # fix for libkea.so.1.4.7: cannot open shared object file: No such file or directory
# run installer
......
......@@ -563,7 +563,7 @@ class SensorMapGeometryTransformer(object):
self.lons = lons
self.swath_definition = SwathDefinition(lons=lons, lats=lats)
self.area_extent_ll = [np.min(lons), np.min(lats), np.max(lons), np.max(lats)]
self.area_definition = None
self.area_definition = None # type: AreaDefinition
def _get_target_extent(self, tgt_epsg):
if tgt_epsg == 4326:
......
......@@ -15,7 +15,7 @@ __author__ = "Daniel Scheffler"
def get_overlap_polygon(poly1, poly2, v=False):
""" Returns a dict with the overlap of two shapely.Polygon() objects, the overlap percentage and the overlap area.
""" Return a dict with the overlap of two shapely.Polygon() objects, the overlap percentage and the overlap area.
:param poly1: first shapely.Polygon() object
:param poly2: second shapely.Polygon() object
......@@ -46,7 +46,8 @@ def get_overlap_polygon(poly1, poly2, v=False):
def get_footprint_polygon(CornerLonLat, fix_invalid=False):
""" Converts a list of coordinates into a shapely polygon object.
""" Convert a list of coordinates into a shapely polygon object.
:param CornerLonLat: a list of coordinate tuples like [[lon,lat], [lon. lat], ..]
in clockwise or counter clockwise order
:param fix_invalid: fix invalid output polygon by returning its convex hull (somtimes this can be different)
......@@ -69,7 +70,7 @@ def get_footprint_polygon(CornerLonLat, fix_invalid=False):
def get_smallest_boxImYX_that_contains_boxMapYX(box_mapYX, gt_im, tolerance_ndigits=5):
"""Returns image coordinates of the smallest box at the given coordinate grid that contains the given map coords box.
"""Return image coordinates of the smallest box at the given coordinate grid that contains the given map coords box.
:param box_mapYX: input box ccordinates as YX-tuples
:param gt_im: geotransform of input box
......@@ -96,7 +97,7 @@ def get_largest_onGridPoly_within_poly(outerPoly, gt, rows, cols):
def get_smallest_shapelyImPolyOnGrid_that_contains_shapelyImPoly(shapelyPoly):
"""Returns the smallest box that matches the coordinate grid of the given geotransform.
"""Return the smallest box that matches the coordinate grid of the given geotransform.
The returned shapely polygon contains image coordinates."""
xmin, ymin, xmax, ymax = shapelyPoly.bounds # image_coords-bounds
......@@ -118,7 +119,7 @@ def find_line_intersection_point(line1, line2):
def polyVertices_outside_poly(inner_poly, outer_poly):
"""Checks if a shapely polygon (inner_poly) contains vertices that do not intersect another polygon (outer_poly)
"""Check if a shapely polygon (inner_poly) contains vertices that do not intersect another polygon (outer_poly)
:param inner_poly: the polygon with the vertices to check
:param outer_poly: the polygon where all vertices have to be inside
......@@ -138,7 +139,7 @@ def polyVertices_outside_poly(inner_poly, outer_poly):
def fill_holes_within_poly(poly):
# type: (Union[Polygon, MultiPolygon]) -> Polygon
"""Fills the holes within a shapely Polygon or MultiPolygon and returns a Polygon with only the outer boundary.
"""Fill the holes within a shapely Polygon or MultiPolygon and returns a Polygon with only the outer boundary.
:param poly: <shapely.geometry.Polygon, shapely.geometry.MultiPolygon>, shapely.geometry.GeometryCollection>
:return:
......
__version__ = '0.14.13'
__versionalias__ = '20190321_01'
__version__ = '0.14.14'
__versionalias__ = '20190321_02'
......@@ -2,7 +2,7 @@
context_dir="./context"
dockerfile="py_tools_ds_ci.docker"
tag="py_tools_ds_ci:0.13.1"
tag="py_tools_ds_ci:0.14.14"
gitlab_runner="py_tools_ds_gitlab_CI_runner"
echo "#### Build runner docker image"
......
......@@ -16,6 +16,7 @@ dependencies:
- pyproj
- lxml
- geopandas
- pyresample>=1.11.0
- ipython
- conda-build # for conda deployment
- conda-build-all
......@@ -24,9 +25,8 @@ dependencies:
- sphinx-argparse
- six
- spectral
- pyresample>=1.11.0
- flake8
- pycodestyle<2.4.0 # fixes ImportError: module 'pycodestyle' has no attribute 'break_around_binary_operator'
- pycodestyle
- pylint
- pydocstyle
- nose
......
FROM gms_base_centos:0.2
FROM gms_base_centos:0.3
RUN yum update -y && \
yum install -y patch # patch: conda skeleton will not work without: # https://stackoverflow.com/questions/40392161/building-conda-skeleton-from-pypi-package-throws-error
......
......@@ -61,7 +61,8 @@ class Test_SensorMapGeometryTransformer(TestCase):
# to Lon/Lat
dem_map_geo, dem_gt, dem_prj = SMGT.to_map_geometry(self.dem_sensor_geo, tgt_prj=4326)
self.assertIsInstance(dem_map_geo, np.ndarray)
self.assertEquals(dem_map_geo.shape, (286, 1058))
self.assertEquals(dem_map_geo.shape, (SMGT.area_definition.height,
SMGT.area_definition.width))
xmin, xmax, ymin, ymax = corner_coord_to_minmax(get_corner_coordinates(gt=dem_gt,
cols=dem_map_geo.shape[1],
rows=dem_map_geo.shape[0]))
......@@ -124,7 +125,9 @@ class Test_SensorMapGeometryTransformer3D(TestCase):
# to Lon/Lat
data_mapgeo_3D, dem_gt, dem_prj = SMGT.to_map_geometry(self.data_sensor_geo_3D, tgt_prj=4326)
self.assertIsInstance(data_mapgeo_3D, np.ndarray)
self.assertEquals(data_mapgeo_3D.shape, (286, 1058, 2))
# only validate number of bands (height and width are validated in 2D version
# fixed numbers may fail here due to float uncertainty errors
self.assertEquals(data_mapgeo_3D.shape[2], 2)
xmin, xmax, ymin, ymax = corner_coord_to_minmax(get_corner_coordinates(gt=dem_gt,
cols=data_mapgeo_3D.shape[1],
rows=data_mapgeo_3D.shape[0]))
......
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