Commit ee5aad8a authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Added default to SensorMapGeometryTransformer.to_map_geometry. Updated version info.

parent 71b989b1
Pipeline #3411 passed with stages
in 20 minutes and 1 second
......@@ -712,7 +712,7 @@ class SensorMapGeometryTransformer(object):
return gt, prj
def to_map_geometry(self, data, tgt_prj, tgt_extent=None, tgt_res=None, area_definition=None):
def to_map_geometry(self, data, tgt_prj=None, tgt_extent=None, tgt_res=None, area_definition=None):
# type: (np.ndarray, Union[str, int], Tuple[float, float, float, float], Tuple, AreaDefinition) -> ...
"""Transform the input sensor geometry array into map geometry.
......@@ -720,17 +720,24 @@ class SensorMapGeometryTransformer(object):
:param tgt_prj: target projection (WKT or 'epsg:1234' or <EPSG_int>)
:param tgt_extent: extent coordinates of output map geometry array (LL_x, LL_y, UR_x, UR_y) in the tgt_prj
:param tgt_res: target X/Y resolution (e.g., (30, 30))
:param area_definition: an instance of pyresample.geometry.AreaDefinition; replaces tgt_extent and tgt_res;
saves computation time
:param area_definition: an instance of pyresample.geometry.AreaDefinition;
OVERRIDES tgt_prj, tgt_extent and tgt_res; saves computation time
"""
if not data.shape == self.lons.shape == self.lats.shape:
raise ValueError(data.shape,
'Expected a sensor geometry data array with a shape of %s.' % str(self.lons.shape))
self.area_definition = area_definition or \
self.compute_areadefinition_sensor2map(
# get area_definition
if area_definition:
self.area_definition = area_definition
else:
if not tgt_prj:
raise ValueError(tgt_prj, 'Target projection must be given if area_definition is not given.')
self.area_definition = self.compute_areadefinition_sensor2map(
data, tgt_prj=tgt_prj, tgt_extent=tgt_extent, tgt_res=tgt_res)
# resample
data_mapgeo = self._resample(data, self.swath_definition, self.area_definition)
out_gt, out_prj = self._get_gt_prj_from_areadefinition(self.area_definition)
......@@ -752,9 +759,11 @@ class SensorMapGeometryTransformer(object):
"""
proj4_args = proj4_to_dict(get_proj4info(proj=src_prj))
# get area_definition
self.area_definition = AreaDefinition('', '', '', proj4_args, data.shape[1], data.shape[0],
src_extent)
# resample
data_sensorgeo = self._resample(data, self.area_definition, self.swath_definition)
# output validation
......
__version__ = '0.14.3'
__versionalias__ = '20181214_01'
__version__ = '0.14.4'
__versionalias__ = '20181214_02'
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