From 5f88b33e364245d73f7b06da01aa2821d2e153fd Mon Sep 17 00:00:00 2001 From: akorosov Date: Tue, 17 Jul 2018 10:08:33 +0200 Subject: [PATCH] #345 #347 fix reproject_GCPs --- nansat/domain.py | 2 +- nansat/mappers/mapper_amsr2_l1r.py | 2 +- nansat/mappers/mapper_obpg_l2.py | 2 +- nansat/mappers/mapper_obpg_l2_nc.py | 2 +- nansat/tests/test_vrt.py | 2 +- nansat/vrt.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nansat/domain.py b/nansat/domain.py index 620482c70..d03f1e318 100644 --- a/nansat/domain.py +++ b/nansat/domain.py @@ -852,4 +852,4 @@ def reproject_gcps(self, srs_string=''): lon, lat = self.get_border() srs_string = '+proj=stere +datum=WGS84 +ellps=WGS84 +lat_0=%f +lon_0=%f +no_defs' \ % (np.nanmedian(lat), np.nanmedian(lon)) - self.vrt.reproject_GCPs(srs_string) + self.vrt.reproject_gcps(srs_string) diff --git a/nansat/mappers/mapper_amsr2_l1r.py b/nansat/mappers/mapper_amsr2_l1r.py index 1e13aaed5..08ce6495e 100644 --- a/nansat/mappers/mapper_amsr2_l1r.py +++ b/nansat/mappers/mapper_amsr2_l1r.py @@ -122,7 +122,7 @@ def __init__(self, filename, gdalDataset, gdalMetadata, parse_time(gdalMetadata['ObservationEndDateTime']).isoformat()) # append GCPs and lat/lon projection to the vsiDataset self.dataset.SetGCPs(gcps, NSR().wkt) - self.reproject_GCPs('+proj=stere +datum=WGS84 +ellps=WGS84 +lat_0=90 +lon_0=0 +no_defs') + self.reproject_gcps('+proj=stere +datum=WGS84 +ellps=WGS84 +lat_0=90 +lon_0=0 +no_defs') self.tps = True mm = pti.get_gcmd_instrument('AMSR2') diff --git a/nansat/mappers/mapper_obpg_l2.py b/nansat/mappers/mapper_obpg_l2.py index 9f0ff896d..770732073 100644 --- a/nansat/mappers/mapper_obpg_l2.py +++ b/nansat/mappers/mapper_obpg_l2.py @@ -271,7 +271,7 @@ def __init__(self, filename, gdalDataset, gdalMetadata, center_lon /= k center_lat /= k srs = '+proj=stere +datum=WGS84 +ellps=WGS84 +lon_0=%f +lat_0=%f +no_defs' % (center_lon, center_lat) - self.reproject_GCPs(srs) + self.reproject_gcps(srs) # use TPS for reprojection self.tps = True diff --git a/nansat/mappers/mapper_obpg_l2_nc.py b/nansat/mappers/mapper_obpg_l2_nc.py index db84ee655..f70475347 100644 --- a/nansat/mappers/mapper_obpg_l2_nc.py +++ b/nansat/mappers/mapper_obpg_l2_nc.py @@ -133,7 +133,7 @@ def __init__(self, filename, gdalDataset, gdalMetadata, center_lon /= k center_lat /= k srs = '+proj=stere +datum=WGS84 +ellps=WGS84 +lon_0=%f +lat_0=%f +no_defs' % (center_lon, center_lat) - self.reproject_GCPs(srs) + self.reproject_gcps(srs) ### BAD, BAd, bad ... self.dataset.SetProjection(self.dataset.GetGCPProjection()) diff --git a/nansat/tests/test_vrt.py b/nansat/tests/test_vrt.py index c067a83db..51e234f36 100644 --- a/nansat/tests/test_vrt.py +++ b/nansat/tests/test_vrt.py @@ -579,7 +579,7 @@ def test_transform_coordinates_2d_array(self): def test_reproject_gcps(self): lon, lat = np.meshgrid(np.linspace(0, 5, 10), np.linspace(10, 20, 30)) vrt1 = VRT.from_lonlat(lon, lat) - vrt1.reproject_GCPs(str('+proj=stere')) + vrt1.reproject_gcps(str('+proj=stere')) self.assertIn('Stereographic', vrt1.dataset.GetGCPProjection()) self.assertEqual(vrt1.dataset.GetGCPs()[0].GCPX, 0) self.assertEqual(vrt1.dataset.GetGCPs()[0].GCPY, 2217341.7476875726) diff --git a/nansat/vrt.py b/nansat/vrt.py index a17b6bf5a..b16e897b1 100644 --- a/nansat/vrt.py +++ b/nansat/vrt.py @@ -1473,7 +1473,7 @@ def get_resized_vrt(self, x_size, y_size, resample_alg=1): return warped_vrt - def reproject_GCPs(self, dst_srs): + def reproject_gcps(self, dst_srs): """Reproject all GCPs to a new spatial reference system Necessary before warping an image if the given GCPs