Skip to content

Commit

Permalink
#345 #347 fix reproject_GCPs
Browse files Browse the repository at this point in the history
  • Loading branch information
akorosov committed Jul 17, 2018
1 parent ac01673 commit 5f88b33
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion nansat/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion nansat/mappers/mapper_amsr2_l1r.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion nansat/mappers/mapper_obpg_l2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nansat/mappers/mapper_obpg_l2_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion nansat/tests/test_vrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion nansat/vrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f88b33

Please sign in to comment.