world-ecoregion/plot.py
2019-02-02 16:16:38 +03:30

29 lines
837 B
Python

import geopandas
import os
import rasterio
import pandas as pd
from matplotlib import pyplot
directory = os.path.dirname(os.path.abspath(__file__))
GEODATA = os.path.join(directory, 'geodata')
ECOREGIONS = os.path.join(GEODATA, 'ecoregions', 'Ecoregions2017.shp')
ELEVATION = os.path.join(GEODATA, 'srtm', 'topo30-180.tif')
TEMP = os.path.join(GEODATA, 'air_temp')
temp = pd.read_csv(os.path.join(TEMP, 'air_temp.2017'), sep='\s+', header=None, names=['longitude', 'latitude', 'january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'november', 'october', 'december', 'yearly_avg'])
print(temp.head())
eco = geopandas.read_file(ECOREGIONS)
elevation = rasterio.open(ELEVATION)
print(eco.head())
print(elevation)
eco.plot()
# rasterio.plot.show(src)
# pyplot.imshow(elevation.read(1))
pyplot.show()