bug fix
This commit is contained in:
parent
621fe49131
commit
77b9e5146a
10
main.py
10
main.py
|
@ -6,7 +6,7 @@ import glob
|
|||
from read_par_data import trans2csv
|
||||
from logzero import logger
|
||||
|
||||
today = dt.date(2022, 7, 23)
|
||||
today = dt.date(2022, 8, 1)
|
||||
print(today)
|
||||
_yearNum = today.year
|
||||
_monNum = today.month
|
||||
|
@ -88,7 +88,7 @@ if __name__ == "__main__":
|
|||
_dayStr = ""
|
||||
_hourStr = [f"0{x}" if x < 10 else str(x) for x in range(24)]
|
||||
_yearStr, _monStr, _dayStr = Daod.getDateStr(_yearNum, _monNum, _dayNum)
|
||||
ftp_filePath = "/pub/himawari/L2/PAR/010" + "/" + _yearStr + _monStr + "/" + _dayStr + "/"
|
||||
ftp_filePath = "/pub/himawari/L2/PAR/020" + "/" + _yearStr + _monStr + "/" + _dayStr + "/"
|
||||
dst_filePath = dst_filePath_root + "/" + dt.datetime.strftime(today, '%Y-%m-%d')
|
||||
Download_Path = dst_filePath + "/PAR_Minutes_Download"
|
||||
if not os.path.exists(Download_Path):
|
||||
|
@ -101,14 +101,16 @@ if __name__ == "__main__":
|
|||
# if not os.path.exists(Analysis_Path):
|
||||
# os.makedirs(Analysis_Path)
|
||||
data_list = glob.glob(Download_Path + "\\*.nc")
|
||||
|
||||
logger.info(data_list)
|
||||
try:
|
||||
trans2csv(data_list)
|
||||
date_df = trans2csv(data_list)
|
||||
date_df.to_csv(f'./{Download_Path}/{_yearStr}-{_monStr}-{_dayStr}PAR.csv', encoding='utf-8-sig',
|
||||
index=False)
|
||||
Daod.deleteFile(Download_Path, '.nc')
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
logger.error(Download_Path)
|
||||
|
||||
today = today + dt.timedelta(days=1)
|
||||
else:
|
||||
logger.error("选择错误!")
|
||||
|
|
|
@ -8,7 +8,6 @@ target_lat = ['29.6', '28.8']
|
|||
|
||||
|
||||
def trans2csv(file_list):
|
||||
date = ""
|
||||
file_list.sort()
|
||||
par_list = []
|
||||
cols = []
|
||||
|
@ -16,7 +15,6 @@ def trans2csv(file_list):
|
|||
logger.info(file_name)
|
||||
try:
|
||||
file = file_name.split('\\')[1]
|
||||
date = file_name.split('/')[2]
|
||||
date_time = file.split('_')[1] + ' ' + file.split('_')[2]
|
||||
print(date_time)
|
||||
nc_data = nc.Dataset(file_name)
|
||||
|
@ -40,4 +38,4 @@ def trans2csv(file_list):
|
|||
logger.info(e)
|
||||
continue
|
||||
date_df = pd.DataFrame.from_records(par_list, columns=['time', 'lat'] + cols)
|
||||
date_df.to_csv(f'./data/{date}/PAR.csv', encoding='utf-8-sig', index=False)
|
||||
return date_df
|
Loading…
Reference in New Issue