From 0d689e745b620b73ae8777701b871d9fed6f8dd5 Mon Sep 17 00:00:00 2001 From: tangchao0503 <735056338@qq.com> Date: Thu, 14 Dec 2023 19:05:07 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20=EF=BC=881=EF=BC=89=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E8=AF=BB=E5=8F=96=E6=9C=89=E8=AF=AF=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=8D=EF=BC=9B=20=EF=BC=882=EF=BC=89doas=E7=AE=97?= =?UTF-8?q?=E6=B3=95=E8=AE=A1=E7=AE=97=E8=BF=87=E7=A8=8B=E4=B8=AD=E8=B4=9F?= =?UTF-8?q?=E5=80=BC=E7=BD=AE=E9=9B=B6=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 +++- sif_methods.py | 4 ++++ sif_retrieval.py | 18 +++++++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 09b3c4a..65249d5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ # 唐超添加 /.idea - +/problem +/sample_data +/paper # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/sif_methods.py b/sif_methods.py index 215ade8..87fd113 100644 --- a/sif_methods.py +++ b/sif_methods.py @@ -237,6 +237,10 @@ def doas(data,wl_range,band=760): print(data.Measures[i].values) sky_spec = data.sky[i].values veg_spec = data.veg[i].values + + veg_spec[np.where(veg_spec < 0)] = 0 + sky_spec[np.where(sky_spec < 0)] = 0 + _X = np.concatenate([_ref_base,(_hf/(veg_spec+0.000001111)).reshape(1,-1)]).T _y = np.log(veg_spec+0.000001111) - np.log(sky_spec+0.00000111111) _B = np.linalg.lstsq(_X,_y,rcond=-1) diff --git a/sif_retrieval.py b/sif_retrieval.py index b29f3ce..6ffd786 100644 --- a/sif_retrieval.py +++ b/sif_retrieval.py @@ -123,11 +123,19 @@ def map_files(f): ''' 遍历文件 ''' - dt = pd.to_datetime(f.split('\\')[-1][:-4], format='%Y_%m_%d_%H_%M_%S') - data = read_files(f) - data = data_parser(data, dt) - # par_ls.append(par) - return data # data是列表:第一个是光谱数据,第二个是元信息 + try: + dt = pd.to_datetime(f.split('\\')[-1][:-4], format='%Y_%m_%d_%H_%M_%S') + data = read_files(f) # 每个list都是一个np数组 + data = data_parser(data, dt) + except Exception as e: + print("Reading error: %s" % f) + else: # 如果打开没有出错 + # par_ls.append(par) + return data # data是列表:第一个是光谱数据,第二个是元信息 + finally: + pass + + # def map_files(i): # result = i * i