Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
'''
#Below functions chooses a random data point from any of the models.
def randomPointOld(modelList):
m = np.random.randint(0, 7)
la = np.random.randint(0, 400)
lo = np.random.randint(0, 700)
return m, la, lo
def displaySample25Old(modelList, lat, lon):
fig = plt.figure(figsize=(10, 10))
#number of hours (should be 25)
for h in range(25):
#First and second parameters determine inverse size of each sub-plot. 5, 5 means a 5th of the width and 5th of the hieght per subplot.
ax = fig.add_subplot(5, 5, h + 1, projection='3d')
#should be len(lat) or 400
for i in range(5):
#should be len(lon) or 700
for j in range(5):
m, la, lo = randomPointOld(modelList)
zs = modelList[m][h][la][lo]
xs = lat[la]
ys = lon[lo]
ax.scatter(xs, ys, zs)
ax.set_xlabel('Latitude')
ax.set_ylabel('Longitude')
ax.set_zlabel('Ozone-Level')
plt.show()
def displaySample1Old(modelList, lat, lon):
fig = plt.figure(figsize=(10, 10))
ax = fig.add_subplot(projection='3d')
# should be len(lat) or 400
for i in range(20):
# should be len(lon) or 700
for j in range(20):
m, la, lo = randomPointOld(modelList)
zs = modelList[m][0][la][lo]
xs = lat[la]
ys = lon[lo]
ax.scatter(xs, ys, zs)
ax.set_xlabel('Latitude')
ax.set_ylabel('Longitude')
ax.set_zlabel('Ozone-Level')
plt.show()
'''
def displaySample1(CBEOne, centroids):
#decides the colour associated with each cluster/centroid
colours = {
0: 'r',
1: 'b',
2: 'g',
3: 'c',
4: 'm',
5: 'y'
}
fig = plt.figure(figsize=(10, 10))
ax = fig.add_subplot(projection='3d')
for i in CBEOne:
lat = i.lat
lon = i.lon
ozone = i.ozone
print(i.centroid)
ax.scatter(lat, lon, ozone, c=colours[i.centroid])
for i in centroids:
lat = i.lat
lon = i.lon
ozone = i.ozone
ax.scatter(lat, lon, ozone, c='k')
ax.set_xlabel('Latitude')
ax.set_ylabel('Longitude')
ax.set_zlabel('Ozone-Level')
plt.show()
def displaySample25(kEnsemble, kEntroids):
colours = {
0: 'r',
1: 'b',
2: 'g',
3: 'c',
4: 'm',
5: 'y'
}
fig = plt.figure(figsize=(10, 10))
for h in range(25):
ax = fig.add_subplot(5, 5, h + 1, projection='3d')
for i in kEnsemble[h]:
lat = i.lat
lon = i.lon
ozone = i.ozone
#print(i.centroid)
ax.scatter(lat, lon, ozone, c=colours[i.centroid])
for i in kEntroids[h]:
lat = i.lat
lon = i.lon
ozone = i.ozone
ax.scatter(lat, lon, ozone, c='k')
ax.set_xlabel('Latitude')
ax.set_ylabel('Longitude')
ax.set_zlabel('Ozone-Level')
plt.show()