# FMI Solar Irradiance Data Documentation

## Finnish Meteorological Institute (FMI) Open Data

FMI provides comprehensive weather and solar radiation data through their open data portal.

## Data Sources

### Open Data Portal
- **URL:** https://en.ilmatieteenlaitos.fi/open-data
- **API:** https://opendata.fmi.fi/wfs
- **License:** CC BY 4.0
- **Registration:** Required for API access

### Relevant Datasets

| Dataset | Parameter | Resolution | History |
|---------|-----------|------------|---------|
| Solar radiation | Global irradiance | Hourly | 1971-present |
| Cloud cover | Total cloudiness | 3-hourly | 1961-present |
| Sunshine duration | Hours per day | Daily | 1961-present |

## Solar Radiation Data

### Global Horizontal Irradiance (GHI)
- **Unit:** W/m² or kJ/m² (depending on query)
- **Stations near Helsinki:** Kumpula, Vantaa, Kaisaniemi
- **Query parameter:** `GLOB_1H` (hourly global radiation)

### Sample WFS Query

```bash
curl "https://opendata.fmi.fi/wfs?service=WFS&version=2.0.0&request=GetFeature&storedquery_id=fmi::observations::radiation::simple&place=helsinki&starttime=2025-06-01T00:00:00Z&endtime=2025-06-30T23:59:59Z&parameters=GLOB_1H"
```

## Helsinki Solar Statistics

Based on FMI long-term averages (1991-2020):

### Monthly Global Horizontal Irradiance

| Month | GHI (kWh/m²) | Sunshine (hrs) | Cloud Cover (%) |
|-------|--------------|----------------|-----------------|
| Jan | 9 | 38 | 75 |
| Feb | 27 | 59 | 70 |
| Mar | 62 | 124 | 60 |
| Apr | 105 | 175 | 55 |
| May | 149 | 255 | 50 |
| Jun | 156 | 280 | 48 |
| Jul | 155 | 260 | 52 |
| Aug | 118 | 215 | 55 |
| Sep | 66 | 140 | 62 |
| Oct | 31 | 80 | 70 |
| Nov | 12 | 35 | 78 |
| Dec | 6 | 25 | 80 |
| **Total** | **896** | **1686** | **63 avg** |

### Notes on Helsinki Solar Conditions

1. **Extreme Seasonality:** 
   - Summer (May-Jul): 460 kWh/m² (51% of annual)
   - Winter (Nov-Jan): 27 kWh/m² (3% of annual)

2. **Long Summer Days:**
   - June: ~19 hours daylight
   - December: ~6 hours daylight

3. **Snow Albedo Effect:**
   - Winter snow can increase diffuse radiation
   - Also causes panel shading if snow accumulates

4. **Temperature Benefits:**
   - Cold temperatures improve panel efficiency
   - -0.4%/°C typical coefficient

## Alternative Data Sources

### PVGIS (EU Joint Research Centre)
- **URL:** https://re.jrc.ec.europa.eu/pvg_tools/
- **Advantage:** Pre-calculated solar potential maps
- **Data:** TMY (Typical Meteorological Year)

### Sample PVGIS Query
```
https://re.jrc.ec.europa.eu/api/v5_2/PVcalc?lat=60.17&lon=24.94&peakpower=1&loss=14&outputformat=json
```

### NASA POWER
- **URL:** https://power.larc.nasa.gov/
- **Global coverage, 1981-present**
- **Resolution:** 0.5° grid

## Recommended Approach

1. **Use FMI for accuracy:** Local measurements are most reliable
2. **PVGIS for quick estimates:** Pre-calculated, easy API
3. **Monthly averages:** Sufficient for yield estimation
4. **Don't over-engineer:** ±10% accuracy is typical anyway

## Data Processing

Convert FMI radiation data to usable format:

```typescript
interface FMIRadiationReading {
  timestamp: Date;
  GLOB_1H: number;  // W/m² or kJ/m²
  DIR_1H?: number;  // Direct radiation if available
  DIFF_1H?: number; // Diffuse radiation if available
}

function kJm2ToKWhm2(kJm2: number): number {
  return kJm2 / 3600;  // 1 kWh = 3600 kJ
}

function aggregateMonthlyGHI(readings: FMIRadiationReading[]): MonthlyGHI[] {
  // Group by month, sum hourly values
  // Convert to kWh/m²
}
```

## Caching Strategy

For the application:
1. **Pre-compute:** Monthly averages for Helsinki (static data)
2. **Embed:** Include in application bundle
3. **Optional API:** Allow fetching recent data for comparison

The weather.ts types already include Helsinki monthly data as constants.
