-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from ASFHyP3/develop
Release L8 IndexError (partial) fix
- Loading branch information
Showing
9 changed files
with
139 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
diff --git a/hyp3_autorift/vend/testGeogridOptical.py b/hyp3_autorift/vend/testGeogridOptical.py | ||
index 27793bd..eee302c 100755 | ||
--- a/hyp3_autorift/vend/testGeogridOptical.py | ||
+++ b/hyp3_autorift/vend/testGeogridOptical.py | ||
@@ -126,6 +126,9 @@ def coregisterLoadMetadata(indir_r, indir_s, urlflag): | ||
|
||
x1a, y1a, xsize1, ysize1, x2a, y2a, xsize2, ysize2, trans = obj.coregister(indir_r, indir_s, urlflag) | ||
|
||
+ xsize1 = min((xsize1, xsize2)) | ||
+ ysize1 = min((ysize1, ysize2)) | ||
+ | ||
if urlflag is 1: | ||
DS = gdal.Open('/vsicurl/%s' % (indir_r)) | ||
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,65 @@ | ||
import numpy as np | ||
from osgeo import ogr | ||
|
||
from hyp3_autorift import geometry | ||
|
||
|
||
def test_polygon_from_bbox(): | ||
lat_limits = (1, 2) | ||
lon_limits = (3, 4) | ||
assert geometry.polygon_from_bbox(lat_limits, lon_limits).ExportToWkt() \ | ||
== 'POLYGON ((3 1 0,4 1 0,4 2 0,3 2 0,3 1 0))' | ||
|
||
polygon = geometry.polygon_from_bbox(lat_limits, lon_limits) | ||
assert str(polygon) == 'POLYGON ((1 4,2 4,2 3,1 3,1 4))' | ||
srs = polygon.GetSpatialReference() | ||
assert srs.GetAttrValue('AUTHORITY', 0) == 'EPSG' | ||
assert srs.GetAttrValue('AUTHORITY', 1) == '4326' | ||
|
||
polygon = geometry.polygon_from_bbox(lat_limits, lon_limits, epsg_code=3413) | ||
assert str(polygon) == 'POLYGON ((1 4,2 4,2 3,1 3,1 4))' | ||
srs = polygon.GetSpatialReference() | ||
assert srs.GetAttrValue('AUTHORITY', 0) == 'EPSG' | ||
assert srs.GetAttrValue('AUTHORITY', 1) == '3413' | ||
|
||
|
||
def test_pol_bounds_in_proj(): | ||
polygon = geometry.polygon_from_bbox(lat_limits=(55, 56), lon_limits=(40, 41)) | ||
lat_limits = (55, 56) | ||
lon_limits = (40, 41) | ||
polygon = geometry.polygon_from_bbox(x_limits=lat_limits, y_limits=lon_limits) | ||
assert np.allclose( | ||
geometry.poly_bounds_in_proj(polygon, in_epsg=4326, out_epsg=3413), # NPS | ||
geometry.poly_bounds_in_proj(polygon, out_epsg=3413), # NPS | ||
(3776365.5697414433, 3899644.3388010086, -340706.3423259673, -264432.19003121805) | ||
) | ||
|
||
polygon = geometry.polygon_from_bbox(lat_limits=(-58, -57), lon_limits=(40, 41)) | ||
lat_limits = (-58, -57) | ||
lon_limits = (40, 41) | ||
polygon = geometry.polygon_from_bbox(x_limits=lat_limits, y_limits=lon_limits) | ||
assert np.allclose( | ||
geometry.poly_bounds_in_proj(polygon, in_epsg=4326, out_epsg=3031), # SPS | ||
geometry.poly_bounds_in_proj(polygon, out_epsg=3031), # SPS | ||
(2292512.6214329866, 2416952.768825992, 2691684.1770189586, 2822144.2827928355) | ||
) | ||
|
||
polygon = geometry.polygon_from_bbox(lat_limits=(22, 23), lon_limits=(40, 41)) | ||
lat_limits = (22, 23) | ||
lon_limits = (40, 41) | ||
polygon = geometry.polygon_from_bbox(x_limits=lat_limits, y_limits=lon_limits) | ||
assert np.allclose( | ||
geometry.poly_bounds_in_proj(polygon, in_epsg=4326, out_epsg=32637), | ||
geometry.poly_bounds_in_proj(polygon, out_epsg=32637), | ||
(602485.1663686256, 706472.0593133729, 2433164.428653589, 2544918.1043369616) | ||
) | ||
|
||
polygon = geometry.polygon_from_bbox(lat_limits=(-23, -22), lon_limits=(40, 41)) | ||
lat_limits = (-23, -22) | ||
lon_limits = (40, 41) | ||
polygon = geometry.polygon_from_bbox(x_limits=lat_limits, y_limits=lon_limits) | ||
assert np.allclose( | ||
geometry.poly_bounds_in_proj(polygon, in_epsg=4326, out_epsg=32737), | ||
geometry.poly_bounds_in_proj(polygon, out_epsg=32737), | ||
(602485.1663686256, 706472.0593133729, 7455081.895663038, 7566835.5713464115) | ||
) | ||
|
||
|
||
def test_flip_point_coordinates(): | ||
point = ogr.Geometry(ogr.wkbPoint) | ||
point.AddPoint_2D(0, 1) | ||
assert str(geometry.flip_point_coordinates(point)) == 'POINT (1 0)' | ||
|
||
point = ogr.Geometry(ogr.wkbPoint) | ||
point.AddPoint(2, 3, 4) | ||
assert str(geometry.flip_point_coordinates(point)) == 'POINT (3 2)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters