diff --git a/DatosRC.dat b/DatosRC.dat new file mode 100644 index 0000000000000000000000000000000000000000..abca6673c26f195a7f4219022f50b078d80374e4 --- /dev/null +++ b/DatosRC.dat @@ -0,0 +1,26 @@ +#lugar, ALT, LAT, LONG, STATUS, Ru, Rc, Rl, +Marambio,200.0,-64.24,-56.62,ongoing,2.19,2.19,2.19, +Bariloche,850.0,-41.15,-71.3,uprunning,7.84,7.84,7.84, +Buenos Aires,10.0,-34.54,-58.44,uprunning,8.19,8.19,8.19, +Campinas,685,-22.9,-47.06,uprunning,9.73,9.73,9.73, +Campina Grande,550,-7.23,-35.88,uprunning,11.86,11.86,11.86, +La Paz,3630,-16.49,-68.15,ongoing,11.55,11.55,11.55, +Cota cota(bo),3917,-16.41,-68.5,ongoing,11.55,11.55,11.55, +Chacaltaya,5240.0,-16.35,-68.13,uprunning,11.55,11.55,11.55, +Cusco,3400.0,-13.52,-71.96,uprunning,11.86,11.86,11.86, +Lima,150.0,-12.1,-77.02,uprunning,12.03,12.03,12.03, +Huancayo,3370.0,-12.04,-75.3,uprunning,12.03,12.03,12.03, +Riobamba,2.754,-1.81,-78.74,ongoing,12.18,12.18,12.18, +Quito-USFQ,2800,-0.2,-78.5,ongoing,12.18,12.18,12.18, +Quito-ESPOCH,2800,0.0,-79.0,uprunning,12.18,12.18,12.18, +Quito-EPN,2800,-0.2,-78.5,ongoing,12.18,12.18,12.18, +Pasto,2530,1.21,-77.27,ongoing,12.18,12.18,12.18, +Bucaramanga,956.0,7.14,-73.12,uprunning,11.63,11.63,11.63, +Merida-ULA,1893.0,8.63,-71.15,ongoing,11.60,11.60,11.60, +Caracas-UCV,900.0,10.49,-66.89,ongoing,11.69,11.69,11.69, +Caracas-USB,900.0,10.49,-66.89,ongoing,11.69,11.69,11.69, +Guatemala-USC,1490.0,14.63,-90.59,ongoing,9.11,9.11,9.11, +Sierra Negra,4550.0,18.16,-97.95,ongoing,7.36,7.36,7.36, +Tacana,4060,15.13,-92.11,ongoing,9.11,9.11,9.11, +Chiapas,522,16.75,-93.12,ongoing,9.11,9.11,9.11, +La Serena,28,-29.90,-71.25,planned,9.25,9.25,9.25, diff --git a/LAGOmapa-sitios.py b/LAGOmapa-sitios.py new file mode 100644 index 0000000000000000000000000000000000000000..b70c1dfa591b54d0330ca313da0670fe63478dfb --- /dev/null +++ b/LAGOmapa-sitios.py @@ -0,0 +1,61 @@ +import os,sys +import matplotlib.gridspec as gridspec +import matplotlib.pyplot as plt +import matplotlib.image as mpimg +import numpy as np + +def logo(): + print " \n\n\n " + print " ___ ___ ___ ___" + print " /\__\ /\ \ /\ \ /\ \ " + print " /:/ / /::\ \ /::\ \ /::\ \ " + print " /:/ / /:/\:\ \ /:/\:\ \ /:/\:\ \ " + print " /:/ / /::\~\:\ \ /:/ \:\ \ /:/ \:\ \ " + print " /:/__/ /:/\:\ \:\__\ /:/__/_\:\__\ /:/__/ \:\__\ " + print " \:\ \ \/__\:\/:/ / \:\ /\ \/__/ \:\ \ /:/ / " + print " \:\ \ \::/ / \:\ \:\__\ \:\ /:/ / " + print " \:\ \ /:/ / \:\/:/ / \:\/:/ / " + print " \:\__\ /:/ / \::/ / \::/ / " + print " \/__/ __ _\/__/__ _ _ __\/____ ___ _\/__/ " + print " | '_ ` _ \ / _` | '_ \| '_ \ / _ \ '__| " + print " | | | | | | (_| | |_) | |_) | __/ | " + print " |_| |_| |_|\__,_| .__/| .__/ \___|_| " + print " | | | | " + print " |_| |_| " + return + + + +logo() +comand='python mapingLAGO/AutoMap.py ' +comand2='python3 SitiosAlturas/plotalturas3.py ' + +for i in range(1, len(sys.argv)): + comand+=sys.argv[i]+' ' + comand2+=sys.argv[i]+' ' + + + + +print "\n\n\ngenerando mapa..... " +os.system(comand) +print "\n\n\ngenerando curva de alturas... \n\n\n" +os.system(comand2) + +fig = plt.figure() +gs = gridspec.GridSpec(1, 2, width_ratios=[1, 1.2],left=None,bottom=None,right=None,top=None,wspace=.005,hspace=.005) + +ax1=plt.subplot(gs[0]) +ax1.set_axis_off() +img = mpimg.imread('lagoplano.png') +lum_img = img[:,:,:] +imgplot = plt.imshow(lum_img) + +ax2=plt.subplot(gs[1]) +ax2.set_axis_off() +img2 = mpimg.imread('alturas3.png') +lum_img2 = img2[:,:,:] +imgplot2 = plt.imshow(lum_img2) +#plt.show() +#plt.figure(figsize=(30,18)) +plt.savefig("MAPAtodo.png",dpi=600,bbox_inches='tight', pad_inches = 0) diff --git a/MAPAtodo.png b/MAPAtodo.png new file mode 100644 index 0000000000000000000000000000000000000000..e38ba219c7e6bef0739d4cf0a318fc7cdcb5df3a Binary files /dev/null and b/MAPAtodo.png differ diff --git a/README.md b/README.md index 9cd737aa1aa82f177201e5549707dba88d610b4b..9eac5b25921aa2bcc5158d32c49a3a1eb219d0a6 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,36 @@ -# MapsSites -Mapa con las estaciones de LAGO +Autor: Arturo Núñez +Versión original: https://github.com/luturonunca/LAGOmaps.git + + ___ ___ ___ ___ + /\__\ /\ \ /\ \ /\ \ + /:/ / /::\ \ /::\ \ /::\ \ + /:/ / /:/\:\ \ /:/\:\ \ /:/\:\ \ + /:/ / /::\~\:\ \ /:/ \:\ \ /:/ \:\ \ + /:/__/ /:/\:\ \:\__\ /:/__/_\:\__\ /:/__/ \:\__\ + \:\ \ \/__\:\/:/ / \:\ /\ \/__/ \:\ \ /:/ / + \:\ \ \::/ / \:\ \:\__\ \:\ /:/ / + \:\ \ /:/ / \:\/:/ / \:\/:/ / + \:\__\ /:/ / \::/ / \::/ / + \/__/ __ _\/__/__ _ _ __\/____ ___ _\/__/ + | '_ ` _ \ / _` | '_ \| '_ \ / _ \ '__| + | | | | | | (_| | |_) | |_) | __/ | + |_| |_| |_|\__,_| .__/| .__/ \___|_| + | | | | + |_| |_| + + + + +LAGO mapper +realiza un mapa de los sitios lago en en America latina +junto con la grafica que coresponde a la Rigidez +correr +********** +python LAGOmapa-sitios.py DatosRC.dat +********** +el formato del archivo DATOS_DE_LOS_SITIOS +debe ser como el que se muestra en la cabecera +del archivo DatosRC.dat + +Los datos son ordentado por la rutina sorteador.py para que aparezcan +segun su latitud diff --git a/SitiosAlturas/plotalturas3.py b/SitiosAlturas/plotalturas3.py new file mode 100644 index 0000000000000000000000000000000000000000..7eec136c401a75f8658fd0b39a428c34a758df9c --- /dev/null +++ b/SitiosAlturas/plotalturas3.py @@ -0,0 +1,130 @@ +#pylab inline +from pandas import read_csv +from matplotlib.pyplot import * +import sys,os + +########################################################################## + +ignore=[0,0,0] +for j in range(0,len(sys.argv)): + if sys.argv[j]=='-uprunning': + ignore[0]=1 + if sys.argv[j]=='-ongoing': + ignore[1]=1 + if sys.argv[j]=='-planned': + ignore[2]=1 +ig=ignore[0]+ignore[1]+ignore[2] + +if ig==3: + sys.exit("ERROR--IGNORANDO TODO!!!") + +######################################################################### +os.system("python sorteador.py "+sys.argv[1]+" 2 > misdatos.dat") +files=open('misdatos.dat') + +labels=[] +x=[] +xon=[] +yon=[] +xso=[] +yso=[] +xuc=[] +yuc=[] + +cont=0 +for line in files: + row=line.split(',') + if row[0][0]=='#': + continue + cont+=1 + x.append(cont) + labels.append(row[0]) + if ig!=3: + #print row[4] + if ignore[0]>0 and row[4]=='uprunning': + continue + print (line) + if float(row[6])==0: + continue + elif row[4]=='uprunning': + xon.append(row[6]) + yon.append(row[2]) + if ignore[1]>0 and row[4]=='ongoing': + continue + elif row[4]=='ongoing': + xso.append(row[6]) + yso.append(row[2]) + if ignore[2]>0 and row[4]=='planned': + continue + elif row[4]=='planned': + xuc.append(row[6]) + yuc.append(row[2]) +#print x +#print xuc +# These are the "Tableau 20" colors as RGB. +tableau20 = [(25,25,112),(31, 119, 180), (255, 127, 14), (255, 187, 120), + (44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150), + (148, 103, 189), (197, 176, 213), (140, 86, 75), (196, 156, 148), + (227, 119, 194), (247, 182, 210), (127, 127, 127), (199, 199, 199), + (188, 189, 34), (219, 219, 141), (23, 190, 207), (158, 218, 229)] + +# Scale the RGB values to the [0, 1] range, which is the format matplotlib accepts. +for i in range(len(tableau20)): + r, g, b = tableau20[i] + tableau20[i] = (r / 255., g / 255., b / 255.) +#figure size +figure(figsize=(13,18)) + +# Remove the plot frame lines. They are unnecessary chartjunk. +ax = subplot(111) +ax.spines["top"].set_visible(True) +ax.spines["bottom"].set_visible(True) +ax.spines["right"].set_visible(True) +ax.spines["left"].set_visible(True) + +ax.axis([0, 14, -84, 33.56]) +# Ticks on the right and top of the plot are generally unnecessary chartjunk. +ax.get_xaxis().tick_bottom() +ax.get_yaxis().tick_left() + +yticks(fontsize=32) +xticks(fontsize=32) + +# Provide tick lines across the plot to help your viewers trace along +# the axis ticks. Make sure that the lines are light and small so they +# don't obscure the primary data lines. +#print xon[3], yon[3] +#plot(xon[3],int(float(yon[4]))*range(0,len(xon)), "--", lw=0.5, color="black", alpha=0.3) +for x in range(0,14,2): + plot([x]*len(range(-90,35)),range(-90,35), "--", lw=0.5, color="black", alpha=0.5) + +for y in range(-80,30,10): + plot(range(0,15), [y]*len(range(0,15)), "--", lw=0.5, color="black", alpha=0.5) + +#################################################################### +#################################################################### + +if ignore[0]==0: + #plot(xon,yon,lw=2.5,color='#0033CC',marker='^',ms=30,label='working') + scatter(xon,yon,marker='^',zorder=10,s=300,color='#0033CC',label='Up and running') +if ignore[1]==0: + #plot(xso,yso,lw=2.5,color='#CC0000',marker='s',ms=30,label='coming soon') + scatter(xso,yso,marker='s',zorder=10,s=300,color='#FF8C00',label='Deploying') +if ignore[2]==0: + #plot(xuc,yuc,lw=2.5,color='#FFFF00',marker='o',ms=30,label='under consideration') + scatter(xuc,yuc,marker='o',zorder=10,s=300,color='#CC0000',label='Planned') + + +###################################################################### +################### final tweks###################################### + + +text(7, -92, "Rigidity cutoff", fontsize=40, ha="center") +text(-1.7, -10, "Geographical Latitude", fontsize=45, ha="center",rotation='vertical') +lg = ax.legend(loc='upper left', fontsize=30,scatterpoints=1) +lg.get_frame().set_alpha(.8) # A little transparency + +os.system('rm misdatos.dat') + + +savefig("alturas3.png")#, bbox_inches="tight"); diff --git a/alturas3.png b/alturas3.png new file mode 100644 index 0000000000000000000000000000000000000000..739d91d6a5de23b37752391754621a813f592d20 Binary files /dev/null and b/alturas3.png differ diff --git a/lagoplano.png b/lagoplano.png new file mode 100644 index 0000000000000000000000000000000000000000..0ca347df024776ccd72c8d12082095fae63005fb Binary files /dev/null and b/lagoplano.png differ diff --git a/mapingLAGO/AutoMap.py b/mapingLAGO/AutoMap.py new file mode 100644 index 0000000000000000000000000000000000000000..60de1222f8fbcda4edf569c129c96efc7efb6c1a --- /dev/null +++ b/mapingLAGO/AutoMap.py @@ -0,0 +1,127 @@ +import sys,os +from mpl_toolkits.basemap import Basemap +import matplotlib.pyplot as plt +import numpy as np + +################ ignorar algun estado on,soon,uc desde el argumento ## +ignore=[0,0,0] +for j in range(0,len(sys.argv)): + if sys.argv[j]=='-uprunning': + ignore[0]=1 + if sys.argv[j]=='-ongoing': + ignore[1]=1 + if sys.argv[j]=='-planned': + ignore[2]=1 +ig=ignore[0]+ignore[1]+ignore[2] + +if ig==3: + sys.exit("ERROR--IGNORANDO TODO!!!") + +##################### define el marker y color segun el estado ####### + +def estatus(x): + status=(0,0) + if x=='uprunning': + status=('^','#0033CC') + elif x=='ongoing': + status=('s','#FF8C00') + elif x=='planned': + status=('o','#CC0000') + else: + print x + sys.exit("ERROR--ESTAUS DE SITIO NO VALIDO!!!") + return status + +################### ordena el archivo de datos por latitud####### + +os.system('python sorteador.py '+sys.argv[1]+' 2 > misdatos.dat') +files=open('misdatos.dat') + + + +#### genera mapa basico ################################################# +map = Basemap(projection='cyl',llcrnrlat=-84,urcrnrlat=33.56,llcrnrlon=-118.25,urcrnrlon=-33.56,resolution='l') +plt.figure(figsize=(13,18)) + +map.drawcoastlines(linewidth=.5) +map.drawcountries(linewidth=.5) +map.shadedrelief() +parallels = np.arange(-90.,50,10) +map.drawparallels(parallels,labels=[False,True,True,False]) +#map.drawmapboundary(fill_color = 'aqua') + +######################### grafica puntos sobre el mapa############# +lat = [] +lon = [] +yaux=0 +yaux2=0 +xaux=0 +xaux2=0 +x=0 +y=0 +cont=0 +def crosletras(y,yaux,x,xaux,lengo,i): + salida=[0,0] + xo=0 + yo=0 + + if abs(x-xaux)<8 and abs(y-yaux)<5: + #salida[0]=x-3-(2*i/10) + salida[0]=x-3-(1.5*i/10)+((abs(x-xaux)/(x-xaux))*(2-abs(x-xaux))) + else: + salida[0]=x-3-(2*i/10) + if abs(y-yaux)<5: + salida[1]=y+(5-abs(y-yaux)-2) + if abs(y-yaux)>5: + salida[1]=y-1 + return salida + +for line in files: + row = line.split(',') + if ig>0: + if ignore[0]>0 and row[4]=='uprunning': #ignora on + continue + if ignore[1]>0 and row[4]=='ongoing':#ignora soon + continue + if ignore[2]>0 and row[4]=='planned': #ingnora uc + #print row[0],ignore + continue + if row[0][0]=='#': + continue + if row[1]=='': + continue + cont+=1 + lat=float(row[2]) + lon=float(row[3]) + tatus=estatus(row[4]) # determina color y marker segun estatus + x,y = map(lon,lat) + map.scatter(x,y,marker=tatus[0],facecolor=tatus[1][0:7],s=150,zorder=10)#grafica los puntos + #print row[0], x,xaux, y,yaux + cornu=crosletras(y,yaux,x,xaux,len(row[1]),cont) + #print crosletras(y,yaux,x,xaux,len(row[1]),cont) + m=((-1)**(cont)) + plt.text(-117,13-(2.6*cont),str(cont)+' = '+row[0]+' ('+str(int(float(row[1])))+' m)',color='w',fontsize=17,zorder=10, fontweight='bold')#grafica la leyenda que numero-lugar en blanco a la derecha + if cont==5 or cont==14: + plt.text(x+(m*3.5)-((0.5+(cont/10))*m)+m*(cont/10)-1.2,y-2,str(cont),color='black',fontsize=12,zorder=15,fontweight='bold')# grafica los nuero 5 y 14 mas cerca de los marker esto tal vez de ba quitarse ############### + continue + + plt.text(x+(m*3)-((0.5+(cont/10))*m)+m*(cont/10)-1.2,y-0.5,str(cont),color='black',fontsize=12,zorder=15,fontweight='bold')# grafica numeros impares a la izquierda del marker y pares a la derecha + +##################### genera etiquetas para la leyenda superior sobre los puntos############################## +xi=23 +yi=23 +xi,yi=map(lon,lat) +if ignore[0]==0: + plt.scatter(xi,yi,marker='^',s=200,color='#0033CC',label='Up and running') +if ignore[2]==0: + plt.scatter(xi,yi,marker='s',s=200,color='#FF8C00',label='Deploying') +if ignore[1]==0: + plt.scatter(xi,yi,marker='o',s=200,color='#CC0000',label='Planned') +lg = plt.legend(loc='upper right', fontsize=26,scatterpoints=1) +lg.get_frame().set_alpha(.8) # A little transparency + + +os.system("rm misdatos.dat") +plt.savefig('lagoplano.png',dpi=300,bbox_inches='tight', pad_inches = 0) + +#plt.show() diff --git a/sorteador.py b/sorteador.py new file mode 100644 index 0000000000000000000000000000000000000000..2420e1118e3e44275f74a34459870471ce8bfb85 --- /dev/null +++ b/sorteador.py @@ -0,0 +1,16 @@ +import sys +larg=0 +l=0 +lats=[] +file=open(sys.argv[1]) +for line in file: + row = line.split(',') + fin = len(row) + if row[0][0]=='#': + continue + lats.append((row[0],float(row[1]),float(row[2]),float(row[3]),row[4],float(row[5]),float(row[6]),float(row[7]))) + larg+=1 + +array=sorted(lats, key=lambda lat: lat[int(sys.argv[2])]) +for i in range(0,len(array)): + print str(array[i][0])+','+str(array[i][1])+','+str(array[i][2])+','+str(array[i][3])+','+str(array[i][4])+','+str(array[i][5])+','+str(array[i][6])+','+str(array[i][7])+','