summaryrefslogtreecommitdiff
path: root/python/atms-310/homework/hw3
diff options
context:
space:
mode:
authorpants <niklasjo2004@gmail.com>2026-09-21 14:17:45 -0700
committerpants <niklasjo2004@gmail.com>2026-09-21 14:17:45 -0700
commita33d49ac4d1ce554c72770927957a089b4023bf1 (patch)
tree17ea036b5a0e8b488dc236f0ce48a275ecd80ef8 /python/atms-310/homework/hw3
Diffstat (limited to 'python/atms-310/homework/hw3')
-rwxr-xr-xpython/atms-310/homework/hw3/color.txt344
-rwxr-xr-xpython/atms-310/homework/hw3/homework3.py53
-rwxr-xr-xpython/atms-310/homework/hw3/hw3.py17
-rwxr-xr-xpython/atms-310/homework/hw3/hw3_01srh1.txt9
-rwxr-xr-xpython/atms-310/homework/hw3/hw3_01srh2.txt10
-rwxr-xr-xpython/atms-310/homework/hw3/hw3_06shr1.txt9
-rwxr-xr-xpython/atms-310/homework/hw3/hw3_06shr2.txt10
-rwxr-xr-xpython/atms-310/homework/hw3/hw3_mlcape1.txt9
-rwxr-xr-xpython/atms-310/homework/hw3/hw3_mlcape2.txt10
9 files changed, 471 insertions, 0 deletions
diff --git a/python/atms-310/homework/hw3/color.txt b/python/atms-310/homework/hw3/color.txt
new file mode 100755
index 0000000..282966c
--- /dev/null
+++ b/python/atms-310/homework/hw3/color.txt
@@ -0,0 +1,344 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Ansi 0 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.0</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.0</real>
+ <key>Red Component</key>
+ <real>0.0</real>
+ </dict>
+ <key>Ansi 1 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.0</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.0</real>
+ <key>Red Component</key>
+ <real>0.66666668653488159</real>
+ </dict>
+ <key>Ansi 10 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.3333333432674408</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>1</real>
+ <key>Red Component</key>
+ <real>0.3333333432674408</real>
+ </dict>
+ <key>Ansi 11 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.3333333432674408</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>1</real>
+ <key>Red Component</key>
+ <real>1</real>
+ </dict>
+ <key>Ansi 12 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>1</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.3333333432674408</real>
+ <key>Red Component</key>
+ <real>0.3333333432674408</real>
+ </dict>
+ <key>Ansi 13 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>1</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.3333333432674408</real>
+ <key>Red Component</key>
+ <real>1</real>
+ </dict>
+ <key>Ansi 14 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>1</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>1</real>
+ <key>Red Component</key>
+ <real>0.3333333432674408</real>
+ </dict>
+ <key>Ansi 15 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>1</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>1</real>
+ <key>Red Component</key>
+ <real>0.99999600648880005</real>
+ </dict>
+ <key>Ansi 2 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.0</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.66666668653488159</real>
+ <key>Red Component</key>
+ <real>0.0</real>
+ </dict>
+ <key>Ansi 3 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.0</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.3333333432674408</real>
+ <key>Red Component</key>
+ <real>0.66666668653488159</real>
+ </dict>
+ <key>Ansi 4 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.66666668653488159</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.0</real>
+ <key>Red Component</key>
+ <real>0.0</real>
+ </dict>
+ <key>Ansi 5 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.66666668653488159</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.0</real>
+ <key>Red Component</key>
+ <real>0.66666668653488159</real>
+ </dict>
+ <key>Ansi 6 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.66666668653488159</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.66666668653488159</real>
+ <key>Red Component</key>
+ <real>0.0</real>
+ </dict>
+ <key>Ansi 7 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.66666668653488159</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.66666668653488159</real>
+ <key>Red Component</key>
+ <real>0.66666668653488159</real>
+ </dict>
+ <key>Ansi 8 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.3333333432674408</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.3333333432674408</real>
+ <key>Red Component</key>
+ <real>0.3333333432674408</real>
+ </dict>
+ <key>Ansi 9 Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.3333333432674408</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.3333333432674408</real>
+ <key>Red Component</key>
+ <real>1</real>
+ </dict>
+ <key>Background Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.0</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.0</real>
+ <key>Red Component</key>
+ <real>0.0</real>
+ </dict>
+ <key>Badge Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>0.5</real>
+ <key>Blue Component</key>
+ <real>0.0</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.1491314172744751</real>
+ <key>Red Component</key>
+ <real>1</real>
+ </dict>
+ <key>Bold Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>1</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>1</real>
+ <key>Red Component</key>
+ <real>0.99999600648880005</real>
+ </dict>
+ <key>Cursor Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.72337132692337036</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.72338062524795532</real>
+ <key>Red Component</key>
+ <real>0.72336345911026001</real>
+ </dict>
+ <key>Cursor Guide Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>0.25</real>
+ <key>Blue Component</key>
+ <real>1</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.9268307089805603</real>
+ <key>Red Component</key>
+ <real>0.70213186740875244</real>
+ </dict>
+ <key>Cursor Text Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>1</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>1</real>
+ <key>Red Component</key>
+ <real>0.99999600648880005</real>
+ </dict>
+ <key>Foreground Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.66666668653488159</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.66666668653488159</real>
+ <key>Red Component</key>
+ <real>0.66666668653488159</real>
+ </dict>
+ <key>Link Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>1</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.3333333432674408</real>
+ <key>Red Component</key>
+ <real>0.3333333432674408</real>
+ </dict>
+ <key>Selected Text Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>0.0</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.0</real>
+ <key>Red Component</key>
+ <real>0.0</real>
+ </dict>
+ <key>Selection Color</key>
+ <dict>
+ <key>Alpha Component</key>
+ <real>1</real>
+ <key>Blue Component</key>
+ <real>1</real>
+ <key>Color Space</key>
+ <string>sRGB</string>
+ <key>Green Component</key>
+ <real>0.86970102787017822</real>
+ <key>Red Component</key>
+ <real>0.75813239812850952</real>
+ </dict>
+</dict>
+</plist>
diff --git a/python/atms-310/homework/hw3/homework3.py b/python/atms-310/homework/hw3/homework3.py
new file mode 100755
index 0000000..31db6de
--- /dev/null
+++ b/python/atms-310/homework/hw3/homework3.py
@@ -0,0 +1,53 @@
+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])
+# for n, param in enumerate(parameters):
+# np_function = getattr(np, param)
+# result = np_function(read(filelist[n]))
+# print(result)
+
+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.
diff --git a/python/atms-310/homework/hw3/hw3.py b/python/atms-310/homework/hw3/hw3.py
new file mode 100755
index 0000000..981bb05
--- /dev/null
+++ b/python/atms-310/homework/hw3/hw3.py
@@ -0,0 +1,17 @@
+import numpy as np
+import scipy.stats as s
+import glob as glob
+
+calc = {"mean":np.std, "median":np.median, "std":np.std, "iqr":s.iqr,\
+ "skew":s.skew, "kurtosis":s.kurtosis}
+
+print(calc["kurtosis"])
+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
+
diff --git a/python/atms-310/homework/hw3/hw3_01srh1.txt b/python/atms-310/homework/hw3/hw3_01srh1.txt
new file mode 100755
index 0000000..aba7c93
--- /dev/null
+++ b/python/atms-310/homework/hw3/hw3_01srh1.txt
@@ -0,0 +1,9 @@
+2.5
+140.01
+127.19
+116.8
+211.31
+115.35
+220.38
+250.54
+248.61 \ No newline at end of file
diff --git a/python/atms-310/homework/hw3/hw3_01srh2.txt b/python/atms-310/homework/hw3/hw3_01srh2.txt
new file mode 100755
index 0000000..167d2b9
--- /dev/null
+++ b/python/atms-310/homework/hw3/hw3_01srh2.txt
@@ -0,0 +1,10 @@
+383.79
+364.37
+364.37
+517.94
+517.94
+630.18
+240.08
+203.42
+184.33
+211.19 \ No newline at end of file
diff --git a/python/atms-310/homework/hw3/hw3_06shr1.txt b/python/atms-310/homework/hw3/hw3_06shr1.txt
new file mode 100755
index 0000000..557c5f6
--- /dev/null
+++ b/python/atms-310/homework/hw3/hw3_06shr1.txt
@@ -0,0 +1,9 @@
+67.4134
+63.5197
+61.7
+55.6912
+56.6491
+48.4201
+46.6137
+41.388
+43.7989 \ No newline at end of file
diff --git a/python/atms-310/homework/hw3/hw3_06shr2.txt b/python/atms-310/homework/hw3/hw3_06shr2.txt
new file mode 100755
index 0000000..6c2578d
--- /dev/null
+++ b/python/atms-310/homework/hw3/hw3_06shr2.txt
@@ -0,0 +1,10 @@
+62.3392
+60.4778
+60.4778
+68.9632
+68.9632
+72.1033
+63.5346
+63.4428
+63.272
+52.7143 \ No newline at end of file
diff --git a/python/atms-310/homework/hw3/hw3_mlcape1.txt b/python/atms-310/homework/hw3/hw3_mlcape1.txt
new file mode 100755
index 0000000..dee447b
--- /dev/null
+++ b/python/atms-310/homework/hw3/hw3_mlcape1.txt
@@ -0,0 +1,9 @@
+205.47
+656.44
+691.44
+446.69
+448.34
+1069.41
+808.91
+983
+307.58 \ No newline at end of file
diff --git a/python/atms-310/homework/hw3/hw3_mlcape2.txt b/python/atms-310/homework/hw3/hw3_mlcape2.txt
new file mode 100755
index 0000000..97e3042
--- /dev/null
+++ b/python/atms-310/homework/hw3/hw3_mlcape2.txt
@@ -0,0 +1,10 @@
+3167.88
+2844.88
+2844.88
+2146.88
+2146.88
+1820.75
+741.62
+1042.75
+810.12
+1314.88 \ No newline at end of file