From 8b1669ad23927e264b8b4531ac562847e3976a97 Mon Sep 17 00:00:00 2001 From: esea_info Date: Wed, 19 Apr 2023 18:42:24 +0800 Subject: [PATCH] bugfix awrams.py --- awrams.py | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/awrams.py b/awrams.py index f813241..73c94f2 100644 --- a/awrams.py +++ b/awrams.py @@ -518,12 +518,12 @@ class AWRAMS(object): self.getAvg( self.intensity_before_avg ) # 波长插值 self.res esky lsky lw self.__do_sensor_dict_interpo() - # 获得输出目录路径 self.ymdhms + # 获得输出文件名 self.ymdhms self.get_ymdhms() # get Lw Rs self.getLwRs() # 设置保存路径 self.output_path - self.get_save_csv_path() + self.get_output_path(1) # 保存 data info self.saveOnefileForLskyEskyLwaterLwRS() # 通知ui @@ -554,7 +554,7 @@ class AWRAMS(object): # + str(self.info_dict['hour']) + '_' \ # + str(self.info_dict['minute']) + '_' \ # + str(self.info_dict['second']) - self.output_path = self.output_path.joinpath( self.ymdhms ) + # self.output_path = self.output_path.joinpath( self.ymdhms ) log.debug(f"current_measure_time: {self.current_measure_time}", __name__, "dealOneMeasurement") # 读取buf self.hhb.readFile2Buf(fpath) @@ -566,10 +566,12 @@ class AWRAMS(object): self.getAvg( self.intensity_before_avg ) # 波长插值 self.res esky lsky lw self.__do_sensor_dict_interpo() - # 获得输出目录路径 self.ymdhms + # 获得输出文件名 self.ymdhms self.get_ymdhms() # get Lw Rs self.getLwRs() + # 设置保存路径 self.output_path SD卡 + self.get_output_path(0) # 保存 data info self.saveOnefileForLskyEskyLwaterLwRS() # 通知ui @@ -583,24 +585,14 @@ class AWRAMS(object): + f"{self.info_dict['hour']:02d}" + '_' \ + f"{self.info_dict['minute']:02d}" + '_' \ + f"{self.info_dict['second']:02d}" - # self.output_path = self.output_path.joinpath( self.ymdhms ) - # print(self.output_path) - # time.sleep(30)save_csv_path - def get_save_csv_path(self, ): - if self.mode == 0: + def get_output_path(self, mode=0): + if mode == 0: self.mydir.setBaseDir(DATA_DIR) else: self.mydir.setBaseDir(SERVER_DIR) - dir_tuple = ( "output", str(self.info_dict['year']),str(self.info_dict['month']),str(self.info_dict['day'])) - self.mydir.setDir( dir_tuple) - self.mydir.newDirIfNot() - self.mydir.newFileIfNot( self.ymdhms+SAVE_EXT_NAME) - self.output_path = self.mydir.current_filepath - - # self.output_path = self.output_path.joinpath( self.ymdhms ) - # print(self.output_path) - # time.sleep(30) + # dir_tuple = ( "output", "20"+str(self.info_dict['year']),str(self.info_dict['month']),str(self.info_dict['day'])) + self.output_path = self.mydir.current_dir.joinpath("output") def decode_sensor_buf(self,) : @@ -661,10 +653,10 @@ class AWRAMS(object): def saveOnefileForLskyEskyLwaterLwRS(self, ) -> bool: log.info(f" ", __name__, "saveOnefileForLskyEskyLwaterLwRS") - year = "20"+ f"{self.info_dict['year']:02d}" - month = f"{self.info_dict['month']:02d}" - day = f"{self.info_dict['day']:02d}" - save_path = OUTPUT_DIR.joinpath(year,month,day) + year = "20"+ f"{self.info_dict['year']:02d}" + month = f"{self.info_dict['month']:02d}" + day = f"{self.info_dict['day']:02d}" + save_path = self.output_path.joinpath(year,month,day) self.mydir.setBaseDir(save_path) #基路径 self.mydir.newDirIfNot() self.mydir.newFileIfNot(self.ymdhms + SAVE_EXT_NAME)