Home β€Ί Solar Data Analysis
⚑ Module 02 · Intermediate

Solar Data Analysis

✨ PAN'S RULE: The best secrets are hidden in the data! Let's go find them. ✨

Ready to be a data detective? πŸ•΅οΈβ€β™€οΈ We'll use Python, a powerful coding language, to uncover the secrets hidden in solar panel energy data. Let's find out which panels are superstar sun-catchers! β˜€οΈ

πŸ›‘οΈ SAFETY CHECK: We're using code to look at numbers (data), not people. Remember to never share personal information online! Also, think about where data comes from. What if we only collected sun data from the desert? An AI trained on that data would be terrible at predicting solar power in a cloudy city! For AI to be fair and helpful, its data needs to come from all over the world. πŸ‘
πŸ’‘

How Do We Measure Sunshine?

Imagine you have a magic bucket that catches sunbeams! β˜€οΈ
Every hour, you count how many sunbeams are in it. That list of counts is data!

So how do we know if a solar panel is doing a good job? We look at its data! Real scientists all over the worldβ€”and even kids like youβ€”collect data to help protect our planet.

πŸ§‘β€πŸ”¬ This is called Citizen Science! It's how we work together as a team to understand the world.

This video shows how you can be a data detective in your own backyard!

πŸ’‘ Pan's Pro Tip!

Data is just a fancy word for "a bunch of clues." If you have a list of how much energy a solar panel makes every hour, you can find the pattern! AI is super helpful for spotting these patterns in massive lists of numbers.

You could probably find the biggest number in a short list just by looking. But what if a solar farm had 1,000 panels, each reporting data every single minute? That's over a million numbers a day! 🀯

😩

A human scanning a
mountain of numbers

VS

πŸ€–πŸ’¨

A Python script zipping
through them in a flash!

You'd never be able to scan that by eye. This is why we use code. Python can find patterns in millions of numbers in the blink of an eye.

Pre-Code Warm-Up!

A dragon dropped its treasure! Before we use code, let's warm up our brains. Click the chest with the most coins!

πŸͺ™
45
πŸͺ™
88
πŸͺ™
102
πŸͺ™
91
πŸͺ™
50

The Power of Python 🐍

Awesome! Finding the biggest number is exactly what we're about to do with code. Scientists use a programming language called Python to find clues in data. Let's try it out right here.

Your Mission: Protect the Solar Farm! πŸ”­

You're an engineer at a new solar farm in Arizona! 🏜️ Your panels are rated to handle a peak of 150 power units. If they go higher, they could get damaged. Your mission is to check today's data and sound the alarm if the power is too high.

Mission Steps:

  1. First, use print(max(power_readings)) to find the highest value.
  2. Next, add an if/else statement to check if that peak is greater than 150.
  3. If it's over 150, print a danger message. If not, print an all-clear message!

Stuck? That's okay! All builders get stuck sometimes. Here's a code block you can use to finish the mission. See how it works?

peak = max(power_readings)
print(f"The peak power today is: {peak} β˜€οΈ")

if peak > 150:
  print("🚨 DANGER! Peak power is too high! Alert the engineers!")
else:
  print("βœ… All clear! The panels are safe.")

πŸ” Think Like the Computer: How Does max() Work?

How would you find the biggest number in a list if you could only look at one number at a time? You'd probably look at the first one, decide "okay, 85 is the biggest so far." Then look at the next one, 92. Is 92 bigger than 85? Yep. So now 92 is the biggest. You'd keep doing that until the end. That's exactly what the max() function does, just a million times faster!

Trinket is awesome for quick tests, but real data scientists need more power! Google Colab is a professional tool that lets you write code, create charts, and save your work online. The next challenges are bigger, so let's gear up and head to the Pro level!

πŸš€ Pro Mode: Open in Google Colab

πŸš€ Final Mission: Generate a Professional Systems Report

You've got the skills. Now, let's put it all together in your Google Colab notebook. An engineer needs the full picture. Your mission is to create a script that generates a complete diagnostic report for Panel Alpha-7. This is what a real data science report looks like. Build it, and you've officially used Python to solve a real-world engineering problem.

Part 1: The Raw Numbers

A good report starts with the key facts. Your script needs to calculate and print:

  1. The total energy generated. (Hint: sum()).
    Why it matters: This tells the energy company how much power they can sell!
  2. If electricity costs $0.12 per unit, how much money did this panel earn today? (Hint: total energy * 0.12).
    Why it matters: This is how the solar farm pays its bills and builds more clean energy projects!
  3. A clear status report. A panel is 'underperforming' if its average power is below 90. Write an if/else statement to check this.
    Why it matters: This is an automated alarm that helps you find broken or dirty panels that need fixing!

Part 2: Visualize the Data

The most powerful way to understand data is to see it. A number is just a number, but a chart tells a story! Add this code to your Google Colab notebook to create a real data visualization.

# Import the plotting library and give it a nickname 'plt'
import matplotlib.pyplot as plt

# Our data from the solar panel
power_readings = [85, 92, 110, 125, 130, 128, 115, 100, 95, 88]
hours = ["8am", "9am", "10am", "11am", "12pm", "1pm", "2pm", "3pm", "4pm", "5pm"]

plt.style.use('dark_background') # Make the chart look cool in Colab!
plt.figure(figsize=(10, 6)) # Create a canvas for our chart (width, height in inches)
plt.bar(hours, power_readings, color='gold') # Tell it to make a BAR chart, with our data

plt.title('Solar Panel Output Today') # Add a title
plt.xlabel('Hour of the Day') # Label the x-axis
plt.ylabel('Power Units Generated') # Label the y-axis

plt.grid(axis='y', linestyle='--', alpha=0.7) # Add faint horizontal grid lines
plt.show() # Display the final chart!

Mini-Challenge: Can you change the color from 'gold' to 'cyan'? What about changing the title to "Panel Alpha-7 Performance"? Experiment with the code!

πŸ‘¨β€πŸ‘©β€πŸ‘§ Parent Corner

Your young builder is learning skills used by real engineers! The "Final Mission" is a fantastic opportunity to learn together. We've included a "Pro Mode" link that opens the project in Google Colab. This is a free, industry-standard tool for running Python code used by real data scientists. Setting up a Google account to save their work (with your permission and supervision) is a great next step and allows them to save their amazing charts and reports!

πŸ“š Learn More