diff --git a/modules/util/infer_cloud_fraction.py b/modules/util/infer_cloud_fraction.py index de1c1af329047cd3b9ea8a801676025c999f8ccf..6896e948af517910e10ce6ef1f9bac0da099b1d0 100644 --- a/modules/util/infer_cloud_fraction.py +++ b/modules/util/infer_cloud_fraction.py @@ -1,7 +1,7 @@ from util.setup_cloud_fraction import model_path from aeolus.datasource import CLAVRx import os -from deeplearning.cloud_fraction_fcn_abi import run_evaluate_static, run_evaluate_static_full_disk +from deeplearning.cloud_fraction_fcn_abi import SRCNN, run_evaluate_static, run_evaluate_static_full_disk def infer_cloud_fraction(clvrx_path, output_dir, full_disk=True): @@ -17,3 +17,21 @@ def infer_cloud_fraction(clvrx_path, output_dir, full_disk=True): run_evaluate_static_full_disk(fname, out_file, ckpt_dir) else: run_evaluate_static(fname, out_file, ckpt_dir) + + +def infer_cloud_fraction_new(clvrx_path, output_dir, full_disk=True): + ckpt_dir_s = os.listdir(model_path) + ckpt_dir = model_path + ckpt_dir_s[0] + + nn = SRCNN() + nn.setup_inference(ckpt_dir) + + clvrx_ds = CLAVRx(clvrx_path) + for fname, t_start, t_stop in clvrx_ds: + dto = clvrx_ds.get_datetime(fname) + clvrx_str_time = dto.strftime('%Y-%m-%d_%H:%M') + out_file = output_dir + 'cloud_fraction_' + clvrx_str_time + if full_disk: + run_evaluate_static_full_disk(fname, out_file, ckpt_dir) + else: + nn.run_inference(fname, out_file) \ No newline at end of file