def create_species_bunch(species_name, train, test, coverages, xgrid, ygrid):
 bunch = Bunch(name=' '.join(species_name.split('_')[:2]))
 species_name = species_name.encode('ascii')
 points = dict(test=test, train=train)
 for (label, pts) in points.items():
  pts = pts[(pts['species'] == species_name)]
  bunch[('pts_%s' % label)] = pts
  ix = np.searchsorted(xgrid, pts['dd long'])
  iy = np.searchsorted(ygrid, pts['dd lat'])
  bunch[('cov_%s' % label)] = coverages[:, (- iy), ix].T
 return bunch

def create_species_bunch ( species_name , train , test , coverages , xgrid , ygrid ) : bunch = Bunch ( name = ' ' . join ( species_name . split ( '_' ) [ : 2 ] ) ) species_name = species_name . encode ( 'ascii' ) points = dict ( test = test , train = train ) for ( label , pts ) in points . items ( ) : pts = pts [ ( pts [ 'species' ] == species_name ) ] bunch [ ( 'pts_%s' % label ) ] = pts ix = np . searchsorted ( xgrid , pts [ 'dd long' ] ) iy = np . searchsorted ( ygrid , pts [ 'dd lat' ] ) bunch [ ( 'cov_%s' % label ) ] = coverages [ : , ( - iy ) , ix ] . T return bunch
create a bunch with information about a particular organism this will use the test/train record arrays to extract the data specific to the given species name .