Improving the speed of creation for three Perlin noise maps in Python?

I am interested in learning how I can improve the speed of the code in this pygame file. I itero more than 6400 * 1800 * 3 elements of several matrices numpy here to apply values ​​of noise. The noise library that I am using can be found on GitHub here. All others are self-explanatory noise maps.

I'm calling static variables of a class called `S T` here. `ST.MAP_WIDTH` = 6400 and `ST.MAP_HEIGHT` = 1800

``````of __future__ import division
of singleton import ST
import numpy as np
import noise
import time
import randomly
import mathematics

def __noise (noise_x, noise_y, octaves = 1, persistence = 0.5, lacunarity = 2.0):
""
It generates and returns a noise value.

: param noise_x: The noise value of x
: param noise_y: The noise value of y
: returns: numpy.float32
""

value = noise.pnoise2 (noise_x, noise_y,
octaves, persistence, lacunarity,
random.randint (1, 9999))

returns np.float32 (value)

def __elevation_mapper (noise_x, noise_y):
""
Find and return the elevation noise for the noise_x and
Parameters of noise_y.

: param noise_x: noise_x = x / ST.MAP_WIDTH - scrambler
: param noise_y: noise_y = y / ST.MAP_HEIGHT - scrambler
: return: float
""
return __noise (noise_x, noise_y, 8, 0.9)

def __climate_mapper (and, noise_x, noise_y):
""
Find and return the climate noise for the given noise_x and
Parameters of noise_y.

: param noise_x: noise_x = x / ST.MAP_WIDTH - scrambler
: param noise_y: noise_y = y / ST.MAP_HEIGHT - scrambler
: return: float
""
# find the distance from the bottom of the map and normalize to the range [0, 1]
distance = math.sqrt ((and - (ST.MAP_HEIGHT >> 1)) ** 2) / ST.MAP_HEIGHT

value = __noise (noise_x, noise_y, 8, 0.7)

return (1 + value - distance) / 2

def __rainfall_mapper (noise_x, noise_y):
""
Find and return the rain noise for the noise_x and
Parameters of noise_y.

: param noise_x: noise_x = x / ST.MAP_WIDTH - scrambler
: param noise_y: noise_y = y / ST.MAP_HEIGHT - scrambler
: return: float
""
return __noise (noise_x, noise_y, 4, 0.65, 2.5)

def create_map_arr ():
""
This function creates elevation maps, weather and rain noise,
normalizes them to the rank [0, 1], and then assign them to their
Appropriate attributes in the ST singleton.
""

start = timeit.default_timer ()

elevation_arr = np.zeros ([ST.MAP_HEIGHT, ST.MAP_WIDTH], np.float32)
clim_arr = np.zeros ([ST.MAP_HEIGHT, ST.MAP_WIDTH], np.float32)
rain_arr = np.zeros ([ST.MAP_HEIGHT, ST.MAP_WIDTH], np.float32)

randomizer = random.uniform (0.0001, 0.9999)

# assign noise map values
for and in range (ST.MAP_HEIGHT):
for x in the range (ST.MAP_WIDTH):
noise_x = x / ST.MAP_WIDTH - scrambler
noise_y = y / ST.MAP_HEIGHT - scrambler

elevation_arr[y][x]    = __elevation_mapper (noise_x, noise_y)
climate_arr[y][x]    = __climate_mapper (and, noise_x, noise_y)
rain_arr[y][x]    = __rainfall_mapper (noise_x, noise_y)

# normalize to the range [0, 1] and assign to the relevant ST attributes
ST.ELEVATIONS = (elevation_arr - elevation_arr.min ()) /
(elevation_arr.max () - elevation_arr.min ())

ST.CLIMATES = (Climate_arr - Climate_arr.min ()) /
(Climate_arr.max () - Climate_arr.min ())

ST.RAINFALLS = (Rainier_arr - Rain_arr.min ()) /
(Rainage_arr.max () - Rain_arr.min ())

stop = timeit.default_timer ()
print ("GENERATION TIME:" + str (stop - start))
``````