[ Foro de Python ]

cartopy

20-Apr-2021 20:31
Invitado (Que hize mal )
0 Respuestas

import cartopy
from scipy.interpolate import griddata

data = np.genfromtxt('test3.txt', skip_header=2)
N =  np.linspace(12, -90 ,72 ) #Interpolacion
X = np.genfromtxt('test3.txt', skip_header=2, usecols=6)
Y = np.genfromtxt('test3.txt', skip_header=2, usecols=7)
D = np.genfromtxt('test3.txt', skip_header=2, usecols=2)
I = np.genfromtxt('test3.txt', skip_header=2, usecols=3)
F = np.genfromtxt('test3.txt', skip_header=2, usecols=5)

xi = np.linspace(X.min(), X.max(), N)
yi = np.linspace(Y.min(), Y.max(), N)

xg, yg = np.meshgrid(xi, yi)
di     = griddata((X,Y), I, (xg, yg), method='cubic')
ii     = griddata((X,Y), D, (xg, yg), method='cubic')
fi     = griddata((X,Y), F, (xg, yg), method='cubic')


fig, ax = plt.subplots(1,1, figsize=(12,8))
ax = plt.axes(projection=cartopy.crs.PlateCarree())
ax.add_feature(cartopy.feature.COASTLINE)
ax.add_feature(cartopy.feature.BORDERS, linestyle=':')
ax.add_feature(cartopy.feature.LAND)
ax.add_feature(cartopy.feature.OCEAN)
contours = ax.contour(xi,yi,fi, levels=20, colors='black')
ax.clabel(contours, inline=True, fontsize=10)
ax.set_xticks([-120, -110, -100, -90])
ax.set_yticks([15, 20, 25, 30, 35])
ax.set_extent([-120, -85, 12, 32])
ax.set_title('Campo Total [nT]');

fig, ax = plt.subplots(1,1, figsize=(12,8))
ax = plt.axes(projection=cartopy.crs.PlateCarree())
ax.add_feature(cartopy.feature.COASTLINE)
ax.add_feature(cartopy.feature.BORDERS, linestyle=':')
ax.add_feature(cartopy.feature.LAND)
ax.add_feature(cartopy.feature.OCEAN)
contours = ax.contour(xi,yi,di, levels=20, colors='black')
ax.clabel(contours, inline=True, fontsize=10)
ax.set_xticks([-120, -110, -100, -90])
ax.set_yticks([15, 20, 25, 30, 35])
ax.set_extent([-120, -85, 12, 32])
ax.set_title('Declinación [grados]');

fig, ax = plt.subplots(1,1, figsize=(12,8))
ax = plt.axes(projection=cartopy.crs.PlateCarree())
ax.add_feature(cartopy.feature.COASTLINE)
ax.add_feature(cartopy.feature.BORDERS, linestyle=':')
ax.add_feature(cartopy.feature.LAND)
ax.add_feature(cartopy.feature.OCEAN)
contours = ax.contour(xi,yi,ii, levels=20, colors='black')
ax.clabel(contours, inline=True, fontsize=10)
ax.set_xticks([-120, -110, -100, -90])
ax.set_yticks([15, 20, 25, 30, 35])
ax.set_extent([-120, -85, 12, 32])
ax.set_title('Inclinación [grados]');




(No se puede continuar esta discusión porque tiene más de dos meses de antigüedad. Si tienes dudas parecidas, abre un nuevo hilo.)