diff --git a/draw.py b/draw.py new file mode 100644 index 0000000..8965ff3 --- /dev/null +++ b/draw.py @@ -0,0 +1,41 @@ +from shapely.geometry import Point, MultiPoint +from shapely.ops import cascaded_union +import matplotlib.pyplot as plt +import pandas as pd +import cartopy.crs as ccrs + +df = pd.read_pickle('data_final.p') + +biomes = {} +biome_numbers = df['biome_num'].unique() +for n in biome_numbers: + biomes[n] = [] + +for (longitude, latitude), row in df.iterrows(): + biomes[row.biome_num].append(Point(longitude, latitude)) + +ax = plt.axes(projection=ccrs.PlateCarree()) +ax.stock_img() + +colors={ + 0: '#016936', + 1: '#B2D127', + 2: '#77CC00', + 3: '#99C500', + 4: '#B6CC00', + 5: '#00C5B5', + 6: '#EFFF00', + 7: '#FFEE00', + 8: '#009BFF', + 9: '#A0ADBA', + 10: '#5C62FF', + 11: '#00850F', + 12: '#FF9E1F', + 13: '#FF1F97' +} + +for n in biome_numbers: + biomes[n] = MultiPoint(biomes[n]).buffer(1) + ax.add_geometries(biomes[n], ccrs.PlateCarree(), facecolor=colors[n]) + +plt.show() diff --git a/requirements.txt b/requirements.txt index bccc651..7586e77 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,5 @@ descartes==1.1.0 pysal==2.0.0 rasterio==1.0.15 tensorflow==1.12.0 +Cartopy==0.17.0 +numpy==1.16.1