def find_contours(array, level, fully_connected='low', positive_orientation='low'):
 array = np.asarray(array, dtype=np.double)
 if (array.ndim != 2):
  raise ValueError('Only 2D arrays are supported.')
 level = float(level)
 if ((fully_connected not in _param_options) or (positive_orientation not in _param_options)):
  raise ValueError('Parameters "fully_connected" and "positive_orientation" must be either "high" or "low".')
 point_list = _find_contours_cy.iterate_and_store(array, level, (fully_connected == 'high'))
 contours = _assemble_contours(_take_2(point_list))
 if (positive_orientation == 'high'):
  contours = [c[::(-1)] for c in contours]
 return contours

def find_contours ( array , level , fully_connected = 'low' , positive_orientation = 'low' ) : array = np . asarray ( array , dtype = np . double ) if ( array . ndim != 2 ) : raise ValueError ( 'Only 2D arrays are supported.' ) level = float ( level ) if ( ( fully_connected not in _param_options ) or ( positive_orientation not in _param_options ) ) : raise ValueError ( 'Parameters "fully_connected" and "positive_orientation" must be either "high" or "low".' ) point_list = _find_contours_cy . iterate_and_store ( array , level , ( fully_connected == 'high' ) ) contours = _assemble_contours ( _take_2 ( point_list ) ) if ( positive_orientation == 'high' ) : contours = [ c [ : : ( - 1 ) ] for c in contours ] return contours
find iso-valued contours in a 2d array for a given level value .