Skip to content

Commit

Permalink
materials for dc workshop
Browse files Browse the repository at this point in the history
  • Loading branch information
wholmgren committed Oct 9, 2019
1 parent a7c7d93 commit 9dc331f
Show file tree
Hide file tree
Showing 9 changed files with 13,279 additions and 0 deletions.
1,465 changes: 1,465 additions & 0 deletions boulder_clear_aug_sept.csv

Large diffs are not rendered by default.

1,465 changes: 1,465 additions & 0 deletions boulder_cloudy_aug_sept.csv

Large diffs are not rendered by default.

1,465 changes: 1,465 additions & 0 deletions boulder_fx_demo_aug_sept.csv

Large diffs are not rendered by default.

1,465 changes: 1,465 additions & 0 deletions boulder_fx_holmgren_aug_sept.csv

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions dc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# DC data sharing

## Creating Sites, Observations, Forecasts

* Create a Site (weather station)
* Boulder: 40 N, -105 E, 1650 m
* Create a Site (power plant)
* Boulder Power Plant: 10 MW AC, 14 MW DC, tracking, .4 gcr
* Create an Observation.
* AC power, hourly average, beginning
* View sample data, upload boulder_cloudy_aug_sept.csv
* Note: procedure must be repeated for each variable. Tedious, but avoids need to agree upon and parse column names
* Create a Forecast
* AC power, hourly average, beginning
* upload boulder_fx_demo_aug_sept.csv

## Data sharing

For this exercise you need two accounts. Here we use demo and holmgren.
For now we must use uuids to share data, but email support will come soon.

* demo: 4f738239-e632-11e9-ab45-52540015d5ce
* holmgren: 26653f79-e62d-11e9-ab45-52540015d5ce

* Goal: demo@solarforecastarbiter.org wants to share its AC power data with a forecast provider (holmgren@email.arizona.edu), receive a forecast from the forecast provider, and generate a report comparing to its own forecast (created previously).
* Show roles page
* In a second incognito window, log in as holmgren@email.arizona.edu, show available sites -- cannot see demo’s
* From demo window, create role for sharing sites, obs metadata, values
* Use “all *” permissions for simplicity, but note this can be made much more fine grained
* Assign role to forecast provider account
* From holmgren window, create forecast, upload forecast
* AC power, hourly average, beginning
* upload boulder_fx_holmgren_aug_sept.csv
* Note that demo could have created a forecast metadata object
* Share new holmgren forecast metadata and data with the demo account
* From demo account, see that there is now a new forecast
* From demo create report comparing demo forecast and holmgren forecast to demo obs

## Data sharing on MIDC Arizona OASIS

* From holmgren window, create OASIS forecast, upload forecast
* issue time of day 7Z, run length 1 day, lead time 1 day
* Premade uploaded forecast is a bias corrected version of GFS forecast
* Note that demo could have created a forecast metadata object
* If not already done, share new holmgren forecast metadata and data with the demo account
* From demo account, see that there is now a new forecast
* Create report comparing reference forecast and holmgren forecast to reference obs
56 changes: 56 additions & 0 deletions generate_ac_obs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import numpy as np
import pandas as pd

from solarforecastarbiter import datamodel
from solarforecastarbiter import pvmodel

from pvlib.location import Location


# define metadata
modeling_params = datamodel.SingleAxisModelingParameters(
ac_capacity=10, dc_capacity=14, temperature_coefficient=-0.004,
dc_loss_factor=0, ac_loss_factor=0,
axis_tilt=0, axis_azimuth=0, ground_coverage_ratio=.4,
backtrack=True, max_rotation_angle=45)

metadata = datamodel.SolarPowerPlant(
name='Boulder Power Plant', latitude=40., longitude=-105.,
elevation=1650., timezone='America/Denver', provider='Sandia',
modeling_parameters=modeling_params)

times = pd.date_range(
start='20190801', end='20191001', freq='5min', closed='left')

solpos = pvmodel.calculate_solar_position(
metadata.latitude, metadata.longitude, metadata.elevation, times)
cs = pvmodel.calculate_clearsky(
metadata.latitude, metadata.longitude, metadata.elevation,
solpos['apparent_zenith'])
ac_clear = pvmodel.irradiance_to_power(
modeling_params, solpos['apparent_zenith'], solpos['azimuth'],
cs['ghi'], cs['dni'], cs['dhi'])

ac_clear_1h = ac_clear.resample('1h').mean()
ac_clear_1h = pd.DataFrame({'value': ac_clear_1h, 'quality_flag': 0})
ac_clear_1h.to_csv('boulder_clear_aug_sept.csv', index_label='timestamp')

# make it cloudy, but apply clipping
random = np.random.random(size=len(times)) + 0.5
random = random.clip(max=1)
ac = ac_clear * random

ac_1h = ac.resample('1h').mean()
ac_1h = pd.DataFrame({'value': ac_1h, 'quality_flag': 0})
ac_1h.to_csv('boulder_cloudy_aug_sept.csv', index_label='timestamp')

fx_demo = ac_1h['value'].shift(1)
fx_demo.to_csv('boulder_fx_demo_aug_sept.csv',
header=['value'], index_label='timestamp')

csi = ac / ac_clear
csi = csi.fillna(0) # account for divide by 0
ac_csi = csi.shift(12) * ac_clear
holmgren_demo = ac_csi.resample('1h').mean()
holmgren_demo.to_csv('boulder_fx_holmgren_aug_sept.csv',
header=['value'], index_label='timestamp')
Loading

0 comments on commit 9dc331f

Please sign in to comment.