nansencenter / nansat

Scientist friendly Python toolbox for processing 2D satellite Earth observation data.
http://nansat.readthedocs.io
GNU General Public License v3.0
181 stars 66 forks source link

180 deg correction to longitudes in domain.get_border_wkt #165

Open mortenwh opened 8 years ago

mortenwh commented 8 years ago

See lines 674-679 in domain.py.

 674         lonList, latList = self.get_border(*args, **kwargs)
 675 
 676         # apply > 180 deg correction to longitudes
 677         for ilon, lon in enumerate(lonList):
 678             lonList[ilon] = copysign(acos(cos(lon * pi / 180.)) / pi * 180,
 679                                      sin(lon * pi / 180.))
 680 

Why is this correction done here, and not in get_border?

akorosov commented 8 years ago

And why does it use a loop? Should be fixed...

akorosov commented 8 years ago

What's wrong with loops? Without loops code is often more readable. In that particular case:

lonListRad = np.radians(lonList)
lonList = np.copysign(np.degrees(np.arccos(np.cos(lonListRad))),
                      np.sin(lonListRad))