diff --git a/enpt/model/images.py b/enpt/model/images.py index b8896219c1674f2302a363845091cb59cca42dcb..4119359250055904367fd6af73b328fa0328364a 100644 --- a/enpt/model/images.py +++ b/enpt/model/images.py @@ -457,12 +457,12 @@ class EnMAP_Detector_SensorGeo(_EnMAP_Image): distance_min = 27.0 distance_max = 34.0 - # check bottom left + # compute distance between image1 LL and image2 UL x1, y1, _, _ = utm.from_latlon(self.detector_meta.lat_UL_UR_LL_LR[2], self.detector_meta.lon_UL_UR_LL_LR[2]) x2, y2, _, _ = utm.from_latlon(img2.detector_meta.lat_UL_UR_LL_LR[0], img2.detector_meta.lon_UL_UR_LL_LR[0]) distance_left = np.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2) - # check bottom right + # compute distance between image1 LR and image2 UR x1, y1, _, _ = utm.from_latlon(self.detector_meta.lat_UL_UR_LL_LR[3], self.detector_meta.lon_UL_UR_LL_LR[3]) x2, y2, _, _ = utm.from_latlon(img2.detector_meta.lat_UL_UR_LL_LR[1], img2.detector_meta.lon_UL_UR_LL_LR[1]) distance_right = np.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2) @@ -488,19 +488,19 @@ class EnMAP_Detector_SensorGeo(_EnMAP_Image): self.detector_meta.nrows += n_lines - # Create new corner coordinate + # Compute new lower coordinates if not self.cfg.is_dummy_dataformat: - enmapIm_cornerCoords = tuple(zip(img2.detector_meta.lon_UL_UR_LL_LR, - img2.detector_meta.lat_UL_UR_LL_LR)) + img2_cornerCoords = tuple(zip(img2.detector_meta.lon_UL_UR_LL_LR, + img2.detector_meta.lat_UL_UR_LL_LR)) dem_validated = DEM_Processor(img2.cfg.path_dem, - enmapIm_cornerCoords=enmapIm_cornerCoords).dem + enmapIm_cornerCoords=img2_cornerCoords).dem LL, LR = compute_mapCoords_within_sensorGeoDims( + sensorgeoCoords_YX=[(n_lines - 1, 0), # LL + (n_lines - 1, img2.detector_meta.ncols - 1)], # LR rpc_coeffs=list(img2.detector_meta.rpc_coeffs.values())[0], # RPC coeffs of first band of the detector dem=dem_validated, - enmapIm_cornerCoords=enmapIm_cornerCoords, - enmapIm_dims_sensorgeo=(img2.detector_meta.nrows, img2.detector_meta.ncols), - sensorgeoCoords_YX=[(n_lines - 1, 0), # LL - (n_lines - 1, img2.detector_meta.ncols - 1)] # LR + enmapIm_cornerCoords=img2_cornerCoords, + enmapIm_dims_sensorgeo=(img2.detector_meta.nrows, img2.detector_meta.ncols) ) self.detector_meta.lon_UL_UR_LL_LR[2], self.detector_meta.lat_UL_UR_LL_LR[2] = LL diff --git a/enpt/processors/spatial_transform/spatial_transform.py b/enpt/processors/spatial_transform/spatial_transform.py index d2f51933eb7021fcfebcce2ab471469cb5590b99..972218a4805e404194c95e549370a731ffb2e678 100644 --- a/enpt/processors/spatial_transform/spatial_transform.py +++ b/enpt/processors/spatial_transform/spatial_transform.py @@ -480,19 +480,19 @@ class RPC_3D_Geolayer_Generator(object): return lons, lats -def compute_mapCoords_within_sensorGeoDims(rpc_coeffs: dict, +def compute_mapCoords_within_sensorGeoDims(sensorgeoCoords_YX: List[Tuple[float, float]], + rpc_coeffs: dict, dem: Union[str, GeoArray], enmapIm_cornerCoords: Tuple[Tuple[float, float]], enmapIm_dims_sensorgeo: Tuple[int, int], - sensorgeoCoords_YX: List[Tuple[float, float]] ) -> List[Tuple[float, float]]: - """ + """Compute map coordinates for a given image coordinate pair of an EnMAP image in sensor geometry. - :param rpc_coeffs: + :param sensorgeoCoords_YX: list of requested sensor geometry positions [(row, column), (row, column), ...] + :param rpc_coeffs: RPC coefficients describing the relation between sensor and map geometry :param dem: digital elevation model in MAP geometry - :param enmapIm_cornerCoords: - :param enmapIm_dims_sensorgeo: (rows, columns) - :param sensorgeoCoords_YX: + :param enmapIm_cornerCoords: MAP coordinates of the EnMAP image + :param enmapIm_dims_sensorgeo: dimensions of the sensor geometry EnMAP image (rows, columns) :return: """ # compute coordinate array @@ -502,7 +502,7 @@ def compute_mapCoords_within_sensorGeoDims(rpc_coeffs: dict, enmapIm_dims_sensorgeo=enmapIm_dims_sensorgeo) lons, lats = RPCGG.compute_geolayer() - # extract the new corner coordinated from the coordinate arrays computed via RPCs + # extract the new corner coordinate from the coordinate arrays computed via RPCs rows, cols = enmapIm_dims_sensorgeo ul, ur, ll, lr = enmapIm_cornerCoords diff --git a/tests/data/EnMAP_Level_1B/ENMAP01-____L1B-DT000000987_20130205T105307Z_001_V000003_20181214T160003Z__rows0-99.zip b/tests/data/EnMAP_Level_1B/ENMAP01-____L1B-DT000000987_20130205T105307Z_001_V000003_20181214T160003Z__rows0-99.zip index 8d5bee5139f8363b239c31c747aa813b57d9acb4..f4b49cf9a37b844911edff415bb213f0c8daa2e7 100644 --- a/tests/data/EnMAP_Level_1B/ENMAP01-____L1B-DT000000987_20130205T105307Z_001_V000003_20181214T160003Z__rows0-99.zip +++ b/tests/data/EnMAP_Level_1B/ENMAP01-____L1B-DT000000987_20130205T105307Z_001_V000003_20181214T160003Z__rows0-99.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:414187f15426150478da2932cebf45570f5926a4f9f06a1bfce2340687d80154 +oid sha256:a7140ac929ea241502c60b5b70f2a5cba2b548150587d15a4cc6fe52f9cc2aee size 46721157 diff --git a/tests/data/EnMAP_Level_1B/ENMAP01-____L1B-DT000000987_20130205T105307Z_001_V000003_20181214T160003Z__rows100-199.zip b/tests/data/EnMAP_Level_1B/ENMAP01-____L1B-DT000000987_20130205T105307Z_001_V000003_20181214T160003Z__rows100-199.zip index 36bc08dfd3f9e2650fb32e42dc00c1f676ca90b1..284a6fbcc76d0d3553771d2aa764e4cfe73f7b11 100644 --- a/tests/data/EnMAP_Level_1B/ENMAP01-____L1B-DT000000987_20130205T105307Z_001_V000003_20181214T160003Z__rows100-199.zip +++ b/tests/data/EnMAP_Level_1B/ENMAP01-____L1B-DT000000987_20130205T105307Z_001_V000003_20181214T160003Z__rows100-199.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:37c7038d39195ba3ff2bc17cf026b875317c9fd82cf127635f62140d88ff474a +oid sha256:01f36ac86c8cece751335d0ecb9c984b5f1c410080f0e02f610cc627b308cfcd size 46629876 diff --git a/tests/test_orthorectification.py b/tests/test_orthorectification.py index a8a14ce13072bfe0e91f8060e4a57a8ab01c189a..a9d0c66da4a8ff23bdc06cef11c55821ea255552 100644 --- a/tests/test_orthorectification.py +++ b/tests/test_orthorectification.py @@ -22,7 +22,7 @@ from enpt.model.images import EnMAPL2Product_MapGeo class Test_Orthorectifier(TestCase): def setUp(self): - self.config = EnPTConfig(**config_for_testing) + self.config = EnPTConfig(**config_for_testing) # FIXME still the Alpine dataset # create a temporary directory # NOTE: This must exist during the whole runtime of Test_Orthorectifier, otherwise