diff --git a/lib/cartopy/_crs.pyx b/lib/cartopy/_crs.pyx index 29c4bdd56..89f143b03 100644 --- a/lib/cartopy/_crs.pyx +++ b/lib/cartopy/_crs.pyx @@ -176,8 +176,17 @@ class Geodetic(CRS): # XXX Providing a default datum is bad. Providing the ellipse on its own is sufficient to define the ellipse, # and in some cases, can overwrite the desired, well defined ellipse. def __init__(self, ellipse='WGS84', datum='WGS84'): + """ + Create a Geodetic CRS. + + Kwargs: + + * ellipse - Ellipsoid definiton. + * datum - Datum definiton. + + """ proj4_params = {'proj': 'lonlat', 'ellps': ellipse, 'datum': datum} - super(Geodetic, self).__init__(proj4_params) + super(Geodetic, self).__init__(proj4_params) # XXX Implement fwd such as Basemap's Geod. Would be used in the tissot example. # Could come from http://geographiclib.sourceforge.net diff --git a/lib/cartopy/crs.py b/lib/cartopy/crs.py index c4d2961c9..c9ccf48f7 100644 --- a/lib/cartopy/crs.py +++ b/lib/cartopy/crs.py @@ -31,6 +31,34 @@ import cartopy.trace +class RotatedGeodetic(CRS): + """ + Defines a rotated latitude/longitude coordinate system with spherical topology + and geographical distance. + + Coordinates are measured in degrees. + + """ + def __init__(self, pole_longitude, pole_latitude, ellipse='WGS84', datum='WGS84'): + """ + Create a RotatedGeodetic CRS. + + Args: + + * pole_longitude, pole_latitude - Pole position, in unrotated degrees. + + Kwargs: + + * ellipse - Ellipsoid definiton. + * datum - Datum definiton. + + """ + proj4_params = {'proj': 'ob_tran', 'o_proj': 'latlon', 'o_lon_p': 0, + 'o_lat_p': pole_latitude, 'lon_0': 180 + pole_longitude, + 'to_meter': math.radians(1), 'ellps': ellipse, 'datum': datum} + super(RotatedGeodetic, self).__init__(proj4_params) + + class Projection(CRS): """ Defines a projected coordinate system with flat topology and Euclidean