Skip to content
Snippets Groups Projects
Commit c018caf9 authored by Paolo Veglio's avatar Paolo Veglio
Browse files

Surface_Temperature_Test roughly implemented. code runs but function and...

Surface_Temperature_Test roughly implemented. code runs but function and implementation need to be polished... a lot
parent c7993f61
No related branches found
No related tags found
No related merge requests found
...@@ -98,7 +98,7 @@ def main(*, data_path=_datapath, mod02=_fname_mod02, mod03=_fname_mod03, ...@@ -98,7 +98,7 @@ def main(*, data_path=_datapath, mod02=_fname_mod02, mod03=_fname_mod03,
perform = {'11um BT Test': False, perform = {'11um BT Test': False,
'CO2 High Clouds Test': False, 'CO2 High Clouds Test': False,
'Water Vapor High Clouds Test': False, 'Water Vapor High Clouds Test': False,
'Surface Temperature Test': False, 'Surface Temperature Test': True,
'SST Test': False, 'SST Test': False,
'8.6-11um BT Difference Test': False, '8.6-11um BT Difference Test': False,
'11-12um BTD Thin Cirrus Test': False, '11-12um BTD Thin Cirrus Test': False,
...@@ -107,7 +107,7 @@ def main(*, data_path=_datapath, mod02=_fname_mod02, mod03=_fname_mod03, ...@@ -107,7 +107,7 @@ def main(*, data_path=_datapath, mod02=_fname_mod02, mod03=_fname_mod03,
'Water Vapor Cloud Test': False, 'Water Vapor Cloud Test': False,
'11um BT Variability Test': False, '11um BT Variability Test': False,
'11-4um BTD Oceanic Stratus': False, '11-4um BTD Oceanic Stratus': False,
'NIR Reflectance Test': True, 'NIR Reflectance Test': False,
'Vis/NIR Ratio Test': False, 'Vis/NIR Ratio Test': False,
'1.6um or 2.1um NIR Reflectance Test': False, '1.6um or 2.1um NIR Reflectance Test': False,
'Visible Reflectance Test': False, 'Visible Reflectance Test': False,
......
...@@ -105,6 +105,45 @@ def preproc_nir(data, thresholds, scene): ...@@ -105,6 +105,45 @@ def preproc_nir(data, thresholds, scene):
return corr_thr return corr_thr
def preproc_surf_temp(data, thresholds):
thr_sfc1 = thresholds['Surface_Temperature_Test_1']
thr_sfc2 = thresholds['Surface_Temperature_Test_2']
thr_df1 = thresholds['Surface_Temperature_Test_df1']
thr_df2 = thresholds['Surface_Temperature_Test_df2']
max_vza = 70.13 # This values is set based on sensor. Check mask_processing_constants.h for MODIS value
rs = np.prod(data.M15.shape)
df1 = (data.M15 - data.M16).values.reshape(rs)
df2 = (data.M15 - data.M13).values.reshape(rs)
desert_flag = data.Desert.values.reshape(rs)
thresh = np.ones((rs, )) * thr_sfc1
idx = np.where((df1 >= thr_df1[0]) | ((df1 < thr_df1[0]) & ((df2 <= thr_df2[0]) | (df2 >= thr_df2[1]))))
thresh[idx] = thr_sfc2
idx = np.where(desert_flag == 1)
thresh[idx] == thr_sfc1
midpt = thresh
idx = np.where(df1 >= thr_df1[1])
midpt[idx] = thresh[idx] + 2.0*df1[idx]
corr = np.power(data.sensor_zenith.values/max_vza, 4) * 3.0
midpt = midpt.reshape(corr.shape) + corr
locut = midpt + 2.0
hicut = midpt - 2.0
thr_out = xr.DataArray(data=np.dstack((locut, midpt, hicut, np.ones(locut.shape), np.ones(locut.shape))),
dims=('number_of_lines', 'number_of_pixels', 'z'))
return thr_out
def get_b1_thresholds():
# fill_ndvi[0] is for fill_ndvi1
# fill_ndvi[1] is for fill_ndvi2
pass
# NOTE: 11-12um Cirrus Test # NOTE: 11-12um Cirrus Test
# hicut is computed in different ways depending on the scene # hicut is computed in different ways depending on the scene
# 1. midpt - adj # 1. midpt - adj
......
...@@ -8,6 +8,11 @@ import conf ...@@ -8,6 +8,11 @@ import conf
import conf_xr import conf_xr
import preprocess_thresholds as pt import preprocess_thresholds as pt
import importlib
# this is used for testing, eventually we want to remove it
importlib.reload(pt)
# ############## GROUP 1 TESTS ############## # # ############## GROUP 1 TESTS ############## #
...@@ -266,7 +271,9 @@ class CloudTests: ...@@ -266,7 +271,9 @@ class CloudTests:
thr_xr['threshold'] = pt.preproc(self.data, self.thresholds[self.scene_name]) thr_xr['threshold'] = pt.preproc(self.data, self.thresholds[self.scene_name])
thr = np.ones((5,)) # This is only temporary to force the logic of the code thr = np.ones((5,)) # This is only temporary to force the logic of the code
# I need to find a better solution at some point # I need to find a better solution at some point
elif test_name == 'Surface_Temperature_Test':
thr_xr['threshold'] = pt.preproc_surf_temp(self.data, self.thresholds[self.scene_name])
thr = np.ones((5,))
elif test_name == 'SST_Test': elif test_name == 'SST_Test':
thr_xr['threshold'] = (('number_of_lines', 'number_of_pixels', 'z'), thr_xr['threshold'] = (('number_of_lines', 'number_of_pixels', 'z'),
np.ones((self.data[band].shape[0], self.data[band].shape[1], 5))*thr) np.ones((self.data[band].shape[0], self.data[band].shape[1], 5))*thr)
......
...@@ -179,7 +179,13 @@ Polar_Night_Land: ...@@ -179,7 +179,13 @@ Polar_Night_Land:
adj: [] # I NEED TO WORK ON THIS adj: [] # I NEED TO WORK ON THIS
pnlbt1 : 270.0 pnlbt1 : 270.0
pnlbt2 : 270.0 pnlbt2 : 270.0
Surface_Temperature_Test_pfm: 1.0 Surface_Temperature_Test_df1: [0.0, 1.0]
Surface_Temperature_Test_df2: [-0.5, 1.0]
Surface_Temperature_Test_difference: [-0.2, 1.0, -0.5, 1.0] # <- this merges the previous two arrays
Surface_Temperature_Test_1: 20.0 # | might be worth figuring out if we can
Surface_Temperature_Test_2: 12.0 # | merge these three coefficients
Surface_Temperature_Test_pfm: 1.0 # __|
Surface_Temperature_Test: [20.0, 12.0, 1.0] # <- First attempt to merge the three values above
pnl_11_4_pfm : 1.0 pnl_11_4_pfm : 1.0
pnl_7_11_pfm : 1.0 pnl_7_11_pfm : 1.0
pnl_4_12_pfm : 1.0 pnl_4_12_pfm : 1.0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment