地震台站形变数据监控报警软件
Posted iceberg710815
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了地震台站形变数据监控报警软件相关的知识,希望对你有一定的参考价值。
地震形变监测仪器常常因降雨等原因,产生限幅,需要人工干预进行调零。因没有自动报警监控软件,影响监测数据的连续率。
利用python开发了这个小软件,实现了水管仪,伸缩仪,垂直摆等3类形变监测数据监控功能,数据限幅会自动报警,台站应用
此软件可提高形变数据的连续率。
import requests import winsound import time import re import tkinter as tk # import threading import os import sys from PIL import Image, ImageTk def alarm(): while True: winsound.PlaySound(‘alarm.wav‘, winsound.SND_FILENAME) def refresh_data(): global window,chVarStrain,chVarWaterpipe,chVarPendulum # 伸缩仪界面设计 if chVarStrain.get() == 1: # print(‘伸缩仪被选中了!‘) label1 = tk.Label(window, text = ‘伸缩仪北南向:‘, font = (‘微软雅黑‘, 15)) label1.place(x=20, y=30, anchor=‘nw‘) ns, ew = getStrain() anno_ns = tk.StringVar() anno_ns.set(ns) ns_entry = tk.Entry(window, font = (‘微软雅黑‘, 15), width = 10, textvariable = anno_ns, bg = ‘white‘) ns_entry.place(x=170, y=30, anchor=‘nw‘) label2 = tk.Label(window, text = ‘伸缩仪东西向:‘, font = (‘微软雅黑‘, 15)) label2.place(x=270, y=30, anchor=‘nw‘) anno_ew = tk.StringVar() anno_ew.set(ew) ew_entry = tk.Entry(window, font = (‘微软雅黑‘, 15), width = 10, textvariable = anno_ew, bg = ‘white‘) ew_entry.place(x=430, y=30, anchor=‘nw‘) else: label1 = tk.Label(window, text = ‘伸缩仪北南向:‘, font = (‘微软雅黑‘, 15)) label1.place(x=20, y=30, anchor=‘nw‘) ns=0 ew=0 anno_ns = tk.StringVar() anno_ns.set(ns) ns_entry = tk.Entry(window, font = (‘微软雅黑‘, 15), width = 10, textvariable = anno_ns,bg = ‘red‘) ns_entry.place(x=170, y=30, anchor=‘nw‘) label2 = tk.Label(window, text = ‘伸缩仪东西向:‘, font = (‘微软雅黑‘, 15)) label2.place(x=270, y=30, anchor=‘nw‘) anno_ew = tk.StringVar() anno_ew.set(ew) ew_entry = tk.Entry(window, font = (‘微软雅黑‘, 15), width = 10, textvariable = anno_ew, bg = ‘red‘) ew_entry.place(x=430, y=30, anchor=‘nw‘) #水管仪界面设计 if chVarWaterpipe.get() == 1: label3 = tk.Label(window, text=‘水管仪北端:‘, font=(‘微软雅黑‘, 15)) label3.place(x=20, y=90, anchor=‘nw‘) n,s,e,w = getWaterpipe() anno_ns = tk.StringVar() anno_ns.set(n) ns_entry = tk.Entry(window, font=(‘微软雅黑‘, 15), width=10, textvariable=anno_ns, bg = ‘white‘) ns_entry.place(x=170, y=90, anchor=‘nw‘) label4 = tk.Label(window, text=‘水管仪东端:‘, font=(‘微软雅黑‘, 15)) label4.place(x=270, y=90, anchor=‘nw‘) anno_ew = tk.StringVar() anno_ew.set(s) ew_entry = tk.Entry(window, font=(‘微软雅黑‘, 15), width=10, textvariable=anno_ew, bg = ‘white‘) ew_entry.place(x=430, y=90, anchor=‘nw‘) else: label3 = tk.Label(window, text=‘水管仪北端:‘, font=(‘微软雅黑‘, 15)) label3.place(x=20, y=90, anchor=‘nw‘) n=0 s=0 e=0 w=0 anno_ns = tk.StringVar() anno_ns.set(n) ns_entry = tk.Entry(window, font=(‘微软雅黑‘, 15), width=10, textvariable=anno_ns, bg = ‘red‘) ns_entry.place(x=170, y=90, anchor=‘nw‘) label4 = tk.Label(window, text=‘水管仪东端:‘, font=(‘微软雅黑‘, 15)) label4.place(x=270, y=90, anchor=‘nw‘) anno_ew = tk.StringVar() anno_ew.set(s) ew_entry = tk.Entry(window, font=(‘微软雅黑‘, 15), width=10, textvariable=anno_ew, bg = ‘red‘) ew_entry.place(x=430, y=90, anchor=‘nw‘) #垂直摆界面设计 if chVarPendulum.get() == 1: label5 = tk.Label(window, text=‘垂直摆北南:‘, font=(‘微软雅黑‘, 15)) label5.place(x=20, y=150, anchor=‘nw‘) n,s = getPendulum() anno_ns = tk.StringVar() anno_ns.set(n) ns_entry = tk.Entry(window, font=(‘微软雅黑‘, 15), width=10, textvariable=anno_ns, bg = ‘white‘) ns_entry.place(x=170, y=150, anchor=‘nw‘) label6 = tk.Label(window, text=‘垂直摆东西端:‘, font=(‘微软雅黑‘, 15)) label6.place(x=270, y=150, anchor=‘nw‘) anno_ew = tk.StringVar() anno_ew.set(s) ew_entry = tk.Entry(window, font=(‘微软雅黑‘, 15), width=10, textvariable=anno_ew, bg = ‘white‘) ew_entry.place(x=430, y=150, anchor=‘nw‘) else: label5 = tk.Label(window, text=‘垂直摆北南:‘, font=(‘微软雅黑‘, 15)) label5.place(x=20, y=150, anchor=‘nw‘) n = 0 s = 0 anno_ns = tk.StringVar() anno_ns.set(n) ns_entry = tk.Entry(window, font=(‘微软雅黑‘, 15), width=10, textvariable=anno_ns, bg = ‘red‘) ns_entry.place(x=170, y=150, anchor=‘nw‘) label6 = tk.Label(window, text=‘垂直摆东西端:‘, font=(‘微软雅黑‘, 15)) label6.place(x=270, y=150, anchor=‘nw‘) anno_ew = tk.StringVar() anno_ew.set(s) ew_entry = tk.Entry(window, font=(‘微软雅黑‘, 15), width=10, textvariable=anno_ew, bg = ‘red‘) ew_entry.place(x=430, y=150, anchor=‘nw‘) load = Image.open(‘logo2.png‘) # 插入图片 render = ImageTk.PhotoImage(load) img = tk.Label(window, image=render) img.image = render img.place(x=360, y=200, anchor = ‘nw‘) window.after(20000,func = refresh_data) def getWaterpipe(): tilt_url = ‘http://10.22.114.31/realtime.cgi‘ try: response = requests.get(tilt_url, timeout = 60) except: return (0, 0, 0, 0) res = re.compile(r‘</font><b><font color="#3333FF" size="6">(.*?)mV</font>‘) ns = re.findall(res, response.text) # 返回真正的视频文件的下载地址 res = re.compile(r‘<b>(.*?)mV</b>‘) x = re.findall(res, response.text) # 返回真正的视频文件的下载地址 ns.append(x[0]) if abs(eval(ns[0])) >= 2000 or abs(eval(ns[1])) >= 2000 or abs(eval(ns[2])) >= 2000 or abs(eval(ns[3])) >= 2000: alarm() print(‘水管仪:‘,(ns[0],ns[1],ns[2],ns[3])) return(ns[0],ns[1],ns[2],ns[3]) def getPendulum(): tilt_url = ‘http://10.22.114.34/cgi-bin/realtime.cgi‘ try: response = requests.get(tilt_url, timeout = 60) except: return (0, 0) res = re.compile(r‘>(.*?)mV<‘) ns = re.findall(res, response.text) # 返回真正的视频文件的下载地址 ns[0] = ns[0].split(‘>‘)[-1] ns[1] = ns[1].split(‘>‘)[-1] if abs(eval(ns[0])) >= 2500 or abs(eval(ns[1])) >= 2500: alarm() print(‘垂直摆:‘,(ns[0],ns[1])) return(ns[0],ns[1]) def getStrain(): while True: tilt_url = ‘http://10.22.114.32/realtime.cgi‘ try: response = requests.get(tilt_url, timeout = 60) except: return(0, 0) res = re.compile(r‘>(.*?)mV<‘) ns = re.findall(res, response.text) # 返回真正的视频文件的下载地址 ns[0] = ns[0].split(‘>‘)[-1] ns[1] = ns[1].split(‘>‘)[-1] if abs(eval(ns[0])) >= 2000 or abs(eval(ns[1])) >= 2000: alarm() print(‘伸缩仪:‘,(ns[0],ns[1])) return(ns[0],ns[1]) def main(): global window, chVarWaterpipe, chVarStrain, chVarPendulum window = tk.Tk() window.title(‘形变数据监控软件V2.0 Copyright © 吉林省长白山天池火山监测站 2020-05-24‘) window.geometry(‘600x400‘) lab = tk.Label(window, font=(‘微软雅黑‘, 15), width=10,text=‘报警测项:‘) lab.place(x=20,y=210,anchor=‘nw‘) frm = tk.Frame(window) chVarWaterpipe = tk.IntVar() ck1 = tk.Checkbutton(frm,text=‘水管仪‘,font=(‘微软雅黑‘, 15), width=10,variable = chVarWaterpipe) chVarStrain = tk.IntVar() ck2 = tk.Checkbutton(frm,text=‘伸缩仪‘,font=(‘微软雅黑‘, 15), width=10,variable = chVarStrain) chVarPendulum = tk.IntVar() ck3 = tk.Checkbutton(frm,text=‘垂直摆‘,font=(‘微软雅黑‘, 15), width=10,variable = chVarPendulum) ck1.grid(row = 0, column =1) ck2.grid(row = 1, column =1) ck3.grid(row = 2, column =1) frm.place(x=200,y=210,anchor=‘nw‘) # 定义开始监测按钮 sure = tk.Button(window, text = ‘开始监控‘, font=(‘微软雅黑‘, 15),width = 10, command = refresh_data) sure.place(x = 20, y = 270, anchor = ‘nw‘) calculate = tk.Button(window, text=‘结束运行‘, font=(‘微软雅黑‘, 15),width = 10, command= window.quit) calculate.place(x=20, y=330, anchor=‘nw‘) window.mainloop() main() # main()
以上是关于地震台站形变数据监控报警软件的主要内容,如果未能解决你的问题,请参考以下文章
梦想云油田专业软件SocketExplorer3D:地震勘探开发数据三维及四维网络可视化解决方案
Parallel Geoscience Seismic Processing Workshop(SPW) v2.2.12地震数据处理