summaryrefslogtreecommitdiff
path: root/python/atms-310/homework/hw3/homework3.py
diff options
context:
space:
mode:
authorpants <niklasjo2004@gmail.com>2026-09-21 14:17:03 -0700
committerpants <niklasjo2004@gmail.com>2026-09-21 14:17:03 -0700
commit7b21727285e50b0b050c4ddd70d07542229c5366 (patch)
tree5d369153c5df5b41f3750d25479a68f20169c8ff /python/atms-310/homework/hw3/homework3.py
init
Diffstat (limited to 'python/atms-310/homework/hw3/homework3.py')
-rwxr-xr-xpython/atms-310/homework/hw3/homework3.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/python/atms-310/homework/hw3/homework3.py b/python/atms-310/homework/hw3/homework3.py
new file mode 100755
index 0000000..8f5f615
--- /dev/null
+++ b/python/atms-310/homework/hw3/homework3.py
@@ -0,0 +1,54 @@
+import numpy as np
+import scipy.stats as s
+import glob as glob # glob
+import pandas as pd
+
+filelist = glob.glob("hw3_*.txt")
+filelist.sort()
+
+def read(file):
+ fileobj = open(file, "r")
+ outputstr = fileobj.readlines()
+ fileobj.close()
+ outputarray = np.zeros(len(outputstr))
+ for i in np.arange(len(outputstr)):
+ outputarray[i] = float(outputstr[i])
+ return outputarray
+
+parameters = ["mean", "median", "std", "iqr", "skew", "kurtosis"]
+
+for i in range(len(filelist)):
+ print(filelist[i])
+ data = np.array(read(filelist[i]))
+ for n in range (len(parameters)):
+ operation = parameters[n]
+ print(str(operation) + " " + np.operation(data))
+
+
+#for n in range(len(filelist)):
+# print(filelist[n])
+# mean = np.mean(read(filelist[n]))
+# print("mean: " + str(mean))
+# median = np.median(read(filelist[n]))
+# print("median: " + str(median))
+# stddev = np.std(read(filelist[n]))
+# print("stddev: " + str(stddev))
+# iqr = s.iqr(read(filelist[n]))
+# print("iqr: " + str(iqr))
+# skew = s.skew(read(filelist[n]))
+# print("skew: " + str(skew))
+# kurtosis = s.kurtosis(read(filelist[n]))
+# print("kurtosis: " + str(kurtosis)+"\n")
+
+# the mean and median are similar for all files, indicating solid, outlier free data.
+# standard deviation is quite high for everything except wind shear, indicating either \
+# inconsistent readings for everything but wind shear, or more likely, smaller units and \
+# higher rates of change.
+# the difference between shr1's iqr and stddev is larger than that of shr2's (shr2's is \
+# quite close to its stddev), possibility of one minor outlier
+# none of the data is very skewed, the largest (absolute value) being 0.54896, and \
+# all of the data has negative kurtosis, meaning when distibuted, it will have a shallower \
+# peak than the bell curve (e^x^2)
+# the february and may datasets are similar in that their wind shears are similar, though \
+# mays is still larger. they are different in that mays SRH and CAPE are both much higher, \
+# so mays tornadoes are much stronger.