# temperature_monitor **Repository Path**: mseeworld/temperature_monitor ## Basic Information - **Project Name**: temperature_monitor - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-07-15 - **Last Updated**: 2025-07-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 创建python虚拟环境 conda create -n temp_monitor python=3.8 # 提示词 相机温度信息监控:定时每10分钟采集50台相机的温度信息,并在网页上显示温度变化曲线。 用python 3.8 flask实现web服务 ## 采集方案如下: 1. 温度信息存放在观测fits图像中 2. 定时每10分钟从每台服务器上的当天观测目录寻找最新的观测图像,然后复制到本地, 3. 如果最新的观测图像已经复制,或最新的观测图像没更新(相机停止观测),则不复制到本地 4. 本地存储目录的命名:根目录为/data/work/data/temp_monitor,然后创建子目录【日期/相机名称】 5. 相机名称:G+3位相机编号,相机编号从文件/data/workspace/hostip中读取,hostip中存储的为2~3位整数 6. 当天观测目录的命名:使用函数getTodayStorePathBySearch返回的字符串 7. 温度读取:在这里,所有fits图像的后缀为fit。对每幅图像,读取文件头中的TEMPSET、TEMPACT、DATE-OBS、TIME-OBS四个参数,分别代表相机的设置温度,实际温度,观测日期和观测时间。 8. 温度存储为json文件,存储路径为[根目录/日期/日期_temp.json] 9. 服务器访问方法:服务器的用户名和密码分别为gwac和gwac1234,IP为172.28.2.相机编号 ## 网页显示方案如下: 网页包含两个部分:历史温度列表和一个观测日的温度曲线显示。 历史温度列表:以列表显示根目录下所有观测日的温度监控列表,列信息包括日期,相机总数,温度故障相机数目,详细按钮(点击显示该观测日的所有相机的温度随时间的变化曲线) 一个观测日的温度曲线显示:从上到下分别显示所有相机的温度随时间的变化曲线,每个相机绘制一幅图像,每个图像包括TEMPSET、TEMPACT随时间的变化曲线。 def getCurrentDayStr(): current_utc = datetime.datetime.now(datetime.timezone.utc) current_date_str = current_utc.strftime('%y%m%d') return current_date_str def getTodayStorePathBySearch(rootPath): todayStorePath = "" startObs = False templateFileName = "G005_054_241019" templateFileNameLen = len(templateFileName) templateFileNameSplitNum = len(templateFileName.split("_")) dirPool = [rootPath] curDateStr = getCurrentDayStr() for trootDir in dirPool: if not os.path.exists(trootDir): continue obsDays = os.listdir(trootDir) for obsDay in obsDays: if obsDay.find(curDateStr)>0 and len(obsDay) == templateFileNameLen and len(obsDay.split("_")) == templateFileNameSplitNum: todayStorePath = "%s/%s"%(trootDir, obsDay) startObs = True break if startObs: break return startObs, todayStorePath # 提示词修改 _get_remote_today_path功能修改: 1,ssh没有定义; 2,获取远程服务器当天观测目录功能实现不正确,应该在/data目录下调用getTodayStorePathBySearch,todayStorePath即为当天观测目录。 _read_temperature功能修改:对*.fit和*.fit.fz的文件头读取方式不一样,*.fit读取第0个,*.fit.fz读取第1个。 3.目前的温度曲线只显示1个相机,我要把所有读取到的相机温度参数按照不同相机名称都画一个温度曲线 4.北京时间上午8点前程序不读取当天文件夹而是读取前一天的文件夹 5.当TEMPSET的温度减去TEMPACT的温度,差值的绝对值在5°以上的相机标为故障相机 123456 # 服务部署 在gwac-41TB服务器上部署为服务temp_monitor,路径/etc/systemd/system sudo service temp_monitor start sudo service temp_monitor restart sudo service temp_monitor stop # 适配nginx 该项目在nginx上,由 http://172.28.2.115:5000/映射为/temp-monitor/,导致页面依赖的一些静态或动态资源请求失败。请对项目的路由或链接进行重新设计,适配nginx的映射,同时保留本地直接访问http://127.0.0.1:5000/的能力。 # git push时使用指定的public key ssh-keygen -t rsa -C "yxu@nao.cas.cn" -f ~/.ssh/id_rsa_gitee3 GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_gitee3" git push gitee master