Skip to content

Instantly share code, notes, and snippets.

@TheCorp
Created March 3, 2023 19:03
Show Gist options
  • Save TheCorp/71fd1ca4a3c53d318cca4c8b2f94c82f to your computer and use it in GitHub Desktop.
Save TheCorp/71fd1ca4a3c53d318cca4c8b2f94c82f to your computer and use it in GitHub Desktop.
file = File.open('2021powerstatus.txt');nil
data = file.read;nil
data.length
data.split("\n").select{|x| x.include? "Diablo"}.count
raw_data = {"Diablo Canyon 2" => [], "Diablo Canyon 1" => []}
dc_analysis = data.split("\n").select{|x| x.include? "Diablo"};nil
dc_analysis = dc_analysis.reverse;nil
dc_analysis.each{|x| raw_data[x.split('|')[1]] << x.split('|').last.gsub("\r","").to_i};nil
p "2021 - DC1: avg CF: #{raw_data["Diablo Canyon 1"].mean}, DC1 days offline: #{raw_data["Diablo Canyon 1"].select{|x| x == 0}.count}, DC1 days less than 100 CF: #{raw_data["Diablo Canyon 1"].select{|x| x < 100}.count} "
p "2021 - DC2 avg CF #{raw_data["Diablo Canyon 2"].mean}, DC2 days offline: #{raw_data["Diablo Canyon 2"].select{|x| x == 0}.count}, DC2 days less than 100 CF: #{raw_data["Diablo Canyon 2"].select{|x| x < 100}.count}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment