# temp_monitor **Repository Path**: mseeworld/temp_monitor ## Basic Information - **Project Name**: temp_monitor - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-06-07 - **Last Updated**: 2025-06-07 ## 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个。