diff --git a/biomes/draw.py b/biomes/draw.py index 4c74baf..9581a61 100644 --- a/biomes/draw.py +++ b/biomes/draw.py @@ -8,7 +8,7 @@ from constants import BIOMES import pandas as pd import cartopy.crs as ccrs -def draw(df, earth=True, width=23.22, height=13, only_draw=False, path=None): +def draw(df, earth=True, width=23.22, height=13, only_draw=False, path=None, alpha=1): logger.debug('draw(df, %s)', path) biomes = {} biome_numbers = df['biome_num'].unique() @@ -36,6 +36,7 @@ def draw(df, earth=True, width=23.22, height=13, only_draw=False, path=None): patches = [Circle(p, radius=0.4) for p in biomes[n]] collection = PatchCollection(patches, color=color) + collection.set_alpha(alpha) legend_handles.append(Patch(color=color, label=BIOMES[n]['name'])) ax.add_collection(collection) diff --git a/biomes/map_generator.py b/biomes/map_generator.py index 9a99973..dcd5a77 100644 --- a/biomes/map_generator.py +++ b/biomes/map_generator.py @@ -51,7 +51,7 @@ parameters = { 'max': 0 }, 'ground_noise': { - 'default': 1.1e4, + 'default': 6e3, 'type': 'int', 'min': 0, 'max': 1e5, @@ -299,8 +299,6 @@ def generate_map(biomes=False, **kwargs): position = (position[0] + np.random.randint(p['continent_spacing'] * width * 0.8, p['continent_spacing'] * width * 1.2), position[1] + ym * np.random.randint(p['continent_spacing'] * height * 0.8, p['continent_spacing'] * height * 1.2)) - print(position) - ym = ym * -1 random_size = ground_size / continents @@ -319,9 +317,8 @@ def generate_map(biomes=False, **kwargs): ground = ndimage.gaussian_filter(ground, sigma=4) ground = ndimage.generic_filter(ground, constant_filter, size=1) print(np.min(ground), np.max(ground), p['max_elevation']) - print(np.unique(ground)) - print(np.count_nonzero(ground) / ground.size) + print('water proportion', np.count_nonzero(ground) / ground.size) plt.gca().invert_yaxis() plt.imshow(ground.T, cmap=greys, norm=norm) @@ -436,7 +433,6 @@ def predict_end_to_end(input_df, boundary, checkpoint_temp='checkpoints/temp.h5' inputs = inputs.to_numpy() inputs = normalize_ndarray(inputs, inputs_copy) - print(inputs) out_columns = ['temp_{}_{}'.format(season, year) for season in SEASONS] out = Temp.predict(inputs) temp_output = pd.DataFrame(data=denormalize(out, df[out_columns].to_numpy()), columns=out_columns) @@ -449,7 +445,6 @@ def predict_end_to_end(input_df, boundary, checkpoint_temp='checkpoints/temp.h5' inputs = inputs.to_numpy() inputs = normalize_ndarray(inputs, inputs_copy) - print(inputs) out_columns = ['precip_{}_{}'.format(season, year) for season in SEASONS] out = Precip.predict(inputs) @@ -493,15 +488,13 @@ def predict_end_to_end(input_df, boundary, checkpoint_temp='checkpoints/temp.h5' new_data = new_data.append(f) #print(new_data) - draw(new_data, earth=False, only_draw=True, width=p['width'], height=p['height']) + draw(new_data, earth=False, only_draw=True, width=p['width'], height=p['height'], alpha=0.7) # TODO: reduce opacity of biome layer if __name__ == "__main__": # p['width'] = 50 # p['height'] = 50 - p['water_proportion'] = 0.9 - p['continents'] = 3 - p['seed'] = 1 + p['seed'] = 3 generate_map(True) # print(normalize_ndarray(np.array([[ 5.59359803,0.99879546,-90., 45.24], [ 5.54976747, 0.99879546,-86.4, 45.24 ]]))) plt.show()