timestamp = None
if args.time_stamp is not None:
    timestamp = args.time_stamp
elif args.start_time is not None:
    startTime = args.start_time
if args.end_time is not None:
    endTime = args.end_time
# Once it's guaranteed there's a color map, then generate the colors
#################### METADATA #####################
meta = None
if args.time_stamp is not None:
    meta = Metadata(args.infile, timeStamp=timestamp)
else:
    meta = Metadata(args.infile, startTime=startTime, endTime=endTime)
meta.writeMetadata()
data = meta.loadData()
minVal = np.nanmin(data)
maxVal = np.nanmax(data)

# Read the colormap
PUcols = np.loadtxt(scriptDir + '\\..\\ColorMaps\\' + args.colormap + '.txt')

# Create the Color map object
gendMap = ListedColormap(PUcols, N=len(PUcols))
# Can't make a color nap with NaN values so we set to them to a value out of the color map
data[np.isnan(data)] = minVal - 5
# Set nan values as black
gendMap.set_under('black', 1)

# Normalize the data and create a ScalarMappable object.
# This allows us to efficiently map the values to colors