Last active
September 12, 2019 21:45
-
-
Save caioerick/45a4769e3c6bb55ffa05c0547bf27383 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bibliotecas | |
from mpl_toolkits.basemap import Basemap | |
import matplotlib.pyplot as plt | |
import numpy as np | |
# a batimetria precisa ser extraída do site do etopo | |
# https://maps.ngdc.noaa.gov/viewers/wcs-client/ | |
etopo = Dataset('dados/etopo1_bedrock.nc') | |
lat = etopo['lat'][:] | |
lon = etopo['lon'][:] | |
prof = etopo['Band1'][:] | |
# dimensões da figura | |
plt.figure(figsize=(8,5)) | |
# criando o objeto 'mapa' | |
mapa = Basemap(llcrnrlon=-41, | |
llcrnrlat=-5, | |
urcrnrlon=-36, | |
urcrnrlat=-2, | |
resolution='i') | |
# configurando o mapa inicial | |
mapa.drawmapboundary(fill_color='#81BEF7', zorder=1) | |
mapa.drawparallels(range(-10, 0, 1), labels=[1,1,1,1], color='#ffffff') | |
mapa.drawmeridians(range(-40, -30, 1), labels=[1,1,1,1], color='#ffffff') | |
mapa.fillcontinents(color='#cccccc', zorder=2) | |
mapa.drawcoastlines() | |
LON, LAT = np.meshgrid(lon, lat) | |
# plotando os pontos | |
mapa.plot(-38.43, -3.2, marker='o', color='#8A2908', markersize=10) | |
plt.annotate('PNBOIA', xy=(-39.16,-3.3), fontsize=14, zorder=5, color='#8A2908') | |
mapa.plot(-38.5, -3.7, marker='o', color='b', markersize=10) | |
plt.annotate('Fortaleza', xy=(-39.16,-3.9), fontsize=11, zorder=5, color='b') | |
# plotando as isobatas | |
isobat = np.array([-3000, -1800, -60]) | |
contorno = mapa.contour(LON, LAT, prof, levels=isobat, colors='#0B243B', linewidths=1.2, linestyles='solid') | |
clabel = plt.clabel(contorno, fontsize=10, colors='#000000', fmt='%1d') | |
# pontos para fazer o poligono | |
lons = [-38.4782452, -38.3149407, -38.3150339, -38.4782452, -38.4782452] | |
lats = [-3.6451794, -3.6451794, -3.5182367, -3.5182367, -3.6451794] | |
mapa.plot(lons, lats, marker='.', color='red') | |
#plt.show() | |
plt.savefig('figures/carlos-mapa-pnboia-polygon.png', dpi=140) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment