<jupyter_start><jupyter_text>Import libraries<jupyter_code>import noise
import numpy as np
from scipy.misc import toimage<jupyter_output><empty_output><jupyter_text>Create random distribution<jupyter_code># Define the space attributes
shape = (1024,1024)
scale = 100.0
octaves = 6
persistence = 0.5
lacunarity = 2.0

world = np.zeros(shape) #Creates an array of 0's of the defined shape
for i in range(shape[0]):
    for j in range(shape[0]): #Use perlin with the values created
        world[i][j] = noise.pnoise2(i/scale, j/scale, octaves=octaves, 
                                    persistence=persistence, 
                                    lacunarity=lacunarity, repeatx=1024, 
                                    repeaty=1024, base=0)
toimage(world).show()<jupyter_output>I:\anaconda\lib\site-packages\ipykernel_launcher.py:15: DeprecationWarning: `toimage` is deprecated!
`toimage` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.
Use Pillow's ``Image.fromarray`` directly instead.
  from ipykernel import kernelapp as app<jupyter_text>![Perlin](Perlin.PNG)  Add color<jupyter_code>#Define colors
sea = [65,105,225]
wood = [34,139,34]
beach = [238, 214, 175]

#Create function for adding colour
def add_color(world): # Fill world with a 0's array
    color_world = np.zeros(world.shape+(3,))
    for i in range(shape[0]): #Define the biome depending on the shape
        for j in range(shape[0]):
            if world[i][j] < -0.05:
                color_world[i][j] = sea
            elif world[i][j] < 0:
                color_world[i][j] = beach
            elif world[i][j] < 1.0:
                color_world[i][j] = wood
# The if's conditions should go from smaller to bigger
    return color_world

color_world = add_color(world)
toimage(color_world).show()<jupyter_output>I:\anaconda\lib\site-packages\ipykernel_launcher.py:21: DeprecationWarning: `toimage` is deprecated!
`toimage` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.
Use Pillow's ``Image.fromarray`` directly instead.<jupyter_text>![Colour](Colour.PNG)  Add biome<jupyter_code>blue = [65,105,225]
wood = [34,139,34]
beach = [238, 214, 175]
snow = [255, 250, 250]
mountain = [139, 137, 137]

#Create function for adding colour
def add_color(world): # Fill world with a 0's array
    biome_world = np.zeros(world.shape+(3,))
    for i in range(shape[0]):
        for j in range(shape[0]):
            if world[i][j] < -0.05:
                biome_world[i][j] = blue
            elif world[i][j] < 0:
                biome_world[i][j] = beach
            elif world[i][j] < 0.2:
                biome_world[i][j] = wood
            elif world[i][j] < 0.3:
                biome_world[i][j] = mountain
            elif world[i][j] < 1.0:
                biome_world[i][j] = snow
# The if's conditions should go from smaller to bigger

    return biome_world

biome_world = add_color(world)
toimage(biome_world).show()<jupyter_output>I:\anaconda\lib\site-packages\ipykernel_launcher.py:27: DeprecationWarning: `toimage` is deprecated!
`toimage` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.
Use Pillow's ``Image.fromarray`` directly instead.<jupyter_text>![Biome <3](Biome.PNG)  Make a globe<jupyter_code>#Re-define the shape
a,b = shape[0]/2, shape[1]/2
n = 1024
r = 125
y,x = np.ogrid[-a:n-a, -b:n-b]

# Create a mask using the radius r
mask = x**2+y**2 <= r**2

# Defines black colour and creates an array of zeroes with the same shape as biome_world
black = [0, 0, 0]
island_world = np.zeros_like(biome_world)

# Creates a map in the defined radius
for i in range(shape[0]):
    for j in range(shape[0]):
        if mask[i][j]:
            island_world[i][j] = biome_world[i][j]
        else:
            island_world[i][j] = black
            
toimage(island_world).show()<jupyter_output>I:\anaconda\lib\site-packages\ipykernel_launcher.py:22: DeprecationWarning: `toimage` is deprecated!
`toimage` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.
Use Pillow's ``Image.fromarray`` directly instead.
{'fraction_non_alphanumeric': 0.12735849056603774, 'fraction_numerical': 0.04270109235352532, 'mean_word_length': 3.1578947368421053, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '333969', 'license': 'Apache-1.1', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1410, 'n_words': 371, 'path': 'ProceduralGlobe.ipynb', 'repo_name': 'ZLTM/ProceduralGlobe', 'size': '4028'}