Commit 5a12e412 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 !4
parents 84d2bd1e afadffdb
Pipeline #3787 failed with stages
in 8 minutes and 42 seconds
......@@ -26,7 +26,7 @@ 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 # TODO: remove that as soon as docker container is rebuilt
- pip install pyresample>=1.11.0 # TODO: remove that as soon as docker container is rebuilt
- make nosetests
- make docs
artifacts:
......
......@@ -18,7 +18,6 @@ except ImportError:
# NOTE: In case of ImportError: dlopen: cannot load any more object with static TLS,
# one could add 'from pykdtree.kdtree import KDTree' here (before pyresample import)
from pyresample.geometry import AreaDefinition, SwathDefinition
from pyresample.utils import get_area_def
from pyresample.bilinear import resample_bilinear
from pyresample.kd_tree import resample_nearest, resample_gauss, resample_custom
......@@ -677,14 +676,14 @@ class SensorMapGeometryTransformer(object):
out_extent = xmin, ymin, xmax, ymax
# get area_definition
area_definition = get_area_def(area_id='',
area_name='',
proj_id='',
proj4_args=get_proj4info(proj=tgt_prj),
x_size=x_size,
y_size=y_size,
area_extent=list(out_extent),
) # type: AreaDefinition
area_definition = AreaDefinition(area_id='',
description='',
proj_id='',
projection=get_proj4info(proj=tgt_prj),
width=x_size,
height=y_size,
area_extent=list(out_extent),
)
return area_definition
......@@ -763,10 +762,10 @@ class SensorMapGeometryTransformer(object):
out_gt, out_prj = self._get_gt_prj_from_areadefinition(self.area_definition)
# output validation
if not data_mapgeo.shape[:2] == (self.area_definition.y_size, self.area_definition.x_size):
if not data_mapgeo.shape[:2] == (self.area_definition.height, self.area_definition.width):
raise RuntimeError('The computed map geometry output does not have the expected number of rows/columns. '
'Expected: %s; output: %s.'
% (str((self.area_definition.y_size, self.area_definition.x_size)),
% (str((self.area_definition.height, self.area_definition.width)),
str(data_mapgeo.shape[:2])))
if data.ndim > 2 and data_mapgeo.ndim == 2:
raise RuntimeError('The computed map geometry output only one band instead of the expected %d bands.'
......
__version__ = '0.14.12'
__versionalias__ = '20190227_01'
__version__ = '0.14.13'
__versionalias__ = '20190321_01'
six
spectral
pyresample
pyresample>=1.11.0
......@@ -16,7 +16,7 @@ with open("py_tools_ds/version.py") as version_file:
exec(version_file.read(), version)
requirements = ['gdal', 'numpy', 'shapely', 'six', 'rasterio', 'pandas', 'geopandas',
'scikit-image', 'pyproj', 'spectral', 'pyresample']
'scikit-image', 'pyproj', 'spectral', 'pyresample>=1.11.0']
setup_requirements = [] # TODO(danschef): put setup requirements (distutils extensions, etc.) here
test_requirements = requirements + ["coverage", "nose", "nose2", "nose-htmloutput", "rednose"]
......
......@@ -24,7 +24,7 @@ dependencies:
- sphinx-argparse
- six
- spectral
- pyresample
- pyresample>=1.11.0
- flake8
- pycodestyle<2.4.0 # fixes ImportError: module 'pycodestyle' has no attribute 'break_around_binary_operator'
- pylint
......
......@@ -50,6 +50,7 @@ class Test_SensorMapGeometryTransformer(TestCase):
dem_sensors_geo = SMGT.to_sensor_geometry(self.dem_map_geo,
src_prj=32632, src_extent=self.dem_area_extent_coarse_subset_utm)
self.assertIsInstance(dem_sensors_geo, np.ndarray)
self.assertFalse(np.array_equal(np.unique(dem_sensors_geo), np.array([0])))
self.assertEquals(dem_sensors_geo.shape, (150, 1000))
def test_to_map_geometry_lonlat(self):
......@@ -66,6 +67,7 @@ class Test_SensorMapGeometryTransformer(TestCase):
rows=dem_map_geo.shape[0]))
self.assertTrue(False not in np.isclose(np.array([xmin, ymin, xmax, ymax]),
np.array(self.expected_dem_area_extent_lonlat)))
self.assertFalse(np.array_equal(np.unique(dem_map_geo), np.array([0])))
with self.assertRaises(ValueError):
SMGT.to_map_geometry(self.dem_sensor_geo[:10, :10], tgt_prj=4326) # must have the shape of lons/lats
......@@ -84,6 +86,7 @@ class Test_SensorMapGeometryTransformer(TestCase):
rows=dem_map_geo.shape[0]))
self.assertTrue(False not in np.isclose(np.array([xmin, ymin, xmax, ymax]),
np.array(self.expected_dem_area_extent_utm)))
self.assertFalse(np.array_equal(np.unique(dem_map_geo), np.array([0])))
class Test_SensorMapGeometryTransformer3D(TestCase):
......
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