Skip to content

Commit

Permalink
second big commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Profesergiom committed Sep 30, 2022
1 parent 8282ba5 commit 334e64c
Show file tree
Hide file tree
Showing 21 changed files with 418 additions and 42 deletions.
15 changes: 10 additions & 5 deletions RT.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
@author: sergio.morales
"""
debug = True
mlreav=2
location='local'


from main import mainnll
import sched, time
Expand All @@ -14,11 +18,12 @@ def do_something(sc):
from datetime import datetime
fecha=datetime.now()
print(str(fecha)+ " Monitoreando eventos nuevos clasificados...")
try:
mainnll(exec_point='local',debug=False)
except:
print('algo pasó :(')
s.enter(5, 1, do_something, (sc,))
#try:
mainnll(location,debug,mlreav)
#except:
#print('algo pasó :(')
if debug==False:
s.enter(5, 1, do_something, (sc,))



Expand Down
Binary file added fonts/Roboto-Black.ttf
Binary file not shown.
Binary file added fonts/Roboto-BlackItalic.ttf
Binary file not shown.
Binary file added fonts/Roboto-Bold.ttf
Binary file not shown.
Binary file added fonts/Roboto-BoldCondensed.ttf
Binary file not shown.
Binary file added fonts/Roboto-BoldCondensedItalic.ttf
Binary file not shown.
Binary file added fonts/Roboto-BoldItalic.ttf
Binary file not shown.
Binary file added fonts/Roboto-Condensed.ttf
Binary file not shown.
Binary file added fonts/Roboto-CondensedItalic.ttf
Binary file not shown.
Binary file added fonts/Roboto-Italic.ttf
Binary file not shown.
Binary file added fonts/Roboto-Light.ttf
Binary file not shown.
Binary file added fonts/Roboto-LightItalic.ttf
Binary file not shown.
Binary file added fonts/Roboto-Medium.ttf
Binary file not shown.
Binary file added fonts/Roboto-MediumItalic.ttf
Binary file not shown.
Binary file added fonts/Roboto-Regular.ttf
Binary file not shown.
Binary file added fonts/Roboto-Thin.ttf
Binary file not shown.
Binary file added fonts/Roboto-ThinItalic.ttf
Binary file not shown.
85 changes: 52 additions & 33 deletions lib/maillib.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def send_message(service, destination, obj, body, attachments=[]):
).execute()


def sendMail(voldf,evsel):
def sendMail(voldf,evsel,tipomail,debug):
import numpy as np
#volcan=voldf.nombre_db.iloc[0]
idev = evsel.idevento.iloc[0]
Expand All @@ -117,37 +117,56 @@ def sendMail(voldf,evsel):
ML= evsel.ml.iloc[0]
volcan_real = voldf.nombre.iloc[0]
tipo = voldf.vol_tipo.iloc[0]
#lista_debug=['[email protected]','[email protected]']
lista_real = ['[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]'
]
asunto="Sismo tipo "+tipoev+" ML="+str(ML)+" "+tipo+" "+volcan_real
if debug==True:
lista=['[email protected]','[email protected]']
else:
lista = ['[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]'
]



cuerpo = """\nSismo localizado en el {tipov} {volcan}:
\nTipo Evento: {tipo}
Magnitud : {ml} (ML)
Amplitud: {amplitud} um/s (referencia)
Frecuencia: {frecuencia} Hz (Referencia)
Profundidad: {profundidad} km bajo nivel del mar
Latitud: {latitud}°
Longitud: {longitud}°
\nSe adjunta imagen correspondiente a localización con Hypo71 realizada en la sala de monitoreo y localización usando NLL en base a las fases P y S detectadas por los especialistas.
\nSaludos.
\n(Este correo es automático, no responder)
"""
cuerpo = cuerpo.format(tipo=tipoev,ml=ML,tipov=tipo,volcan=volcan_real,amplitud=amp,frecuencia=frec,profundidad=np.round(prof,1),
latitud=np.round(lat,2),longitud=np.round(lon,2))
for destino in lista_real:
if tipomail=='REAV':
asunto="PRUEBA - REAV "+tipoev+" ML="+str(ML)+" "+tipo+" "+volcan_real+" - PRUEBA"
cuerpo = """\nSismo localizado en el {tipov} {volcan}:
\nTipo Evento: {tipo}
Magnitud : {ml} (ML)
Amplitud: {amplitud} um/s (referencia)
Frecuencia: {frecuencia} Hz (Referencia)
Profundidad: {profundidad} km bajo nivel del mar
Latitud: {latitud}°
Longitud: {longitud}°
\nSe adjunta Propuesta de REAV.
\nSaludos.
\n(Este correo es automático, no responder)
"""
cuerpo = cuerpo.format(tipo=tipoev,ml=ML,tipov=tipo,volcan=volcan_real,amplitud=amp,frecuencia=frec,profundidad=np.round(prof,1),
latitud=np.round(lat,2),longitud=np.round(lon,2))
elif tipomail=='normal':
asunto="Sismo tipo "+tipoev+" ML="+str(ML)+" "+tipo+" "+volcan_real
cuerpo = """\nSismo localizado en el {tipov} {volcan}:
\nTipo Evento: {tipo}
Magnitud : {ml} (ML)
Amplitud: {amplitud} um/s (referencia)
Frecuencia: {frecuencia} Hz (Referencia)
Profundidad: {profundidad} km bajo nivel del mar
Latitud: {latitud}°
Longitud: {longitud}°
\nSe adjunta imagen correspondiente a localización con Hypo71 realizada en la sala de monitoreo y localización usando NLL en base a las fases P y S detectadas por los especialistas.
\nSaludos.
\n(Este correo es automático, no responder)
"""
cuerpo = cuerpo.format(tipo=tipoev,ml=ML,tipov=tipo,volcan=volcan_real,amplitud=amp,frecuencia=frec,profundidad=np.round(prof,1),
latitud=np.round(lat,2),longitud=np.round(lon,2))
for destino in lista:
print(destino)
send_message(gmail_authenticate(), destino, asunto,cuerpo,['figs/loc_'+str(idev)+'.jpg'])
send_message(gmail_authenticate(), destino, asunto,cuerpo,['figs/loc_'+str(idev)+'.jpg'])
Loading

0 comments on commit 334e64c

Please sign in to comment.