nansencenter / nansat

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

Provide osr.SpatialReference instead of string as input to Domain, etc #67

Closed akorosov closed 10 years ago

akorosov commented 10 years ago

Problem

If we provide proj4 or WKT strings as input to domain and other functions that require spatial reference we have to parse these strings and create osr.SpatialReference and then convert it ot WKT or proj4.

Solution

Provide only osr.SpatialReference as input to Domain or other functions where spatial reference is needed.

Comments

akorosov commented 10 years ago

Added class NSR(osr.SpatialReference) which overrides the constructor. Now parameter to the constructor can be proj4 string, WKT string, EPSG code, or another osr.SpatialReference() (and hence NSR) object.

Default values of NSR() is wgs84 latlong.

This is used almost everywhere where projection is giben as a parameter (e.g. Domain.init). However interface of the public functions is not changed, (so we still can provide proj4 string to Domain) rather these inputs are parsed within NSR.init()

nansat_tools.latlongSRS is removed and NSR() is used instead.

Closed in c72dd9e