# Renewable Generation Analysis

Track solar and wind generation patterns to understand renewable penetration trends.

```python
import pandas as pd

# Get one month of daily fuel mix data
df = client.get_dataset(
    "ercot_fuel_mix",
    start="2026-01-01",
    end="2026-02-01",
    resample="1 day",
    resample_function="mean"
)

# Calculate daily renewable metrics
df['renewable_total'] = df['solar'] + df['wind']
df['total_generation'] = (
    df['coal_and_lignite'] + df['hydro'] + df['nuclear'] +
    df['power_storage'].clip(lower=0) + df['solar'] + df['wind'] +
    df['natural_gas'] + df['other']
)
df['renewable_pct'] = df['renewable_total'] / df['total_generation'] * 100

print("=== ERCOT Renewable Generation - January 2026 ===")
print(f"\nMonthly Averages:")
print(f"  Solar: {df['solar'].mean():,.0f} MW")
print(f"  Wind: {df['wind'].mean():,.0f} MW")
print(f"  Renewable %: {df['renewable_pct'].mean():.1f}%")

print(f"\nPeak Renewable Days:")
top_renewable = df.nlargest(5, 'renewable_pct')[['interval_start_utc', 'solar', 'wind', 'renewable_pct']]
for _, row in top_renewable.iterrows():
    date = str(row['interval_start_utc'])[:10]
    print(f"  {date}: {row['renewable_pct']:.1f}% ({row['solar']:,.0f} MW solar, {row['wind']:,.0f} MW wind)")

print(f"\nLowest Renewable Days:")
low_renewable = df.nsmallest(5, 'renewable_pct')[['interval_start_utc', 'solar', 'wind', 'renewable_pct']]
for _, row in low_renewable.iterrows():
    date = str(row['interval_start_utc'])[:10]
    print(f"  {date}: {row['renewable_pct']:.1f}% ({row['solar']:,.0f} MW solar, {row['wind']:,.0f} MW wind)")
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gridstatus.io/developers/concepts/recipes/renewable-generation-analysis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
