Commit 7503cec9 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Improved output validation.

parent ef22570c
Pipeline #3388 passed with stages
in 9 minutes and 50 seconds
......@@ -715,7 +715,15 @@ class SensorMapGeometryTransformer(object):
area_extent=out_extent,
) # type: AreaDefinition
return self._resample(self.swath_definition, self.area_definition), out_gt, out_prj
data_mapgeo = self._resample(self.swath_definition, self.area_definition)
# output validation
if not data_mapgeo.shape == (rows_out, cols_out):
raise RuntimeError('The computed map geometry output does not have the expected shape. '
'Expected: %s; output array shape: %s.'
% (rows_out, cols_out), data_mapgeo.shape)
return data_mapgeo, out_gt, out_prj
def to_sensor_geometry(self, src_prj, src_extent):
# type: (Union[str, int], List[float, float, float, float]) -> np.ndarray
......@@ -729,4 +737,12 @@ class SensorMapGeometryTransformer(object):
self.area_definition = AreaDefinition('', '', '', proj4_args, self.data.shape[1], self.data.shape[0],
src_extent)
return self._resample(self.area_definition, self.swath_definition)
data_sensorgeo = self._resample(self.area_definition, self.swath_definition)
# output validation
if not data_sensorgeo.shape == self.lats.shape:
raise RuntimeError('The computed sensor geometry output does not have the same size like the coordinates '
'array. Coordinates array: %s; output array: %s.'
% (self.lats.shape, data_sensorgeo.shape))
return data_sensorgeo
__version__ = '0.14.2'
__versionalias__ = '20181213_02'
__versionalias__ = '20181213_03'
Supports Markdown
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