From 29199cbc179973ebbb59ca3b59923771dfb5a4e8 Mon Sep 17 00:00:00 2001 From: tcl Date: Fri, 6 Nov 2015 18:34:46 +0100 Subject: [PATCH 1/8] Added frozen oceans to satellite-map. --- worldengine/draw.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/worldengine/draw.py b/worldengine/draw.py index 81a08f4d..b5bd44eb 100644 --- a/worldengine/draw.py +++ b/worldengine/draw.py @@ -373,6 +373,7 @@ def draw_satellite(world, target): # Get an elevation mask where heights are normalized between 0 and 255 elevation_mask = get_normalized_elevation_array(world) + smooth_mask = numpy.invert(world.ocean) # all land shall be smoothed (other tiles can be included by setting them to True) rng = numpy.random.RandomState(world.seed) # create our own random generator; necessary for now to make the tests reproducible, even though it is a bit ugly @@ -390,11 +391,31 @@ def draw_satellite(world, target): # the map is smoothed and shaded. target.set_pixel(x, y, (r, g, b, 255)) + ## When encountering ocean, check if it is cold enough to freeze + # Check what the temperature threshold of the polar biome is, # TODO: Find out if a desert planet would still freeze or if this value is dynamic + # then freeze all water that is more than diff_freeze_limit colder than that. + # Water that is only diff_freeze_chance colder has a chance to freeze, depending on its exact temperature. + # rand_variation determines the variation in white for the frozen ocean. (very small = close-to-perfect white) + polar_th = world.temperature['thresholds'][0][1] # 'polar', i.e. the coldest biome + diff_freeze_limit = 0.40 # value is arbitrarily-chosen for now + diff_freeze_chance = 0.33 # value is arbitrarily-chosen for now + rand_variation = int(30) # how far from perfect white can the snow stray + for y in range(world.height): + for x in range(world.width): + if world.is_ocean((x, y)): # freeze ocean + ocean_temp = world.temperature_at((x, y)) + if ocean_temp < polar_th and polar_th - ocean_temp > diff_freeze_chance: + chance = numpy.interp(abs(ocean_temp - polar_th), [diff_freeze_chance, diff_freeze_limit], [0.0, 1.0]) + if rng.rand() <= chance: # always freeze for chance = 1.0, never for 0.0 + smooth_mask[y, x] = True # smooth the frozen areas, too + variation = rng.randint(0, rand_variation) + target.set_pixel(x, y, (255 - rand_variation + variation, 255 - rand_variation + variation, 255, 255)) + # Loop through and average a pixel with its neighbors to smooth transitions between biomes for y in range(1, world.height-1): for x in range(1, world.width-1): ## Only smooth land tiles - if world.is_land((x, y)): + if smooth_mask[y, x]: # Lists to hold the separated rgb values of the neighboring pixels all_r = [] all_g = [] @@ -404,7 +425,7 @@ def draw_satellite(world, target): for j in range(y-1, y+2): for i in range(x-1, x+2): # Don't include ocean in the smoothing, if this tile happens to border an ocean - if world.is_land((i, j)): + if smooth_mask[j, i]: # Grab each rgb value and append to the list r, g, b, a = target[j, i] all_r.append(r) From 261459f2b1921b8d3791585805463694581be0a0 Mon Sep 17 00:00:00 2001 From: tcl Date: Fri, 6 Nov 2015 20:01:24 +0100 Subject: [PATCH 2/8] Some changes to produce less "ice-noise". --- worldengine/draw.py | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/worldengine/draw.py b/worldengine/draw.py index b5bd44eb..8a8eb1e6 100644 --- a/worldengine/draw.py +++ b/worldengine/draw.py @@ -397,19 +397,36 @@ def draw_satellite(world, target): # Water that is only diff_freeze_chance colder has a chance to freeze, depending on its exact temperature. # rand_variation determines the variation in white for the frozen ocean. (very small = close-to-perfect white) polar_th = world.temperature['thresholds'][0][1] # 'polar', i.e. the coldest biome - diff_freeze_limit = 0.40 # value is arbitrarily-chosen for now - diff_freeze_chance = 0.33 # value is arbitrarily-chosen for now - rand_variation = int(30) # how far from perfect white can the snow stray - for y in range(world.height): - for x in range(world.width): - if world.is_ocean((x, y)): # freeze ocean - ocean_temp = world.temperature_at((x, y)) - if ocean_temp < polar_th and polar_th - ocean_temp > diff_freeze_chance: - chance = numpy.interp(abs(ocean_temp - polar_th), [diff_freeze_chance, diff_freeze_limit], [0.0, 1.0]) - if rng.rand() <= chance: # always freeze for chance = 1.0, never for 0.0 - smooth_mask[y, x] = True # smooth the frozen areas, too - variation = rng.randint(0, rand_variation) - target.set_pixel(x, y, (255 - rand_variation + variation, 255 - rand_variation + variation, 255, 255)) + coolest_spot = world.temperature['data'].min() + + if coolest_spot < polar_th: # TODO: reformat this trashy code; it's ugly and slow + diff_freeze_limit = (polar_th - coolest_spot) * 0.5 # only the coolest 50% of the oceanic polar-biome will freeze + diff_freeze_chance = diff_freeze_limit * 0.9 # 0.0 < diff_freeze_chance < diff_freeze_limit + rand_variation = int(30) # how far from perfect white can the snow stray (only affects R and G) + surrounding_tile_influence = 0.5 # chance-modifier (added) to freeze a slightly warm tile when all neighbors are frozen + for y in range(world.height): + for x in range(world.width): + if world.is_ocean((x, y)): # freeze ocean + ocean_temp = world.temperature_at((x, y)) + if polar_th - ocean_temp > diff_freeze_chance: + # map difference to [0.0, 1.0] + chance = numpy.interp(polar_th - ocean_temp, [diff_freeze_chance, diff_freeze_limit], [0.0, 1.0]) + + # count number of frozen/solid tiles around this one (there won't be more than four due to the way the iteration works) + surr_view = smooth_mask[max(y-1, 0):min(y+2, world.height), max(x-1, 0):min(x+2, world.width)] + chance_mod = numpy.count_nonzero(surr_view) + + # map amount of tiles to chance-modifier, [-1.0, 1.0] + chance_mod = numpy.interp(chance_mod, [0, 4, 8], [-1.0, 1.0, 1.0]) # range above 4 is only mentioned for clarity/safety, it shouldn't occur + + # modify chance by up to surrounding_tile_influence% + chance += chance_mod * surrounding_tile_influence + + # chance_mod can be in the range [-8 * 0.05, 8 * 0.05] = [-0.4, 0.4] + if rng.rand() <= chance: # always freeze for chance = 1.0, never for 0.0 + smooth_mask[y, x] = True # smooth the frozen areas, too + variation = rng.randint(0, rand_variation) + target.set_pixel(x, y, (255 - rand_variation + variation, 255 - rand_variation + variation, 255, 255)) # Loop through and average a pixel with its neighbors to smooth transitions between biomes for y in range(1, world.height-1): From f1b07b243f5480de833b76dcfc2a77c54811e45f Mon Sep 17 00:00:00 2001 From: tcl Date: Fri, 13 Nov 2015 13:51:57 +0100 Subject: [PATCH 3/8] Put icecap-generation into its own file as part of the simulation. --- generate_protobuf_stubs.sh | 2 - tests/serialization_test.py | 10 ++-- worldengine/draw.py | 43 +++----------- worldengine/generation.py | 5 +- worldengine/simulations/icecap.py | 80 +++++++++++++++++++++++++++ worldengine/simulations/irrigation.py | 4 +- worldengine/world.py | 9 +++ 7 files changed, 108 insertions(+), 45 deletions(-) delete mode 100755 generate_protobuf_stubs.sh create mode 100644 worldengine/simulations/icecap.py diff --git a/generate_protobuf_stubs.sh b/generate_protobuf_stubs.sh deleted file mode 100755 index 5c4240b5..00000000 --- a/generate_protobuf_stubs.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -protoc -I=worldengine --python_out=worldengine/protobuf worldengine/World.proto \ No newline at end of file diff --git a/tests/serialization_test.py b/tests/serialization_test.py index 011f0829..c4f9da46 100644 --- a/tests/serialization_test.py +++ b/tests/serialization_test.py @@ -27,11 +27,12 @@ def test_protobuf_serialize_unserialize(self): self.assertTrue(_equal(w.precipitation, unserialized.precipitation)) self.assertTrue(_equal(w.temperature, unserialized.temperature)) self.assertTrue(_equal(w.sea_depth, unserialized.sea_depth)) - self.assertEquals(w.seed, unserialized.seed) - self.assertEquals(w.n_plates, unserialized.n_plates) self.assertTrue(_equal(w.ocean_level, unserialized.ocean_level)) self.assertTrue(_equal(w.lake_map, unserialized.lake_map)) self.assertTrue(_equal(w.river_map, unserialized.river_map)) + self.assertTrue(_equal(w.icecap, unserialized.icecap)) + self.assertEquals(w.seed, unserialized.seed) + self.assertEquals(w.n_plates, unserialized.n_plates) self.assertEquals(w.step, unserialized.step) self.assertEqual(sorted(dir(w)), sorted(dir(unserialized))) self.assertEqual(w, unserialized) @@ -60,11 +61,12 @@ def test_hdf5_serialize_unserialize(self): self.assertTrue(_equal(w.precipitation, unserialized.precipitation)) self.assertTrue(_equal(w.temperature, unserialized.temperature)) self.assertTrue(_equal(w.sea_depth, unserialized.sea_depth)) - self.assertEquals(w.seed, unserialized.seed) - self.assertEquals(w.n_plates, unserialized.n_plates) self.assertTrue(_equal(w.ocean_level, unserialized.ocean_level)) self.assertTrue(_equal(w.lake_map, unserialized.lake_map)) self.assertTrue(_equal(w.river_map, unserialized.river_map)) + self.assertTrue(_equal(w.icecap, unserialized.icecap)) + self.assertEquals(w.seed, unserialized.seed) + self.assertEquals(w.n_plates, unserialized.n_plates) self.assertEquals(w.step, unserialized.step) self.assertEqual(sorted(dir(w)), sorted(dir(unserialized))) #self.assertEqual(w, unserialized) diff --git a/worldengine/draw.py b/worldengine/draw.py index 8a8eb1e6..3e508d21 100644 --- a/worldengine/draw.py +++ b/worldengine/draw.py @@ -391,42 +391,13 @@ def draw_satellite(world, target): # the map is smoothed and shaded. target.set_pixel(x, y, (r, g, b, 255)) - ## When encountering ocean, check if it is cold enough to freeze - # Check what the temperature threshold of the polar biome is, # TODO: Find out if a desert planet would still freeze or if this value is dynamic - # then freeze all water that is more than diff_freeze_limit colder than that. - # Water that is only diff_freeze_chance colder has a chance to freeze, depending on its exact temperature. - # rand_variation determines the variation in white for the frozen ocean. (very small = close-to-perfect white) - polar_th = world.temperature['thresholds'][0][1] # 'polar', i.e. the coldest biome - coolest_spot = world.temperature['data'].min() - - if coolest_spot < polar_th: # TODO: reformat this trashy code; it's ugly and slow - diff_freeze_limit = (polar_th - coolest_spot) * 0.5 # only the coolest 50% of the oceanic polar-biome will freeze - diff_freeze_chance = diff_freeze_limit * 0.9 # 0.0 < diff_freeze_chance < diff_freeze_limit - rand_variation = int(30) # how far from perfect white can the snow stray (only affects R and G) - surrounding_tile_influence = 0.5 # chance-modifier (added) to freeze a slightly warm tile when all neighbors are frozen - for y in range(world.height): - for x in range(world.width): - if world.is_ocean((x, y)): # freeze ocean - ocean_temp = world.temperature_at((x, y)) - if polar_th - ocean_temp > diff_freeze_chance: - # map difference to [0.0, 1.0] - chance = numpy.interp(polar_th - ocean_temp, [diff_freeze_chance, diff_freeze_limit], [0.0, 1.0]) - - # count number of frozen/solid tiles around this one (there won't be more than four due to the way the iteration works) - surr_view = smooth_mask[max(y-1, 0):min(y+2, world.height), max(x-1, 0):min(x+2, world.width)] - chance_mod = numpy.count_nonzero(surr_view) - - # map amount of tiles to chance-modifier, [-1.0, 1.0] - chance_mod = numpy.interp(chance_mod, [0, 4, 8], [-1.0, 1.0, 1.0]) # range above 4 is only mentioned for clarity/safety, it shouldn't occur - - # modify chance by up to surrounding_tile_influence% - chance += chance_mod * surrounding_tile_influence - - # chance_mod can be in the range [-8 * 0.05, 8 * 0.05] = [-0.4, 0.4] - if rng.rand() <= chance: # always freeze for chance = 1.0, never for 0.0 - smooth_mask[y, x] = True # smooth the frozen areas, too - variation = rng.randint(0, rand_variation) - target.set_pixel(x, y, (255 - rand_variation + variation, 255 - rand_variation + variation, 255, 255)) + # Paint frozen areas. + for y in range(world.height): + for x in range(world.width): + if world.icecap[y, x] > 0.0: + smooth_mask[y, x] = True # smooth the frozen areas, too + variation = rng.randint(0, ice_color_variation) + target.set_pixel(x, y, (255 - ice_color_variation + variation, 255 - ice_color_variation + variation, 255, 255)) # Loop through and average a pixel with its neighbors to smooth transitions between biomes for y in range(1, world.height-1): diff --git a/worldengine/generation.py b/worldengine/generation.py index e4e244f6..b4a3f71f 100644 --- a/worldengine/generation.py +++ b/worldengine/generation.py @@ -9,6 +9,7 @@ from worldengine.simulations.erosion import ErosionSimulation from worldengine.simulations.precipitation import PrecipitationSimulation from worldengine.simulations.biome import BiomeSimulation +from worldengine.simulations.icecap import IcecapSimulation from worldengine.common import anti_alias, get_verbose import numpy @@ -210,6 +211,7 @@ def generate_world(w, step): 'HumiditySimulation': sub_seeds[ 5], 'PermeabilitySimulation': sub_seeds[ 6], 'BiomeSimulation': sub_seeds[ 7], + 'IcecapSimulation': sub_seeds[ 8], '': sub_seeds[99] } @@ -229,7 +231,6 @@ def generate_world(w, step): IrrigationSimulation().execute(w, seed_dict['IrrigationSimulation']) # seed not currently used HumiditySimulation().execute(w, seed_dict['HumiditySimulation']) # seed not currently used - PermeabilitySimulation().execute(w, seed_dict['PermeabilitySimulation']) cm, biome_cm = BiomeSimulation().execute(w, seed_dict['BiomeSimulation']) # seed not currently used @@ -247,4 +248,6 @@ def generate_world(w, step): if get_verbose(): print(" %30s = %7i" % (str(cl), count)) + IcecapSimulation().execute(w, seed_dict['IcecapSimulation']) # makes use of temperature-map + return w diff --git a/worldengine/simulations/icecap.py b/worldengine/simulations/icecap.py new file mode 100644 index 00000000..a866ccb1 --- /dev/null +++ b/worldengine/simulations/icecap.py @@ -0,0 +1,80 @@ +import numpy + + +class IcecapSimulation(object): + # This class creates an "ice-map", i.e. a numpy array with positive values that describe the thickness of the ice at + # a certain spot of the world. + # Ice can appear wherever there is an ocean and the temperature is cold enough. + + # TODO: Find out if a desert planet could still freeze or if the freeze-threshold is dynamic. + # TODO: Freeze rivers etc. + + @staticmethod + def is_applicable(world): + return world.has_ocean() and world.has_temperature() + + def execute(self, world, seed): + world.icecap = self._calculate(world, seed) + print("icecap written!!!!!!!!") + print(hasattr(world, 'icecap')) + + @staticmethod + def _calculate(world, seed): + # Notes on performance: + # -method is run once per generation + # -iterations : width * height + # -memory consumption: width * height * sizeof(numpy.float) (permanent) + # width * height * sizeof(numpy.bool) (temporary) + + # constants for convenience (or performance) + ocean = world.ocean + temperature = world.temperature['data'] + + # primary constants (could be used as global variables at some point); all values should be in [0, 1] + max_freeze_percentage = 0.50 # only the coldest x% of the cold area will freeze (0 = no ice, 1 = all ice) + freeze_chance_window = 0.10 # the warmest x% of freezable area won't completely freeze (RNG decides) + surrounding_tile_influence = 0.5 # chance-modifier to freeze a slightly warm tile when neighbors are frozen + + # secondary constants + temp_min = temperature.min() # coldest spot in the world + freeze_threshold = world.temperature['thresholds'][0][1] # upper temperature-limit for freezing effects + # Cold biomes: + # polar: self.temperature['thresholds'][0][1] + # alpine: self.temperature['thresholds'][1][1] + # boreal: self.temperature['thresholds'][2][1] + + # derived constants + freeze_threshold = (freeze_threshold - temp_min) * max_freeze_percentage # calculate freeze threshold above min + freeze_chance_threshold = freeze_threshold * (1.0 - freeze_chance_window) + + # local variables + icecap = numpy.zeros((world.height, world.width), dtype=float) + rng = numpy.random.RandomState(seed) # create our own random generator + + # map that is True whenever there is land or (certain) ice around + solid_map = numpy.logical_or(temperature <= freeze_chance_threshold + temp_min, numpy.logical_not(ocean)) + + for y in range(world.height): + for x in range(world.width): + if ocean[y, x]: # or world.river_map[y, x] > 0 or world.lake_map[y, x] > 0 or world.watermap['data'][y, x] > 0: + t = temperature[y, x] + if t - temp_min < freeze_threshold: + # map temperature to freeze-chance (linear interpolation) + chance = numpy.interp(t, [temp_min, freeze_chance_threshold, freeze_threshold], [1.0, 1.0, 0.0]) + # *will* freeze for temp_min <= t <= freeze_chance_threshold + # *can* freeze for freeze_chance_threshold < t < freeze_threshold + + # count number of frozen/solid tiles around this one + surr_tiles = solid_map[max(y-1, 0):min(y+2, world.height), max(x-1, 0):min(x+2, world.width)] + chance_mod = numpy.count_nonzero(surr_tiles) + chance_mod -= 1 if solid_map[y, x] else 0 # remove center-tile (i.e. the current tile) + + # map amount of tiles to chance-modifier, [-1.0, 1.0] + chance_mod = numpy.interp(chance_mod, [0, 4, 8], [-1.0, 0.0, 1.0]) # 0 to 8 tiles are frozen + chance += chance_mod * surrounding_tile_influence + + if rng.rand() <= chance: # always freeze for chance >= 1.0, never for <= 0.0 + solid_map[y, x] = True # mark tile as frozen + icecap[y, x] = freeze_threshold - (t - temp_min) # thickness of the ice (arbitrary scale) + + return icecap diff --git a/worldengine/simulations/irrigation.py b/worldengine/simulations/irrigation.py index 5a588920..332387a7 100644 --- a/worldengine/simulations/irrigation.py +++ b/worldengine/simulations/irrigation.py @@ -10,10 +10,10 @@ def execute(self, world, seed): @staticmethod def _calculate(world): - #Notes on performance: + # Notes on performance: # -method is run once per generation # -iterations : width * height - # -memory consumption: width * height * 8 Byte (numpy 1.9.2) + # -memory consumption: width * height * sizeof(numpy.float) (permanent) width = world.width height = world.height diff --git a/worldengine/world.py b/worldengine/world.py index 5eb006b0..d9d86559 100644 --- a/worldengine/world.py +++ b/worldengine/world.py @@ -224,6 +224,9 @@ def _to_protobuf_world(self): p_world.temperature_subtropical = \ self.temperature['thresholds'][5][1] + if hasattr(self, 'icecap'): + self._to_protobuf_matrix(self.icecap, p_world.icecap) + return p_world @classmethod @@ -313,6 +316,9 @@ def _from_protobuf_world(cls, p_world): m = numpy.array(World._from_protobuf_matrix(p_world.rivermap)) w.set_rivermap(m) + if len(p_world.icecap.rows) > 0: + w.icecap = numpy.array(World._from_protobuf_matrix(p_world.icecap)) + return w # @@ -856,6 +862,9 @@ def set_permeability(self, data, thresholds): self.permeability = {'data': data, 'thresholds': thresholds} + def has_ocean(self): + return hasattr(self, 'ocean') + def has_precipitations(self): return hasattr(self, 'precipitation') From d16564236f9e5dc0c1491906d18bb165a33dd297 Mon Sep 17 00:00:00 2001 From: tcl Date: Fri, 13 Nov 2015 13:58:40 +0100 Subject: [PATCH 4/8] Updated protobuf to include the ice-cap map. --- worldengine/World.proto | 10 +- worldengine/protobuf/World_pb2.py | 222 ++++++++++++------------------ 2 files changed, 97 insertions(+), 135 deletions(-) diff --git a/worldengine/World.proto b/worldengine/World.proto index 6f32d61d..a118f3ee 100644 --- a/worldengine/World.proto +++ b/worldengine/World.proto @@ -1,3 +1,4 @@ +syntax = "proto2"; package World; message World { @@ -103,13 +104,16 @@ message World { optional double temperature_warm = 31; optional double temperature_subtropical = 32; + // Ice-caps + optional DoubleMatrix icecap = 33; + // Data about generation: // introduced in v0.5.3 // this is optional for backward compatibility reasons - optional GenerationData generationData = 33; + optional GenerationData generationData = 34; - optional DoubleMatrix lakemap = 34; - optional DoubleMatrix rivermap = 35; + optional DoubleMatrix lakemap = 35; + optional DoubleMatrix rivermap = 36; } diff --git a/worldengine/protobuf/World_pb2.py b/worldengine/protobuf/World_pb2.py index ee626830..ca8a36c6 100644 --- a/worldengine/protobuf/World_pb2.py +++ b/worldengine/protobuf/World_pb2.py @@ -1,26 +1,19 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: World.proto -import sys -_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -# from google.protobuf import descriptor_pb2 +from google.protobuf import descriptor_pb2 # @@protoc_insertion_point(imports) -_sym_db = _symbol_database.Default() - DESCRIPTOR = _descriptor.FileDescriptor( name='World.proto', package='World', - serialized_pb=_b('\n\x0bWorld.proto\x12\x05World\"\xcb\r\n\x05World\x12\x17\n\x0fworldengine_tag\x18\x01 \x02(\x05\x12\x1b\n\x13worldengine_version\x18\x02 \x02(\x05\x12\x0c\n\x04name\x18\x03 \x02(\t\x12\r\n\x05width\x18\x04 \x02(\x05\x12\x0e\n\x06height\x18\x05 \x02(\x05\x12\x30\n\rheightMapData\x18\x06 \x02(\x0b\x32\x19.World.World.DoubleMatrix\x12\x17\n\x0fheightMapTh_sea\x18\x07 \x02(\x01\x12\x19\n\x11heightMapTh_plain\x18\x08 \x02(\x01\x12\x18\n\x10heightMapTh_hill\x18\t \x02(\x01\x12*\n\x06plates\x18\n \x02(\x0b\x32\x1a.World.World.IntegerMatrix\x12)\n\x05ocean\x18\x0b \x02(\x0b\x32\x1a.World.World.BooleanMatrix\x12,\n\tsea_depth\x18\x0c \x02(\x0b\x32\x19.World.World.DoubleMatrix\x12)\n\x05\x62iome\x18\r \x01(\x0b\x32\x1a.World.World.IntegerMatrix\x12\x38\n\x08humidity\x18\x0e \x01(\x0b\x32&.World.World.DoubleMatrixWithQuantiles\x12-\n\nirrigation\x18\x0f \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x33\n\x10permeabilityData\x18\x10 \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x18\n\x10permeability_low\x18\x11 \x01(\x01\x12\x18\n\x10permeability_med\x18\x12 \x01(\x01\x12/\n\x0cwatermapData\x18\x13 \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x16\n\x0ewatermap_creek\x18\x14 \x01(\x01\x12\x16\n\x0ewatermap_river\x18\x15 \x01(\x01\x12\x1a\n\x12watermap_mainriver\x18\x16 \x01(\x01\x12\x34\n\x11precipitationData\x18\x17 \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x19\n\x11precipitation_low\x18\x18 \x01(\x01\x12\x19\n\x11precipitation_med\x18\x19 \x01(\x01\x12\x32\n\x0ftemperatureData\x18\x1a \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x19\n\x11temperature_polar\x18\x1b \x01(\x01\x12\x1a\n\x12temperature_alpine\x18\x1c \x01(\x01\x12\x1a\n\x12temperature_boreal\x18\x1d \x01(\x01\x12\x18\n\x10temperature_cool\x18\x1e \x01(\x01\x12\x18\n\x10temperature_warm\x18\x1f \x01(\x01\x12\x1f\n\x17temperature_subtropical\x18 \x01(\x01\x12\x33\n\x0egenerationData\x18! \x01(\x0b\x32\x1b.World.World.GenerationData\x12*\n\x07lakemap\x18\" \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12+\n\x08rivermap\x18# \x01(\x0b\x32\x19.World.World.DoubleMatrix\x1a\x1a\n\tDoubleRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x01\x1a\x1b\n\nBooleanRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x08\x1a\x1b\n\nIntegerRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x05\x1a\x18\n\x07\x42yteRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x05\x1a\x34\n\x0c\x44oubleMatrix\x12$\n\x04rows\x18\x01 \x03(\x0b\x32\x16.World.World.DoubleRow\x1a\x36\n\rBooleanMatrix\x12%\n\x04rows\x18\x01 \x03(\x0b\x32\x17.World.World.BooleanRow\x1a\x36\n\rIntegerMatrix\x12%\n\x04rows\x18\x01 \x03(\x0b\x32\x17.World.World.IntegerRow\x1a,\n\x0e\x44oubleQuantile\x12\x0b\n\x03key\x18\x01 \x02(\x05\x12\r\n\x05value\x18\x02 \x02(\x01\x1aq\n\x19\x44oubleMatrixWithQuantiles\x12.\n\tquantiles\x18\x01 \x03(\x0b\x32\x1b.World.World.DoubleQuantile\x12$\n\x04rows\x18\x02 \x03(\x0b\x32\x16.World.World.DoubleRow\x1aS\n\x0eGenerationData\x12\x0c\n\x04seed\x18\x01 \x01(\x05\x12\x10\n\x08n_plates\x18\x02 \x01(\x05\x12\x13\n\x0bocean_level\x18\x03 \x01(\x02\x12\x0c\n\x04step\x18\x04 \x01(\t') -) -_sym_db.RegisterFileDescriptor(DESCRIPTOR) + serialized_pb='\n\x0bWorld.proto\x12\x05World\"\xf6\r\n\x05World\x12\x17\n\x0fworldengine_tag\x18\x01 \x02(\x05\x12\x1b\n\x13worldengine_version\x18\x02 \x02(\x05\x12\x0c\n\x04name\x18\x03 \x02(\t\x12\r\n\x05width\x18\x04 \x02(\x05\x12\x0e\n\x06height\x18\x05 \x02(\x05\x12\x30\n\rheightMapData\x18\x06 \x02(\x0b\x32\x19.World.World.DoubleMatrix\x12\x17\n\x0fheightMapTh_sea\x18\x07 \x02(\x01\x12\x19\n\x11heightMapTh_plain\x18\x08 \x02(\x01\x12\x18\n\x10heightMapTh_hill\x18\t \x02(\x01\x12*\n\x06plates\x18\n \x02(\x0b\x32\x1a.World.World.IntegerMatrix\x12)\n\x05ocean\x18\x0b \x02(\x0b\x32\x1a.World.World.BooleanMatrix\x12,\n\tsea_depth\x18\x0c \x02(\x0b\x32\x19.World.World.DoubleMatrix\x12)\n\x05\x62iome\x18\r \x01(\x0b\x32\x1a.World.World.IntegerMatrix\x12\x38\n\x08humidity\x18\x0e \x01(\x0b\x32&.World.World.DoubleMatrixWithQuantiles\x12-\n\nirrigation\x18\x0f \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x33\n\x10permeabilityData\x18\x10 \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x18\n\x10permeability_low\x18\x11 \x01(\x01\x12\x18\n\x10permeability_med\x18\x12 \x01(\x01\x12/\n\x0cwatermapData\x18\x13 \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x16\n\x0ewatermap_creek\x18\x14 \x01(\x01\x12\x16\n\x0ewatermap_river\x18\x15 \x01(\x01\x12\x1a\n\x12watermap_mainriver\x18\x16 \x01(\x01\x12\x34\n\x11precipitationData\x18\x17 \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x19\n\x11precipitation_low\x18\x18 \x01(\x01\x12\x19\n\x11precipitation_med\x18\x19 \x01(\x01\x12\x32\n\x0ftemperatureData\x18\x1a \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x19\n\x11temperature_polar\x18\x1b \x01(\x01\x12\x1a\n\x12temperature_alpine\x18\x1c \x01(\x01\x12\x1a\n\x12temperature_boreal\x18\x1d \x01(\x01\x12\x18\n\x10temperature_cool\x18\x1e \x01(\x01\x12\x18\n\x10temperature_warm\x18\x1f \x01(\x01\x12\x1f\n\x17temperature_subtropical\x18 \x01(\x01\x12)\n\x06icecap\x18! \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x33\n\x0egenerationData\x18\" \x01(\x0b\x32\x1b.World.World.GenerationData\x12*\n\x07lakemap\x18# \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12+\n\x08rivermap\x18$ \x01(\x0b\x32\x19.World.World.DoubleMatrix\x1a\x1a\n\tDoubleRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x01\x1a\x1b\n\nBooleanRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x08\x1a\x1b\n\nIntegerRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x05\x1a\x18\n\x07\x42yteRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x05\x1a\x34\n\x0c\x44oubleMatrix\x12$\n\x04rows\x18\x01 \x03(\x0b\x32\x16.World.World.DoubleRow\x1a\x36\n\rBooleanMatrix\x12%\n\x04rows\x18\x01 \x03(\x0b\x32\x17.World.World.BooleanRow\x1a\x36\n\rIntegerMatrix\x12%\n\x04rows\x18\x01 \x03(\x0b\x32\x17.World.World.IntegerRow\x1a,\n\x0e\x44oubleQuantile\x12\x0b\n\x03key\x18\x01 \x02(\x05\x12\r\n\x05value\x18\x02 \x02(\x01\x1aq\n\x19\x44oubleMatrixWithQuantiles\x12.\n\tquantiles\x18\x01 \x03(\x0b\x32\x1b.World.World.DoubleQuantile\x12$\n\x04rows\x18\x02 \x03(\x0b\x32\x16.World.World.DoubleRow\x1aS\n\x0eGenerationData\x12\x0c\n\x04seed\x18\x01 \x01(\x05\x12\x10\n\x08n_plates\x18\x02 \x01(\x05\x12\x13\n\x0bocean_level\x18\x03 \x01(\x02\x12\x0c\n\x04step\x18\x04 \x01(\t') @@ -48,10 +41,8 @@ options=None, is_extendable=False, extension_ranges=[], - oneofs=[ - ], - serialized_start=1240, - serialized_end=1266, + serialized_start=1283, + serialized_end=1309, ) _WORLD_BOOLEANROW = _descriptor.Descriptor( @@ -77,10 +68,8 @@ options=None, is_extendable=False, extension_ranges=[], - oneofs=[ - ], - serialized_start=1268, - serialized_end=1295, + serialized_start=1311, + serialized_end=1338, ) _WORLD_INTEGERROW = _descriptor.Descriptor( @@ -106,10 +95,8 @@ options=None, is_extendable=False, extension_ranges=[], - oneofs=[ - ], - serialized_start=1297, - serialized_end=1324, + serialized_start=1340, + serialized_end=1367, ) _WORLD_BYTEROW = _descriptor.Descriptor( @@ -135,10 +122,8 @@ options=None, is_extendable=False, extension_ranges=[], - oneofs=[ - ], - serialized_start=1326, - serialized_end=1350, + serialized_start=1369, + serialized_end=1393, ) _WORLD_DOUBLEMATRIX = _descriptor.Descriptor( @@ -164,10 +149,8 @@ options=None, is_extendable=False, extension_ranges=[], - oneofs=[ - ], - serialized_start=1352, - serialized_end=1404, + serialized_start=1395, + serialized_end=1447, ) _WORLD_BOOLEANMATRIX = _descriptor.Descriptor( @@ -193,10 +176,8 @@ options=None, is_extendable=False, extension_ranges=[], - oneofs=[ - ], - serialized_start=1406, - serialized_end=1460, + serialized_start=1449, + serialized_end=1503, ) _WORLD_INTEGERMATRIX = _descriptor.Descriptor( @@ -222,10 +203,8 @@ options=None, is_extendable=False, extension_ranges=[], - oneofs=[ - ], - serialized_start=1462, - serialized_end=1516, + serialized_start=1505, + serialized_end=1559, ) _WORLD_DOUBLEQUANTILE = _descriptor.Descriptor( @@ -258,10 +237,8 @@ options=None, is_extendable=False, extension_ranges=[], - oneofs=[ - ], - serialized_start=1518, - serialized_end=1562, + serialized_start=1561, + serialized_end=1605, ) _WORLD_DOUBLEMATRIXWITHQUANTILES = _descriptor.Descriptor( @@ -294,10 +271,8 @@ options=None, is_extendable=False, extension_ranges=[], - oneofs=[ - ], - serialized_start=1564, - serialized_end=1677, + serialized_start=1607, + serialized_end=1720, ) _WORLD_GENERATIONDATA = _descriptor.Descriptor( @@ -331,7 +306,7 @@ _descriptor.FieldDescriptor( name='step', full_name='World.World.GenerationData.step', index=3, number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), + has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -344,10 +319,8 @@ options=None, is_extendable=False, extension_ranges=[], - oneofs=[ - ], - serialized_start=1679, - serialized_end=1762, + serialized_start=1722, + serialized_end=1805, ) _WORLD = _descriptor.Descriptor( @@ -374,7 +347,7 @@ _descriptor.FieldDescriptor( name='name', full_name='World.World.name', index=2, number=3, type=9, cpp_type=9, label=2, - has_default_value=False, default_value=_b("").decode('utf-8'), + has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -582,26 +555,33 @@ is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='generationData', full_name='World.World.generationData', index=32, + name='icecap', full_name='World.World.icecap', index=32, number=33, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='lakemap', full_name='World.World.lakemap', index=33, + name='generationData', full_name='World.World.generationData', index=33, number=34, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='rivermap', full_name='World.World.rivermap', index=34, + name='lakemap', full_name='World.World.lakemap', index=34, number=35, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), + _descriptor.FieldDescriptor( + name='rivermap', full_name='World.World.rivermap', index=35, + number=36, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), ], extensions=[ ], @@ -611,27 +591,25 @@ options=None, is_extendable=False, extension_ranges=[], - oneofs=[ - ], serialized_start=23, - serialized_end=1762, + serialized_end=1805, ) -_WORLD_DOUBLEROW.containing_type = _WORLD -_WORLD_BOOLEANROW.containing_type = _WORLD -_WORLD_INTEGERROW.containing_type = _WORLD -_WORLD_BYTEROW.containing_type = _WORLD +_WORLD_DOUBLEROW.containing_type = _WORLD; +_WORLD_BOOLEANROW.containing_type = _WORLD; +_WORLD_INTEGERROW.containing_type = _WORLD; +_WORLD_BYTEROW.containing_type = _WORLD; _WORLD_DOUBLEMATRIX.fields_by_name['rows'].message_type = _WORLD_DOUBLEROW -_WORLD_DOUBLEMATRIX.containing_type = _WORLD +_WORLD_DOUBLEMATRIX.containing_type = _WORLD; _WORLD_BOOLEANMATRIX.fields_by_name['rows'].message_type = _WORLD_BOOLEANROW -_WORLD_BOOLEANMATRIX.containing_type = _WORLD +_WORLD_BOOLEANMATRIX.containing_type = _WORLD; _WORLD_INTEGERMATRIX.fields_by_name['rows'].message_type = _WORLD_INTEGERROW -_WORLD_INTEGERMATRIX.containing_type = _WORLD -_WORLD_DOUBLEQUANTILE.containing_type = _WORLD +_WORLD_INTEGERMATRIX.containing_type = _WORLD; +_WORLD_DOUBLEQUANTILE.containing_type = _WORLD; _WORLD_DOUBLEMATRIXWITHQUANTILES.fields_by_name['quantiles'].message_type = _WORLD_DOUBLEQUANTILE _WORLD_DOUBLEMATRIXWITHQUANTILES.fields_by_name['rows'].message_type = _WORLD_DOUBLEROW -_WORLD_DOUBLEMATRIXWITHQUANTILES.containing_type = _WORLD -_WORLD_GENERATIONDATA.containing_type = _WORLD +_WORLD_DOUBLEMATRIXWITHQUANTILES.containing_type = _WORLD; +_WORLD_GENERATIONDATA.containing_type = _WORLD; _WORLD.fields_by_name['heightMapData'].message_type = _WORLD_DOUBLEMATRIX _WORLD.fields_by_name['plates'].message_type = _WORLD_INTEGERMATRIX _WORLD.fields_by_name['ocean'].message_type = _WORLD_BOOLEANMATRIX @@ -643,97 +621,77 @@ _WORLD.fields_by_name['watermapData'].message_type = _WORLD_DOUBLEMATRIX _WORLD.fields_by_name['precipitationData'].message_type = _WORLD_DOUBLEMATRIX _WORLD.fields_by_name['temperatureData'].message_type = _WORLD_DOUBLEMATRIX +_WORLD.fields_by_name['icecap'].message_type = _WORLD_DOUBLEMATRIX _WORLD.fields_by_name['generationData'].message_type = _WORLD_GENERATIONDATA _WORLD.fields_by_name['lakemap'].message_type = _WORLD_DOUBLEMATRIX _WORLD.fields_by_name['rivermap'].message_type = _WORLD_DOUBLEMATRIX DESCRIPTOR.message_types_by_name['World'] = _WORLD -World = _reflection.GeneratedProtocolMessageType('World', (_message.Message,), dict( +class World(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + + class DoubleRow(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _WORLD_DOUBLEROW - DoubleRow = _reflection.GeneratedProtocolMessageType('DoubleRow', (_message.Message,), dict( - DESCRIPTOR = _WORLD_DOUBLEROW, - __module__ = 'World_pb2' # @@protoc_insertion_point(class_scope:World.World.DoubleRow) - )) - , - BooleanRow = _reflection.GeneratedProtocolMessageType('BooleanRow', (_message.Message,), dict( - DESCRIPTOR = _WORLD_BOOLEANROW, - __module__ = 'World_pb2' + class BooleanRow(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _WORLD_BOOLEANROW + # @@protoc_insertion_point(class_scope:World.World.BooleanRow) - )) - , - IntegerRow = _reflection.GeneratedProtocolMessageType('IntegerRow', (_message.Message,), dict( - DESCRIPTOR = _WORLD_INTEGERROW, - __module__ = 'World_pb2' + class IntegerRow(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _WORLD_INTEGERROW + # @@protoc_insertion_point(class_scope:World.World.IntegerRow) - )) - , - ByteRow = _reflection.GeneratedProtocolMessageType('ByteRow', (_message.Message,), dict( - DESCRIPTOR = _WORLD_BYTEROW, - __module__ = 'World_pb2' + class ByteRow(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _WORLD_BYTEROW + # @@protoc_insertion_point(class_scope:World.World.ByteRow) - )) - , - DoubleMatrix = _reflection.GeneratedProtocolMessageType('DoubleMatrix', (_message.Message,), dict( - DESCRIPTOR = _WORLD_DOUBLEMATRIX, - __module__ = 'World_pb2' + class DoubleMatrix(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _WORLD_DOUBLEMATRIX + # @@protoc_insertion_point(class_scope:World.World.DoubleMatrix) - )) - , - BooleanMatrix = _reflection.GeneratedProtocolMessageType('BooleanMatrix', (_message.Message,), dict( - DESCRIPTOR = _WORLD_BOOLEANMATRIX, - __module__ = 'World_pb2' + class BooleanMatrix(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _WORLD_BOOLEANMATRIX + # @@protoc_insertion_point(class_scope:World.World.BooleanMatrix) - )) - , - IntegerMatrix = _reflection.GeneratedProtocolMessageType('IntegerMatrix', (_message.Message,), dict( - DESCRIPTOR = _WORLD_INTEGERMATRIX, - __module__ = 'World_pb2' + class IntegerMatrix(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _WORLD_INTEGERMATRIX + # @@protoc_insertion_point(class_scope:World.World.IntegerMatrix) - )) - , - DoubleQuantile = _reflection.GeneratedProtocolMessageType('DoubleQuantile', (_message.Message,), dict( - DESCRIPTOR = _WORLD_DOUBLEQUANTILE, - __module__ = 'World_pb2' + class DoubleQuantile(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _WORLD_DOUBLEQUANTILE + # @@protoc_insertion_point(class_scope:World.World.DoubleQuantile) - )) - , - DoubleMatrixWithQuantiles = _reflection.GeneratedProtocolMessageType('DoubleMatrixWithQuantiles', (_message.Message,), dict( - DESCRIPTOR = _WORLD_DOUBLEMATRIXWITHQUANTILES, - __module__ = 'World_pb2' + class DoubleMatrixWithQuantiles(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _WORLD_DOUBLEMATRIXWITHQUANTILES + # @@protoc_insertion_point(class_scope:World.World.DoubleMatrixWithQuantiles) - )) - , - GenerationData = _reflection.GeneratedProtocolMessageType('GenerationData', (_message.Message,), dict( - DESCRIPTOR = _WORLD_GENERATIONDATA, - __module__ = 'World_pb2' + class GenerationData(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _WORLD_GENERATIONDATA + # @@protoc_insertion_point(class_scope:World.World.GenerationData) - )) - , - DESCRIPTOR = _WORLD, - __module__ = 'World_pb2' + DESCRIPTOR = _WORLD + # @@protoc_insertion_point(class_scope:World.World) - )) -_sym_db.RegisterMessage(World) -_sym_db.RegisterMessage(World.DoubleRow) -_sym_db.RegisterMessage(World.BooleanRow) -_sym_db.RegisterMessage(World.IntegerRow) -_sym_db.RegisterMessage(World.ByteRow) -_sym_db.RegisterMessage(World.DoubleMatrix) -_sym_db.RegisterMessage(World.BooleanMatrix) -_sym_db.RegisterMessage(World.IntegerMatrix) -_sym_db.RegisterMessage(World.DoubleQuantile) -_sym_db.RegisterMessage(World.DoubleMatrixWithQuantiles) -_sym_db.RegisterMessage(World.GenerationData) # @@protoc_insertion_point(module_scope) From b0dd692d00496eda1a9417cd9c0c9ebcea713372 Mon Sep 17 00:00:00 2001 From: tcl Date: Fri, 13 Nov 2015 14:39:28 +0100 Subject: [PATCH 5/8] Finished icecap generation and added option to write out an ice map. --- worldengine/cli/main.py | 16 +++++++++++++--- worldengine/draw.py | 6 ++++++ worldengine/simulations/icecap.py | 23 +++++++++++------------ 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/worldengine/cli/main.py b/worldengine/cli/main.py index 5a27c08e..41ea3671 100644 --- a/worldengine/cli/main.py +++ b/worldengine/cli/main.py @@ -6,7 +6,8 @@ from worldengine.common import array_to_matrix, set_verbose, print_verbose from worldengine.draw import draw_ancientmap_on_file, draw_biome_on_file, draw_ocean_on_file, \ draw_precipitation_on_file, draw_grayscale_heightmap_on_file, draw_simple_elevation_on_file, \ - draw_temperature_levels_on_file, draw_riversmap_on_file, draw_scatter_plot_on_file, draw_satellite_on_file + draw_temperature_levels_on_file, draw_riversmap_on_file, draw_scatter_plot_on_file, \ + draw_satellite_on_file, draw_icecaps_on_file from worldengine.plates import world_gen, generate_plates_simulation from worldengine.imex import export from worldengine.step import Step @@ -91,6 +92,10 @@ def draw_satellite_map(world, filename): draw_satellite_on_file(world, filename) print("+ satellite map generated in '%s'" % filename) +def draw_icecaps_map(world, filename): + draw_icecaps_on_file(world, filename) + print("+ icecap map generated in '%s'" % filename) + def generate_plates(seed, world_name, output_dir, width, height, num_plates=10): """ @@ -314,9 +319,10 @@ def main(): default=True) g_generate.add_argument('--scatter', dest='scatter_plot', action="store_true", help="generate scatter plot") - g_generate.add_argument('--sat', dest='satelite_map', action="store_true", help="generate satellite map") + g_generate.add_argument('--ice', dest='icecaps_map', + action="store_true", help="generate ice caps map") # ----------------------------------------------------- g_ancient_map = parser.add_argument_group( @@ -477,6 +483,7 @@ def main(): print(' black and white maps : %s' % args.black_and_white) print(' step : %s' % step.name) print(' greyscale heightmap : %s' % args.grayscale_heightmap) + print(' icecaps heightmap : %s' % args.icecaps_map) print(' rivers map : %s' % args.rivers_map) print(' scatter plot : %s' % args.scatter_plot) print(' satellite map : %s' % args.satelite_map) @@ -540,7 +547,10 @@ def main(): '%s/%s_scatter.png' % (args.output_dir, world_name)) if args.satelite_map: draw_satellite_map(world, - '%s/%s_satellite.png' % (args.output_dir, world_name)) + '%s/%s_satellite.png' % (args.output_dir, world_name)) + if args.icecaps_map: + draw_icecaps_map(world, + '%s/%s_icecaps.png' % (args.output_dir, world_name)) elif operation == 'plates': print('') # empty line diff --git a/worldengine/draw.py b/worldengine/draw.py index 3e508d21..663c0c1a 100644 --- a/worldengine/draw.py +++ b/worldengine/draw.py @@ -392,6 +392,7 @@ def draw_satellite(world, target): target.set_pixel(x, y, (r, g, b, 255)) # Paint frozen areas. + ice_color_variation = int(30) # 0 means perfectly white ice; must be in [0, 255]; only affects R- and G-channel for y in range(world.height): for x in range(world.width): if world.icecap[y, x] > 0.0: @@ -814,3 +815,8 @@ def draw_satellite_on_file(world, filename): img = PNGWriter.rgba_from_dimensions(world.width, world.height, filename) draw_satellite(world, img) img.complete() + + +def draw_icecaps_on_file(world, filename): + img = PNGWriter.grayscale_from_array(world.icecap, filename, scale_to_range=True) + img.complete() diff --git a/worldengine/simulations/icecap.py b/worldengine/simulations/icecap.py index a866ccb1..b8839eed 100644 --- a/worldengine/simulations/icecap.py +++ b/worldengine/simulations/icecap.py @@ -15,8 +15,6 @@ def is_applicable(world): def execute(self, world, seed): world.icecap = self._calculate(world, seed) - print("icecap written!!!!!!!!") - print(hasattr(world, 'icecap')) @staticmethod def _calculate(world, seed): @@ -31,14 +29,14 @@ def _calculate(world, seed): temperature = world.temperature['data'] # primary constants (could be used as global variables at some point); all values should be in [0, 1] - max_freeze_percentage = 0.50 # only the coldest x% of the cold area will freeze (0 = no ice, 1 = all ice) - freeze_chance_window = 0.10 # the warmest x% of freezable area won't completely freeze (RNG decides) + max_freeze_percentage = 0.60 # only the coldest x% of the cold area will freeze (0 = no ice, 1 = all ice) + freeze_chance_window = 0.20 # the warmest x% of freezable area won't completely freeze (RNG decides) surrounding_tile_influence = 0.5 # chance-modifier to freeze a slightly warm tile when neighbors are frozen # secondary constants temp_min = temperature.min() # coldest spot in the world freeze_threshold = world.temperature['thresholds'][0][1] # upper temperature-limit for freezing effects - # Cold biomes: + # Cold biomes: TODO: find and pick most appropriate threshold # polar: self.temperature['thresholds'][0][1] # alpine: self.temperature['thresholds'][1][1] # boreal: self.temperature['thresholds'][2][1] @@ -65,13 +63,14 @@ def _calculate(world, seed): # *can* freeze for freeze_chance_threshold < t < freeze_threshold # count number of frozen/solid tiles around this one - surr_tiles = solid_map[max(y-1, 0):min(y+2, world.height), max(x-1, 0):min(x+2, world.width)] - chance_mod = numpy.count_nonzero(surr_tiles) - chance_mod -= 1 if solid_map[y, x] else 0 # remove center-tile (i.e. the current tile) - - # map amount of tiles to chance-modifier, [-1.0, 1.0] - chance_mod = numpy.interp(chance_mod, [0, 4, 8], [-1.0, 0.0, 1.0]) # 0 to 8 tiles are frozen - chance += chance_mod * surrounding_tile_influence + if 0 < x < world.width - 1 and 0 < y < world.height - 1: # exclude borders + surr_tiles = solid_map[y-1:y+2, x-1:x+2] + chance_mod = numpy.count_nonzero(surr_tiles) + chance_mod -= 1 if solid_map[y, x] else 0 # remove center-tile (i.e. the current tile) + + # map amount of tiles to chance-modifier, [-1.0, 1.0] + chance_mod = numpy.interp(chance_mod, [0, surr_tiles.size - 1], [-1.0, 1.0]) + chance += chance_mod * surrounding_tile_influence if rng.rand() <= chance: # always freeze for chance >= 1.0, never for <= 0.0 solid_map[y, x] = True # mark tile as frozen From f5aabfd62d4b46d4183c4f22b91b5f9db6373dda Mon Sep 17 00:00:00 2001 From: tcl Date: Sun, 15 Nov 2015 15:16:44 +0100 Subject: [PATCH 6/8] Added icecap-variable to HDF5-format. --- worldengine/hdf5_serialization.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/worldengine/hdf5_serialization.py b/worldengine/hdf5_serialization.py index a9f944d0..e6415e6f 100644 --- a/worldengine/hdf5_serialization.py +++ b/worldengine/hdf5_serialization.py @@ -88,12 +88,14 @@ def save_world_to_hdf5(world, filename): temperature_data = temperature_grp.create_dataset("data", (world.height, world.width), dtype=numpy.float) temperature_data.write_direct(world.temperature['data']) - # lake_map and river_map have inverted coordinates + if hasattr(world, 'icecap'): + icecap_data = f.create_dataset("icecap", (world.height, world.width), dtype=numpy.float) + icecap_data.write_direct(world.icecap) + if hasattr(world, 'lake_map'): lake_map_data = f.create_dataset("lake_map", (world.height, world.width), dtype=numpy.float) lake_map_data.write_direct(world.lake_map) - # lake_map and river_map have inverted coordinates if hasattr(world, 'river_map'): river_map_data = f.create_dataset("river_map", (world.height, world.width), dtype=numpy.float) river_map_data.write_direct(world.river_map) @@ -207,6 +209,9 @@ def load_world_to_hdf5(filename): ] w.set_temperature(t, t_th) + if 'icecap' in f.keys(): + w.icecap = numpy.array(f['icecap']) + if 'lake_map' in f.keys(): m = numpy.array(f['lake_map']) w.set_lakemap(m) From 81b39f0056038915eee38119ad57e22258442c78 Mon Sep 17 00:00:00 2001 From: tcl Date: Mon, 16 Nov 2015 08:23:59 +0100 Subject: [PATCH 7/8] Change to protobuf-file. --- worldengine/World.proto | 12 +- worldengine/protobuf/World_pb2.py | 186 ++++++++++++++++++++---------- 2 files changed, 128 insertions(+), 70 deletions(-) diff --git a/worldengine/World.proto b/worldengine/World.proto index a118f3ee..a65a82f4 100644 --- a/worldengine/World.proto +++ b/worldengine/World.proto @@ -57,7 +57,6 @@ message World { required int32 height = 5; // Elevation - required DoubleMatrix heightMapData = 6; required double heightMapTh_sea = 7; required double heightMapTh_plain = 8; @@ -104,17 +103,16 @@ message World { optional double temperature_warm = 31; optional double temperature_subtropical = 32; - // Ice-caps - optional DoubleMatrix icecap = 33; - // Data about generation: // introduced in v0.5.3 // this is optional for backward compatibility reasons - optional GenerationData generationData = 34; + optional GenerationData generationData = 33; - optional DoubleMatrix lakemap = 35; - optional DoubleMatrix rivermap = 36; + optional DoubleMatrix lakemap = 34; + optional DoubleMatrix rivermap = 35; + // Ice-caps + optional DoubleMatrix icecap = 36; } diff --git a/worldengine/protobuf/World_pb2.py b/worldengine/protobuf/World_pb2.py index ca8a36c6..c88bf5c0 100644 --- a/worldengine/protobuf/World_pb2.py +++ b/worldengine/protobuf/World_pb2.py @@ -4,16 +4,22 @@ from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection -from google.protobuf import descriptor_pb2 +from google.protobuf import symbol_database as _symbol_database +# from google.protobuf import descriptor_pb2 # @@protoc_insertion_point(imports) +_sym_db = _symbol_database.Default() + DESCRIPTOR = _descriptor.FileDescriptor( name='World.proto', package='World', - serialized_pb='\n\x0bWorld.proto\x12\x05World\"\xf6\r\n\x05World\x12\x17\n\x0fworldengine_tag\x18\x01 \x02(\x05\x12\x1b\n\x13worldengine_version\x18\x02 \x02(\x05\x12\x0c\n\x04name\x18\x03 \x02(\t\x12\r\n\x05width\x18\x04 \x02(\x05\x12\x0e\n\x06height\x18\x05 \x02(\x05\x12\x30\n\rheightMapData\x18\x06 \x02(\x0b\x32\x19.World.World.DoubleMatrix\x12\x17\n\x0fheightMapTh_sea\x18\x07 \x02(\x01\x12\x19\n\x11heightMapTh_plain\x18\x08 \x02(\x01\x12\x18\n\x10heightMapTh_hill\x18\t \x02(\x01\x12*\n\x06plates\x18\n \x02(\x0b\x32\x1a.World.World.IntegerMatrix\x12)\n\x05ocean\x18\x0b \x02(\x0b\x32\x1a.World.World.BooleanMatrix\x12,\n\tsea_depth\x18\x0c \x02(\x0b\x32\x19.World.World.DoubleMatrix\x12)\n\x05\x62iome\x18\r \x01(\x0b\x32\x1a.World.World.IntegerMatrix\x12\x38\n\x08humidity\x18\x0e \x01(\x0b\x32&.World.World.DoubleMatrixWithQuantiles\x12-\n\nirrigation\x18\x0f \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x33\n\x10permeabilityData\x18\x10 \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x18\n\x10permeability_low\x18\x11 \x01(\x01\x12\x18\n\x10permeability_med\x18\x12 \x01(\x01\x12/\n\x0cwatermapData\x18\x13 \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x16\n\x0ewatermap_creek\x18\x14 \x01(\x01\x12\x16\n\x0ewatermap_river\x18\x15 \x01(\x01\x12\x1a\n\x12watermap_mainriver\x18\x16 \x01(\x01\x12\x34\n\x11precipitationData\x18\x17 \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x19\n\x11precipitation_low\x18\x18 \x01(\x01\x12\x19\n\x11precipitation_med\x18\x19 \x01(\x01\x12\x32\n\x0ftemperatureData\x18\x1a \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x19\n\x11temperature_polar\x18\x1b \x01(\x01\x12\x1a\n\x12temperature_alpine\x18\x1c \x01(\x01\x12\x1a\n\x12temperature_boreal\x18\x1d \x01(\x01\x12\x18\n\x10temperature_cool\x18\x1e \x01(\x01\x12\x18\n\x10temperature_warm\x18\x1f \x01(\x01\x12\x1f\n\x17temperature_subtropical\x18 \x01(\x01\x12)\n\x06icecap\x18! \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x33\n\x0egenerationData\x18\" \x01(\x0b\x32\x1b.World.World.GenerationData\x12*\n\x07lakemap\x18# \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12+\n\x08rivermap\x18$ \x01(\x0b\x32\x19.World.World.DoubleMatrix\x1a\x1a\n\tDoubleRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x01\x1a\x1b\n\nBooleanRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x08\x1a\x1b\n\nIntegerRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x05\x1a\x18\n\x07\x42yteRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x05\x1a\x34\n\x0c\x44oubleMatrix\x12$\n\x04rows\x18\x01 \x03(\x0b\x32\x16.World.World.DoubleRow\x1a\x36\n\rBooleanMatrix\x12%\n\x04rows\x18\x01 \x03(\x0b\x32\x17.World.World.BooleanRow\x1a\x36\n\rIntegerMatrix\x12%\n\x04rows\x18\x01 \x03(\x0b\x32\x17.World.World.IntegerRow\x1a,\n\x0e\x44oubleQuantile\x12\x0b\n\x03key\x18\x01 \x02(\x05\x12\r\n\x05value\x18\x02 \x02(\x01\x1aq\n\x19\x44oubleMatrixWithQuantiles\x12.\n\tquantiles\x18\x01 \x03(\x0b\x32\x1b.World.World.DoubleQuantile\x12$\n\x04rows\x18\x02 \x03(\x0b\x32\x16.World.World.DoubleRow\x1aS\n\x0eGenerationData\x12\x0c\n\x04seed\x18\x01 \x01(\x05\x12\x10\n\x08n_plates\x18\x02 \x01(\x05\x12\x13\n\x0bocean_level\x18\x03 \x01(\x02\x12\x0c\n\x04step\x18\x04 \x01(\t') + syntax='proto2', + serialized_pb=b'\n\x0bWorld.proto\x12\x05World\"\xf6\r\n\x05World\x12\x17\n\x0fworldengine_tag\x18\x01 \x02(\x05\x12\x1b\n\x13worldengine_version\x18\x02 \x02(\x05\x12\x0c\n\x04name\x18\x03 \x02(\t\x12\r\n\x05width\x18\x04 \x02(\x05\x12\x0e\n\x06height\x18\x05 \x02(\x05\x12\x30\n\rheightMapData\x18\x06 \x02(\x0b\x32\x19.World.World.DoubleMatrix\x12\x17\n\x0fheightMapTh_sea\x18\x07 \x02(\x01\x12\x19\n\x11heightMapTh_plain\x18\x08 \x02(\x01\x12\x18\n\x10heightMapTh_hill\x18\t \x02(\x01\x12*\n\x06plates\x18\n \x02(\x0b\x32\x1a.World.World.IntegerMatrix\x12)\n\x05ocean\x18\x0b \x02(\x0b\x32\x1a.World.World.BooleanMatrix\x12,\n\tsea_depth\x18\x0c \x02(\x0b\x32\x19.World.World.DoubleMatrix\x12)\n\x05\x62iome\x18\r \x01(\x0b\x32\x1a.World.World.IntegerMatrix\x12\x38\n\x08humidity\x18\x0e \x01(\x0b\x32&.World.World.DoubleMatrixWithQuantiles\x12-\n\nirrigation\x18\x0f \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x33\n\x10permeabilityData\x18\x10 \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x18\n\x10permeability_low\x18\x11 \x01(\x01\x12\x18\n\x10permeability_med\x18\x12 \x01(\x01\x12/\n\x0cwatermapData\x18\x13 \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x16\n\x0ewatermap_creek\x18\x14 \x01(\x01\x12\x16\n\x0ewatermap_river\x18\x15 \x01(\x01\x12\x1a\n\x12watermap_mainriver\x18\x16 \x01(\x01\x12\x34\n\x11precipitationData\x18\x17 \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x19\n\x11precipitation_low\x18\x18 \x01(\x01\x12\x19\n\x11precipitation_med\x18\x19 \x01(\x01\x12\x32\n\x0ftemperatureData\x18\x1a \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12\x19\n\x11temperature_polar\x18\x1b \x01(\x01\x12\x1a\n\x12temperature_alpine\x18\x1c \x01(\x01\x12\x1a\n\x12temperature_boreal\x18\x1d \x01(\x01\x12\x18\n\x10temperature_cool\x18\x1e \x01(\x01\x12\x18\n\x10temperature_warm\x18\x1f \x01(\x01\x12\x1f\n\x17temperature_subtropical\x18 \x01(\x01\x12\x33\n\x0egenerationData\x18! \x01(\x0b\x32\x1b.World.World.GenerationData\x12*\n\x07lakemap\x18\" \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12+\n\x08rivermap\x18# \x01(\x0b\x32\x19.World.World.DoubleMatrix\x12)\n\x06icecap\x18$ \x01(\x0b\x32\x19.World.World.DoubleMatrix\x1a\x1a\n\tDoubleRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x01\x1a\x1b\n\nBooleanRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x08\x1a\x1b\n\nIntegerRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x05\x1a\x18\n\x07\x42yteRow\x12\r\n\x05\x63\x65lls\x18\x01 \x03(\x05\x1a\x34\n\x0c\x44oubleMatrix\x12$\n\x04rows\x18\x01 \x03(\x0b\x32\x16.World.World.DoubleRow\x1a\x36\n\rBooleanMatrix\x12%\n\x04rows\x18\x01 \x03(\x0b\x32\x17.World.World.BooleanRow\x1a\x36\n\rIntegerMatrix\x12%\n\x04rows\x18\x01 \x03(\x0b\x32\x17.World.World.IntegerRow\x1a,\n\x0e\x44oubleQuantile\x12\x0b\n\x03key\x18\x01 \x02(\x05\x12\r\n\x05value\x18\x02 \x02(\x01\x1aq\n\x19\x44oubleMatrixWithQuantiles\x12.\n\tquantiles\x18\x01 \x03(\x0b\x32\x1b.World.World.DoubleQuantile\x12$\n\x04rows\x18\x02 \x03(\x0b\x32\x16.World.World.DoubleRow\x1aS\n\x0eGenerationData\x12\x0c\n\x04seed\x18\x01 \x01(\x05\x12\x10\n\x08n_plates\x18\x02 \x01(\x05\x12\x13\n\x0bocean_level\x18\x03 \x01(\x02\x12\x0c\n\x04step\x18\x04 \x01(\t' +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -40,7 +46,10 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], + oneofs=[ + ], serialized_start=1283, serialized_end=1309, ) @@ -67,7 +76,10 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], + oneofs=[ + ], serialized_start=1311, serialized_end=1338, ) @@ -94,7 +106,10 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], + oneofs=[ + ], serialized_start=1340, serialized_end=1367, ) @@ -121,7 +136,10 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], + oneofs=[ + ], serialized_start=1369, serialized_end=1393, ) @@ -148,7 +166,10 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], + oneofs=[ + ], serialized_start=1395, serialized_end=1447, ) @@ -175,7 +196,10 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], + oneofs=[ + ], serialized_start=1449, serialized_end=1503, ) @@ -202,7 +226,10 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], + oneofs=[ + ], serialized_start=1505, serialized_end=1559, ) @@ -236,7 +263,10 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], + oneofs=[ + ], serialized_start=1561, serialized_end=1605, ) @@ -270,7 +300,10 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], + oneofs=[ + ], serialized_start=1607, serialized_end=1720, ) @@ -306,7 +339,7 @@ _descriptor.FieldDescriptor( name='step', full_name='World.World.GenerationData.step', index=3, number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -318,7 +351,10 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], + oneofs=[ + ], serialized_start=1722, serialized_end=1805, ) @@ -347,7 +383,7 @@ _descriptor.FieldDescriptor( name='name', full_name='World.World.name', index=2, number=3, type=9, cpp_type=9, label=2, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=b"".decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -555,28 +591,28 @@ is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='icecap', full_name='World.World.icecap', index=32, + name='generationData', full_name='World.World.generationData', index=32, number=33, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='generationData', full_name='World.World.generationData', index=33, + name='lakemap', full_name='World.World.lakemap', index=33, number=34, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='lakemap', full_name='World.World.lakemap', index=34, + name='rivermap', full_name='World.World.rivermap', index=34, number=35, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='rivermap', full_name='World.World.rivermap', index=35, + name='icecap', full_name='World.World.icecap', index=35, number=36, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -590,26 +626,29 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], + oneofs=[ + ], serialized_start=23, serialized_end=1805, ) -_WORLD_DOUBLEROW.containing_type = _WORLD; -_WORLD_BOOLEANROW.containing_type = _WORLD; -_WORLD_INTEGERROW.containing_type = _WORLD; -_WORLD_BYTEROW.containing_type = _WORLD; +_WORLD_DOUBLEROW.containing_type = _WORLD +_WORLD_BOOLEANROW.containing_type = _WORLD +_WORLD_INTEGERROW.containing_type = _WORLD +_WORLD_BYTEROW.containing_type = _WORLD _WORLD_DOUBLEMATRIX.fields_by_name['rows'].message_type = _WORLD_DOUBLEROW -_WORLD_DOUBLEMATRIX.containing_type = _WORLD; +_WORLD_DOUBLEMATRIX.containing_type = _WORLD _WORLD_BOOLEANMATRIX.fields_by_name['rows'].message_type = _WORLD_BOOLEANROW -_WORLD_BOOLEANMATRIX.containing_type = _WORLD; +_WORLD_BOOLEANMATRIX.containing_type = _WORLD _WORLD_INTEGERMATRIX.fields_by_name['rows'].message_type = _WORLD_INTEGERROW -_WORLD_INTEGERMATRIX.containing_type = _WORLD; -_WORLD_DOUBLEQUANTILE.containing_type = _WORLD; +_WORLD_INTEGERMATRIX.containing_type = _WORLD +_WORLD_DOUBLEQUANTILE.containing_type = _WORLD _WORLD_DOUBLEMATRIXWITHQUANTILES.fields_by_name['quantiles'].message_type = _WORLD_DOUBLEQUANTILE _WORLD_DOUBLEMATRIXWITHQUANTILES.fields_by_name['rows'].message_type = _WORLD_DOUBLEROW -_WORLD_DOUBLEMATRIXWITHQUANTILES.containing_type = _WORLD; -_WORLD_GENERATIONDATA.containing_type = _WORLD; +_WORLD_DOUBLEMATRIXWITHQUANTILES.containing_type = _WORLD +_WORLD_GENERATIONDATA.containing_type = _WORLD _WORLD.fields_by_name['heightMapData'].message_type = _WORLD_DOUBLEMATRIX _WORLD.fields_by_name['plates'].message_type = _WORLD_INTEGERMATRIX _WORLD.fields_by_name['ocean'].message_type = _WORLD_BOOLEANMATRIX @@ -621,77 +660,98 @@ _WORLD.fields_by_name['watermapData'].message_type = _WORLD_DOUBLEMATRIX _WORLD.fields_by_name['precipitationData'].message_type = _WORLD_DOUBLEMATRIX _WORLD.fields_by_name['temperatureData'].message_type = _WORLD_DOUBLEMATRIX -_WORLD.fields_by_name['icecap'].message_type = _WORLD_DOUBLEMATRIX _WORLD.fields_by_name['generationData'].message_type = _WORLD_GENERATIONDATA _WORLD.fields_by_name['lakemap'].message_type = _WORLD_DOUBLEMATRIX _WORLD.fields_by_name['rivermap'].message_type = _WORLD_DOUBLEMATRIX +_WORLD.fields_by_name['icecap'].message_type = _WORLD_DOUBLEMATRIX DESCRIPTOR.message_types_by_name['World'] = _WORLD -class World(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - - class DoubleRow(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _WORLD_DOUBLEROW +World = _reflection.GeneratedProtocolMessageType('World', (_message.Message,), dict( + DoubleRow = _reflection.GeneratedProtocolMessageType('DoubleRow', (_message.Message,), dict( + DESCRIPTOR = _WORLD_DOUBLEROW, + __module__ = 'World_pb2' # @@protoc_insertion_point(class_scope:World.World.DoubleRow) + )) + , - class BooleanRow(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _WORLD_BOOLEANROW - + BooleanRow = _reflection.GeneratedProtocolMessageType('BooleanRow', (_message.Message,), dict( + DESCRIPTOR = _WORLD_BOOLEANROW, + __module__ = 'World_pb2' # @@protoc_insertion_point(class_scope:World.World.BooleanRow) + )) + , - class IntegerRow(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _WORLD_INTEGERROW - + IntegerRow = _reflection.GeneratedProtocolMessageType('IntegerRow', (_message.Message,), dict( + DESCRIPTOR = _WORLD_INTEGERROW, + __module__ = 'World_pb2' # @@protoc_insertion_point(class_scope:World.World.IntegerRow) + )) + , - class ByteRow(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _WORLD_BYTEROW - + ByteRow = _reflection.GeneratedProtocolMessageType('ByteRow', (_message.Message,), dict( + DESCRIPTOR = _WORLD_BYTEROW, + __module__ = 'World_pb2' # @@protoc_insertion_point(class_scope:World.World.ByteRow) + )) + , - class DoubleMatrix(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _WORLD_DOUBLEMATRIX - + DoubleMatrix = _reflection.GeneratedProtocolMessageType('DoubleMatrix', (_message.Message,), dict( + DESCRIPTOR = _WORLD_DOUBLEMATRIX, + __module__ = 'World_pb2' # @@protoc_insertion_point(class_scope:World.World.DoubleMatrix) + )) + , - class BooleanMatrix(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _WORLD_BOOLEANMATRIX - + BooleanMatrix = _reflection.GeneratedProtocolMessageType('BooleanMatrix', (_message.Message,), dict( + DESCRIPTOR = _WORLD_BOOLEANMATRIX, + __module__ = 'World_pb2' # @@protoc_insertion_point(class_scope:World.World.BooleanMatrix) + )) + , - class IntegerMatrix(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _WORLD_INTEGERMATRIX - + IntegerMatrix = _reflection.GeneratedProtocolMessageType('IntegerMatrix', (_message.Message,), dict( + DESCRIPTOR = _WORLD_INTEGERMATRIX, + __module__ = 'World_pb2' # @@protoc_insertion_point(class_scope:World.World.IntegerMatrix) + )) + , - class DoubleQuantile(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _WORLD_DOUBLEQUANTILE - + DoubleQuantile = _reflection.GeneratedProtocolMessageType('DoubleQuantile', (_message.Message,), dict( + DESCRIPTOR = _WORLD_DOUBLEQUANTILE, + __module__ = 'World_pb2' # @@protoc_insertion_point(class_scope:World.World.DoubleQuantile) + )) + , - class DoubleMatrixWithQuantiles(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _WORLD_DOUBLEMATRIXWITHQUANTILES - + DoubleMatrixWithQuantiles = _reflection.GeneratedProtocolMessageType('DoubleMatrixWithQuantiles', (_message.Message,), dict( + DESCRIPTOR = _WORLD_DOUBLEMATRIXWITHQUANTILES, + __module__ = 'World_pb2' # @@protoc_insertion_point(class_scope:World.World.DoubleMatrixWithQuantiles) + )) + , - class GenerationData(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _WORLD_GENERATIONDATA - + GenerationData = _reflection.GeneratedProtocolMessageType('GenerationData', (_message.Message,), dict( + DESCRIPTOR = _WORLD_GENERATIONDATA, + __module__ = 'World_pb2' # @@protoc_insertion_point(class_scope:World.World.GenerationData) - DESCRIPTOR = _WORLD - + )) + , + DESCRIPTOR = _WORLD, + __module__ = 'World_pb2' # @@protoc_insertion_point(class_scope:World.World) + )) +_sym_db.RegisterMessage(World) +_sym_db.RegisterMessage(World.DoubleRow) +_sym_db.RegisterMessage(World.BooleanRow) +_sym_db.RegisterMessage(World.IntegerRow) +_sym_db.RegisterMessage(World.ByteRow) +_sym_db.RegisterMessage(World.DoubleMatrix) +_sym_db.RegisterMessage(World.BooleanMatrix) +_sym_db.RegisterMessage(World.IntegerMatrix) +_sym_db.RegisterMessage(World.DoubleQuantile) +_sym_db.RegisterMessage(World.DoubleMatrixWithQuantiles) +_sym_db.RegisterMessage(World.GenerationData) # @@protoc_insertion_point(module_scope) From 93f14d2954dbfb376cc1c58e03159b6391db58f9 Mon Sep 17 00:00:00 2001 From: tcl Date: Mon, 16 Nov 2015 10:27:57 +0100 Subject: [PATCH 8/8] Updated Protobuf-version requirements. --- setup.py | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index b7c6a7ea..22866c32 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ 'console_scripts': ['worldengine=worldengine.cli.main:main'], }, 'install_requires': ['PyPlatec==1.4.0', 'pypng>=0.0.18', 'numpy>=1.9.2, <= 1.10.0.post2', - 'argparse==1.2.1', 'noise==1.2.2', 'protobuf>=2.6.0'], + 'argparse==1.2.1', 'noise==1.2.2', 'protobuf==3.0.0a3'], 'license': 'MIT License' } diff --git a/tox.ini b/tox.ini index 6a44a172..b91be59e 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,6 @@ deps = PyPlatec noise nose - protobuf six pypng h5py @@ -18,6 +17,7 @@ deps = coverage numpy==1.9.2 pygdal==1.10.0.1 + protobuf==3.0.0a3 {[base]deps}