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

snapshot...

parent ecc3efad
No related branches found
No related tags found
No related merge requests found
...@@ -4,14 +4,12 @@ import subprocess ...@@ -4,14 +4,12 @@ import subprocess
import os, datetime import os, datetime
import numpy as np import numpy as np
import xarray as xr
import pickle import pickle
import h5py import h5py
from deeplearning.amv_raob import get_bounding_gfs_files, convert_file, get_images, get_interpolated_profile, get_time_tuple_utc, get_profile from deeplearning.amv_raob import get_bounding_gfs_files, convert_file, get_images, get_interpolated_profile, get_time_tuple_utc, get_profile
from icing.pirep_goes import split_data from icing.pirep_goes import split_data, normalize
from icing.pirep_goes import train_params_day
LOG_DEVICE_PLACEMENT = False LOG_DEVICE_PLACEMENT = False
...@@ -49,8 +47,10 @@ img_width = 16 ...@@ -49,8 +47,10 @@ img_width = 16
#img_width = 12 #img_width = 12
#img_width = 6 #img_width = 6
NUM_VERT_LEVELS = 26
NUM_VERT_PARAMS = 2 train_params_day = ['cld_height_acha', 'cld_geo_thick', 'supercooled_cloud_fraction', 'cld_temp_acha', 'cld_press_acha',
'cld_reff_dcomp', 'cld_opd_dcomp', 'cld_cwp_dcomp', 'iwc_dcomp', 'lwc_dcomp']
#'cloud_phase']
def build_residual_block(input, drop_rate, num_neurons, activation, block_name, doDropout=True, doBatchNorm=True): def build_residual_block(input, drop_rate, num_neurons, activation, block_name, doDropout=True, doBatchNorm=True):
...@@ -116,6 +116,7 @@ class IcingIntensityNN: ...@@ -116,6 +116,7 @@ class IcingIntensityNN:
self.in_mem_batch = None self.in_mem_batch = None
self.filename = None self.filename = None
self.h5f = None self.h5f = None
self.h5f_l1b = None
self.logits = None self.logits = None
...@@ -164,7 +165,7 @@ class IcingIntensityNN: ...@@ -164,7 +165,7 @@ class IcingIntensityNN:
n_chans *= 3 n_chans *= 3
self.X_img = tf.keras.Input(shape=(img_width, img_width, n_chans)) self.X_img = tf.keras.Input(shape=(img_width, img_width, n_chans))
#self.X_img = tf.keras.Input(shape=NUM_PARAMS) #self.X_img = tf.keras.Input(shape=NUM_PARAMS)
self.X_prof = tf.keras.Input(shape=(NUM_VERT_LEVELS, NUM_VERT_PARAMS)) #self.X_prof = tf.keras.Input(shape=(NUM_VERT_LEVELS, NUM_VERT_PARAMS))
self.X_sfc = tf.keras.Input(shape=2) self.X_sfc = tf.keras.Input(shape=2)
self.inputs.append(self.X_img) self.inputs.append(self.X_img)
...@@ -201,7 +202,7 @@ class IcingIntensityNN: ...@@ -201,7 +202,7 @@ class IcingIntensityNN:
data = [] data = []
for param in train_params_day: for param in train_params_day:
nda = self.h5f[param][nd_keys, ] nda = self.h5f[param][nd_keys, ]
# nda = do_normalize(nda) # nda = normalize(nda, param)
data.append(nda) data.append(nda)
data = np.stack(data) data = np.stack(data)
data = data.astype(np.float32) data = data.astype(np.float32)
...@@ -224,7 +225,6 @@ class IcingIntensityNN: ...@@ -224,7 +225,6 @@ class IcingIntensityNN:
# label.append(tup[2]) # label.append(tup[2])
# continue # continue
# #
#
# if CACHE_DATA_IN_MEM: # if CACHE_DATA_IN_MEM:
# self.in_mem_data_cache[key] = (nda, ndb, ndc) # self.in_mem_data_cache[key] = (nda, ndb, ndc)
...@@ -576,7 +576,7 @@ class IcingIntensityNN: ...@@ -576,7 +576,7 @@ class IcingIntensityNN:
self.predict(mini_batch_test) self.predict(mini_batch_test)
print('loss, acc: ', self.test_loss.result(), self.test_accuracy.result()) print('loss, acc: ', self.test_loss.result(), self.test_accuracy.result())
def run(self, filename, train_dict=None, valid_dict=None): def run(self, filename, filename_l1b=None, train_dict=None, valid_dict=None):
with tf.device('/device:GPU:'+str(self.gpu_device)): with tf.device('/device:GPU:'+str(self.gpu_device)):
self.setup_pipeline(filename, train_idxs=train_dict, test_idxs=valid_dict) self.setup_pipeline(filename, train_idxs=train_dict, test_idxs=valid_dict)
self.build_model() self.build_model()
......
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