# is the equator - this limits the problems with boundary conditions. # This version looks at precip import os import tensorflow as tf import ML_Utilities import pickle import numpy # How many epochs to train for n_epochs = 50 # Create TensorFlow Dataset object from the prepared training data (tr_data, n_steps) = ML_Utilities.dataset(purpose='training', source='rotated_pole/20CR2c', variable='prate') tr_data = tr_data.repeat(n_epochs) # Also produce a tuple (source,target) for model def to_model(ict): ict = tf.reshape(ict, [79, 159, 1]) return (ict, ict) tr_data = tr_data.map(to_model) tr_data = tr_data.batch(1) # Similar dataset from the prepared test data (tr_test, test_steps) = ML_Utilities.dataset(purpose='test',
# This version uses only a small quantity of training data import os import tensorflow as tf import ML_Utilities import pickle # How many epochs to train for n_epochs=100 # How many fields to train on n_fields=100 # Create TensorFlow Dataset object from the prepared training data (tr_data,n_steps) = ML_Utilities.dataset(purpose='training', source='20CR2c', variable='prmsl', length=n_fields) tr_data = tr_data.repeat(n_epochs) # Need to reshape the data to linear, and produce a tuple # (source,target) for model def to_model(ict): ict=tf.reshape(ict,[1,91*180]) return(ict,ict) tr_data = tr_data.map(to_model) # Similar dataset from the prepared test data (tr_test,test_steps) = ML_Utilities.dataset(purpose='test', source='20CR2c', variable='prmsl') tr_test = tr_test.repeat(n_epochs)
# Very simple autoencoder for 20CR air.2m fields. # Single, fully-connected layer as encoder+decoder, 32 neurons. # Very unlikely to work well at all, but this isn't about good # results, it's about getting started. import os import tensorflow as tf import ML_Utilities import pickle # How many epochs to train for n_epochs = 100 # Create TensorFlow Dataset object from the prepared training data (tr_data, n_steps) = ML_Utilities.dataset(purpose='training', source='20CR2c', variable='air.2m') tr_data = tr_data.repeat(n_epochs) # Need to reshape the data to linear, and produce a tuple # (source,target) for model def to_model(ict): ict = tf.reshape(ict, [1, 18048]) return (ict, ict) tr_data = tr_data.map(to_model) # Similar dataset from the prepared test data (tr_test, test_steps) = ML_Utilities.dataset(purpose='test',