#NEWLINE# def center_land( world ) : #NEWLINE# #INDENT# 'Translate the map horizontally and vertically to put as much ocean as\n       possible at the borders. It operates on elevation and plates map' #NEWLINE# y_sums = world . layers [ 'elevation' ] . data . sum ( 1 ) #NEWLINE# y_with_min_sum = y_sums . argmin ( ) #NEWLINE# if get_verbose ( ) : #NEWLINE# #INDENT# print ( 'geo.center_land: height complete' ) #NEWLINE# #UNINDENT# x_sums = world . layers [ 'elevation' ] . data . sum ( 0 ) #NEWLINE# x_with_min_sum = x_sums . argmin ( ) #NEWLINE# if get_verbose ( ) : #NEWLINE# #INDENT# print ( 'geo.center_land: width complete' ) #NEWLINE# #UNINDENT# latshift = 0 #NEWLINE# world . layers [ 'elevation' ] . data = numpy . roll ( numpy . roll ( world . layers [ 'elevation' ] . data , ( ( - y_with_min_sum ) + latshift ) , axis = 0 ) , ( - x_sums ) , axis = 1 ) #NEWLINE# world . layers [ 'plates' ] . data = numpy . roll ( numpy . roll ( world . layers [ 'plates' ] . data , ( ( - y_with_min_sum ) + latshift ) , axis = 0 ) , ( - x_with_min_sum ) , axis = 1 ) #NEWLINE# if get_verbose ( ) : #NEWLINE# #INDENT# print ( 'geo.center_land: width complete' )