def define_kreemer_regionalisation(self, north=90., south=-90., east=180.,
                                       west=-180.):
        '''
        Applies the regionalisation defined according to the regionalisation
        typology of Corne Kreemer
        '''
        '''Applies the regionalisation of Kreemer (2003)
        :param input_file:
            Filename (str) of input file contraining Kreemer regionalisation
        :param north:
            Northern limit (decimal degrees)for consideration (float)
        :param south:
            Southern limit (decimal degrees)for consideration (float)
        :param east:
            Eastern limit (decimal degrees)for consideration (float)
        :param west:
            Western limit (decimal degrees)for consideration (float)
        :returns: List of polygons corresonding to the Kreemer cells.
        '''
        input_data = getlines(self.filename)
        kreemer_polygons = []

        for line_loc, line in enumerate(input_data):
            if '>' in line[0]:
                polygon_dict = {}
                # Get region type (char) and area (m ^ 2) from header
                primary_data = line[2:].rstrip('\n')
                primary_data = primary_data.split(' ', 1)
                polygon_dict['region_type'] = primary_data[0].strip(' ')
                polygon_dict['area'] = float(primary_data[1].strip(' '))
                polygon_dict['cell'] = _build_kreemer_cell(input_data,
                                                           line_loc)
                polygon_dict['long_lims'] = np.array([
                    np.min(polygon_dict['cell'][:, 0]),
                    np.max(polygon_dict['cell'][:, 0])])
                polygon_dict['lat_lims'] = np.array([
                    np.min(polygon_dict['cell'][:, 1]),
                    np.max(polygon_dict['cell'][:, 1])])
                polygon_dict['cell'] = None

                if polygon_dict['long_lims'][0] >= 180.0:
                    polygon_dict['long_lims'] = \
                        polygon_dict['long_lims'] - 360.0
                valid_check = [
                    polygon_dict['long_lims'][0] >= west,
                    polygon_dict['long_lims'][1] <= east,
                    polygon_dict['lat_lims'][0] >= south,
                    polygon_dict['lat_lims'][1] <= north]
                if all(valid_check):
                    kreemer_polygons.append(polygon_dict)

        return kreemer_polygons
def define_kreemer_regionalisation ( self , north = 90. , south = - 90. , east = 180. , west = - 180. ) : input_data = getlines ( self . filename ) kreemer_polygons = [ ] for line_loc , line in enumerate ( input_data ) : if '>' in line [ 0 ] : polygon_dict = { } primary_data = line [ 2 : ] . rstrip ( '\n' ) primary_data = primary_data . split ( ' ' , 1 ) polygon_dict [ 'region_type' ] = primary_data [ 0 ] . strip ( ' ' ) polygon_dict [ 'area' ] = float ( primary_data [ 1 ] . strip ( ' ' ) ) polygon_dict [ 'cell' ] = _build_kreemer_cell ( input_data , line_loc ) polygon_dict [ 'long_lims' ] = np . array ( [ np . min ( polygon_dict [ 'cell' ] [ : , 0 ] ) , np . max ( polygon_dict [ 'cell' ] [ : , 0 ] ) ] ) polygon_dict [ 'lat_lims' ] = np . array ( [ np . min ( polygon_dict [ 'cell' ] [ : , 1 ] ) , np . max ( polygon_dict [ 'cell' ] [ : , 1 ] ) ] ) polygon_dict [ 'cell' ] = None if polygon_dict [ 'long_lims' ] [ 0 ] >= 180.0 : polygon_dict [ 'long_lims' ] = polygon_dict [ 'long_lims' ] - 360.0 valid_check = [ polygon_dict [ 'long_lims' ] [ 0 ] >= west , polygon_dict [ 'long_lims' ] [ 1 ] <= east , polygon_dict [ 'lat_lims' ] [ 0 ] >= south , polygon_dict [ 'lat_lims' ] [ 1 ] <= north ] if all ( valid_check ) : kreemer_polygons . append ( polygon_dict ) return kreemer_polygons
Applies the regionalisation defined according to the regionalisation
        typology of Corne Kreemer