Skip to content
Snippets Groups Projects
Commit cfad92c9 authored by tomrink's avatar tomrink
Browse files

snaphot...

parent 4dad174d
No related branches found
No related tags found
No related merge requests found
import glob
import tensorflow as tf
from util.setup import logdir, modeldir, cachepath, now, ancillary_path
from util.util import EarlyStop, normalize, denormalize, resample
from util.util import EarlyStop, normalize, denormalize, resample, get_grid_values_all
import os, datetime
import numpy as np
import pickle
......@@ -49,13 +49,13 @@ mean_std_dct.update(mean_std_dct_l2)
# emis_params = ['temp_10_4um_nom', 'temp_11_0um_nom', 'temp_12_0um_nom', 'temp_13_3um_nom', 'temp_3_75um_nom',
# 'temp_6_7um_nom', 'temp_6_2um_nom', 'temp_7_3um_nom', 'temp_8_5um_nom', 'temp_9_7um_nom']
data_params = ['refl_0_65um_nom', 'temp_11_0um_nom', 'cld_temp_acha', 'cld_press_acha', 'cloud_fraction']
label_params = ['refl_0_65um_nom', 'temp_11_0um_nom', 'cld_temp_acha', 'cld_press_acha', 'cloud_fraction']
data_params = ['temp_11_0um_nom', 'temp_12_0um_nom', 'cld_temp_acha', 'cld_press_acha']
label_params = ['temp_11_0um_nom', 'temp_12_0um_nom', 'cld_temp_acha', 'cld_press_acha']
DO_ZERO_OUT = False
data_idx, label_idx = 4, 4
data_idx, label_idx = 0, 0
data_param = data_params[data_idx]
label_param = label_params[label_idx]
print(data_param+', '+label_param)
......@@ -603,8 +603,8 @@ class SRCNN:
ckpt.restore(ckpt_manager.latest_checkpoint)
data = normalize(nda_lr, param, mean_std_dct)
#data = np.expand_dims(data, axis=0)
#data = np.expand_dims(data, axis=3)
data = np.expand_dims(data, axis=0)
data = np.expand_dims(data, axis=3)
self.reset_test_metrics()
......@@ -668,6 +668,24 @@ def run_evaluate_static(in_file, out_file, ckpt_dir):
return out_sr
def run_evaluate_static_new(in_file, out_file, ckpt_dir):
nda = np.load(in_file)
nda = nda[:, data_idx, 3:131:2, 3:131:2]
nda = resample(x_64, y_64, nda, t, s)
nda = np.expand_dims(nda, axis=3)
h5f = h5py.File(in_file, 'r')
grd = get_grid_values_all(h5f, data_param)
nn = SRCNN()
out_sr = nn.run_evaluate(grd, data_param, ckpt_dir)
if out_file is not None:
np.save(out_file, out_sr)
else:
return out_sr
if __name__ == "__main__":
nn = SRCNN()
nn.run('matchup_filename')
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