# Path: karta/crs.py
# class CartesianCRS(CRS):
#     """ Cartesian (flat-earth) reference systems with (x, y) coordinates """
#     name = "Cartesian"
# 
#     def __init__(self):
#         self.ref_proj4 = ""
#         self.ref_wkt = ""
#         return
# 
#     @staticmethod
#     def project(x, y, inverse=False):
#         # Projection on a cartesian coordinate system is the identity
#         return x, y
# 
#     @staticmethod
#     def forward(x, y, az, dist, radians=False):
#         """ Forward geodetic problem from a point """
#         if not radians:
#             az = np.array(az) / 180 * pi
# 
#         x2 = x + dist * np.sin(az)
#         y2 = y + dist * np.cos(az)
#         baz = geodesy.unroll_rad(az + pi)
# 
#         if not radians:
#             baz = np.array(baz) * 180 / pi
#         return x2, y2, baz
# 
#     @staticmethod
#     def inverse(x1, y1, x2, y2, radians=False):
#         """ Inverse geodetic problem to find the geodesic between points """
#         dist = geodesy.plane_distance(x1, y1, x2, y2)
#         az = geodesy.plane_azimuth(x1, y1, x2, y2)
#         baz = geodesy.unroll_rad(az + pi)
# 
#         if not radians:
#             az = az * 180 / pi
#             baz = baz * 180 / pi
#         return az, baz, dist
# 
#     @staticmethod
#     def transform(*args):
#         raise NotImplementedError("Cartesian CRS cannot be accurately transformed")


import numpy as np
from ..crs import CartesianCRS

def coordinate_transformer(crs1, crs2):
    if crs1 == crs2:
        def transformer(x, y):
            return x, y
    else:
        def transformer(x, y):
            return crs1.transform(crs2, x, y)
    return transformer

class CoordinateGenerator(object):
    """ Class that generates coordinates from grid indices in a specified
    coordinate system. """


# Path: karta/crs.py
# class CartesianCRS(CRS):
#     """ Cartesian (flat-earth) reference systems with (x, y) coordinates """
#     name = "Cartesian"
# 
#     def __init__(self):
#         self.ref_proj4 = ""
#         self.ref_wkt = ""
#         return
# 
#     @staticmethod
#     def project(x, y, inverse=False):
#         # Projection on a cartesian coordinate system is the identity
#         return x, y
# 
#     @staticmethod
#     def forward(x, y, az, dist, radians=False):
#         """ Forward geodetic problem from a point """
#         if not radians:
#             az = np.array(az) / 180 * pi
# 
#         x2 = x + dist * np.sin(az)
#         y2 = y + dist * np.cos(az)
#         baz = geodesy.unroll_rad(az + pi)
# 
#         if not radians:
#             baz = np.array(baz) * 180 / pi
#         return x2, y2, baz
# 
#     @staticmethod
#     def inverse(x1, y1, x2, y2, radians=False):
#         """ Inverse geodetic problem to find the geodesic between points """
#         dist = geodesy.plane_distance(x1, y1, x2, y2)
#         az = geodesy.plane_azimuth(x1, y1, x2, y2)
#         baz = geodesy.unroll_rad(az + pi)
# 
#         if not radians:
#             az = az * 180 / pi
#             baz = baz * 180 / pi
#         return az, baz, dist
# 
#     @staticmethod
#     def transform(*args):
#         raise NotImplementedError("Cartesian CRS cannot be accurately transformed")


# Path: karta/raster/coordgen.py
import numpy as np
from ..crs import CartesianCRS


def coordinate_transformer(crs1, crs2):
    if crs1 == crs2:
        def transformer(x, y):
            return x, y
    else:
        def transformer(x, y):
            return crs1.transform(crs2, x, y)
    return transformer

class CoordinateGenerator(object):
    """ Class that generates coordinates from grid indices in a specified
    coordinate system. """


    def __init__(self, transform, size, transform_crs=CartesianCRS, output_crs=CartesianCRS):