# Path: nansat/utils.py
#     MATPLOTLIB_IS_INSTALLED = False
#     MATPLOTLIB_IS_INSTALLED = True
# NUMPY_TO_GDAL_TYPE_MAP = {
#         'uint8': 1,
#         'int8': 1,
#         'uint16': 2,
#         'int16': 3,
#         'uint32': 4,
#         'int32': 5,
#         'float32': 6,
#         'float64': 7,
#         'complex64': 10,
#         'complex128': 11
#     }
# def remove_keys(dict, keys):
# def register_colormaps():
# def initial_bearing(lon1, lat1, lon2, lat2):
# def haversine(lon1, lat1, lon2, lat2):
# def add_logger(logName='', logLevel=None):
# def get_random_color(c0=None, minDist=100, low=0, high=255):
# def parse_time(time_string):
# 
# Path: nansat/nsr.py
# class NSR(osr.SpatialReference, object):
#     """Nansat Spatial Reference. Overrides constructor of osr.SpatialReference.
# 
#     Parameters
#     ----------
#     srs : 0, PROJ4 or EPSG or WKT or osr.SpatialReference, NSR
#         Specifies spatial reference system (SRS)
#         PROJ4:
#         string with proj4 options [http://trac.osgeo.org/proj/] e.g.:
#         '+proj=latlong +datum=WGS84 +ellps=WGS84 +no_defs'
#         '+proj=stere +datum=WGS84 +ellps=WGS84 +lat_0=75 +lon_0=0 +no_defs'
#         EPSG:
#         integer with EPSG number, [http://spatialreference.org/],
#         e.g. 4326
#         WKT:
#         string with Well Know Text of SRS. E.g.:
#         'GEOGCS["WGS 84",
#             DATUM["WGS_1984",
#                 SPHEROID["WGS 84",6378137,298.257223563,
#                     AUTHORITY["EPSG","7030"]],
#                 TOWGS84[0,0,0,0,0,0,0],
#                 AUTHORITY["EPSG","6326"]],
#             PRIMEM["Greenwich",0,
#                 AUTHORITY["EPSG","8901"]],
#             UNIT["degree",0.0174532925199433,
#                 AUTHORITY["EPSG","9108"]],
#             AUTHORITY["EPSG","4326"]]'
# 
#     """
# 
#     def __init__(self, srs=0):
#         """Create Spatial Reference System from input parameter"""
#         if sys.version_info.major == 2:
#             str_types = (str, unicode)
#         else:
#             str_types = str
#         # create SRS
#         osr.SpatialReference.__init__(self)
# 
#         # parse input parameters
#         status = 1
#         if srs is 0:
#             # generate default WGS84 SRS
#             status = self.ImportFromEPSG(4326)
#         elif isinstance(srs, str_types):
#             # parse as proj4 string
#             status = self.ImportFromProj4(str(srs))
#             if status > 0:
#                 # parse as WKT string
#                 status = self.ImportFromWkt(str(srs))
#             if status > 0:
#                 raise NansatProjectionError('Proj4 or WKT (%s) is wrong' % srs)
#         elif isinstance(srs, int):
#             # parse as EPSG code
#             status = self.ImportFromEPSG(srs)
#             if status > 0:
#                 raise NansatProjectionError('EPSG %d is wrong' % srs)
#         elif type(srs) in [osr.SpatialReference, NSR]:
#             # parse from input Spatial Reference
#             status = self.ImportFromWkt(srs.ExportToWkt())
#             if status > 0:
#                 raise NansatProjectionError('NSR %s is wrong' % srs)
# 
#     @property
#     def wkt(self):
#         """Well Known Text representation of SRS"""
#         return self.ExportToWkt()


from nansat.utils import gdal, osr
from nansat.nsr import NSR
        """
        self = cls.__new__(cls) # empty object
        self.x_vrt = None
        self.y_vrt = None
        self.data = dataset.GetMetadata('GEOLOCATION')
        return self

    @classmethod
    def from_filenames(cls, x_filename, y_filename, **kwargs):
        """Create geolocation from names of files with geolocation
        Parameters
        ----------
        x_filename : str
            name of file for X-dataset
        y_filename : str
            name of file for Y-dataset
        **kwargs : dict
            parameters for self._init_data()
        """
        self = cls.__new__(cls) # empty object
        self.x_vrt = None
        self.y_vrt = None
        self.data = {}
        self._init_data(x_filename, y_filename, **kwargs)
        return self

    def get_geolocation_grids(self):
        """Read values of geolocation grids"""
        lon_dataset = gdal.Open(self.data['X_DATASET'])
        lon_grid = lon_dataset.GetRasterBand(int(self.data['X_BAND'])).ReadAsArray()

# Path: nansat/utils.py
#     MATPLOTLIB_IS_INSTALLED = False
#     MATPLOTLIB_IS_INSTALLED = True
# NUMPY_TO_GDAL_TYPE_MAP = {
#         'uint8': 1,
#         'int8': 1,
#         'uint16': 2,
#         'int16': 3,
#         'uint32': 4,
#         'int32': 5,
#         'float32': 6,
#         'float64': 7,
#         'complex64': 10,
#         'complex128': 11
#     }
# def remove_keys(dict, keys):
# def register_colormaps():
# def initial_bearing(lon1, lat1, lon2, lat2):
# def haversine(lon1, lat1, lon2, lat2):
# def add_logger(logName='', logLevel=None):
# def get_random_color(c0=None, minDist=100, low=0, high=255):
# def parse_time(time_string):
# 
# Path: nansat/nsr.py
# class NSR(osr.SpatialReference, object):
#     """Nansat Spatial Reference. Overrides constructor of osr.SpatialReference.
# 
#     Parameters
#     ----------
#     srs : 0, PROJ4 or EPSG or WKT or osr.SpatialReference, NSR
#         Specifies spatial reference system (SRS)
#         PROJ4:
#         string with proj4 options [http://trac.osgeo.org/proj/] e.g.:
#         '+proj=latlong +datum=WGS84 +ellps=WGS84 +no_defs'
#         '+proj=stere +datum=WGS84 +ellps=WGS84 +lat_0=75 +lon_0=0 +no_defs'
#         EPSG:
#         integer with EPSG number, [http://spatialreference.org/],
#         e.g. 4326
#         WKT:
#         string with Well Know Text of SRS. E.g.:
#         'GEOGCS["WGS 84",
#             DATUM["WGS_1984",
#                 SPHEROID["WGS 84",6378137,298.257223563,
#                     AUTHORITY["EPSG","7030"]],
#                 TOWGS84[0,0,0,0,0,0,0],
#                 AUTHORITY["EPSG","6326"]],
#             PRIMEM["Greenwich",0,
#                 AUTHORITY["EPSG","8901"]],
#             UNIT["degree",0.0174532925199433,
#                 AUTHORITY["EPSG","9108"]],
#             AUTHORITY["EPSG","4326"]]'
# 
#     """
# 
#     def __init__(self, srs=0):
#         """Create Spatial Reference System from input parameter"""
#         if sys.version_info.major == 2:
#             str_types = (str, unicode)
#         else:
#             str_types = str
#         # create SRS
#         osr.SpatialReference.__init__(self)
# 
#         # parse input parameters
#         status = 1
#         if srs is 0:
#             # generate default WGS84 SRS
#             status = self.ImportFromEPSG(4326)
#         elif isinstance(srs, str_types):
#             # parse as proj4 string
#             status = self.ImportFromProj4(str(srs))
#             if status > 0:
#                 # parse as WKT string
#                 status = self.ImportFromWkt(str(srs))
#             if status > 0:
#                 raise NansatProjectionError('Proj4 or WKT (%s) is wrong' % srs)
#         elif isinstance(srs, int):
#             # parse as EPSG code
#             status = self.ImportFromEPSG(srs)
#             if status > 0:
#                 raise NansatProjectionError('EPSG %d is wrong' % srs)
#         elif type(srs) in [osr.SpatialReference, NSR]:
#             # parse from input Spatial Reference
#             status = self.ImportFromWkt(srs.ExportToWkt())
#             if status > 0:
#                 raise NansatProjectionError('NSR %s is wrong' % srs)
# 
#     @property
#     def wkt(self):
#         """Well Known Text representation of SRS"""
#         return self.ExportToWkt()


# Path: nansat/geolocation.py
from nansat.utils import gdal, osr
from nansat.nsr import NSR

        """
        self = cls.__new__(cls) # empty object
        self.x_vrt = None
        self.y_vrt = None
        self.data = dataset.GetMetadata('GEOLOCATION')
        return self

    @classmethod
    def from_filenames(cls, x_filename, y_filename, **kwargs):
        """Create geolocation from names of files with geolocation
        Parameters
        ----------
        x_filename : str
            name of file for X-dataset
        y_filename : str
            name of file for Y-dataset
        **kwargs : dict
            parameters for self._init_data()
        """
        self = cls.__new__(cls) # empty object
        self.x_vrt = None
        self.y_vrt = None
        self.data = {}
        self._init_data(x_filename, y_filename, **kwargs)
        return self

    def get_geolocation_grids(self):
        """Read values of geolocation grids"""
        lon_dataset = gdal.Open(self.data['X_DATASET'])
        lon_grid = lon_dataset.GetRasterBand(int(self.data['X_BAND'])).ReadAsArray()

        lat_dataset = gdal.Open(self.data['Y_DATASET'])