Open danielolsen opened 2 years ago
Using some work-in-progress branches, I've got a workflow that appears to be working at least for the generation of wind profiles:
daniel/read_hifld_grid
branch of PowerSimData and the daniel/decouple_profiles_from_grid
branch of PreREISE, and with a folder of grid CSVs created by the hifld
branch of PreREISE (we'll call this folder hifld_csvs
for this example).mkdir $(pipenv --venv)/src/powersimdata/powersimdata/network/hifld/data
cp -r test_csvs/. $(pipenv --venv)/src/powersimdata/powersimdata/network/hifld/data/
from datetime import datetime
from powersimdata import Grid
from prereise.gather.winddata.hrrr.hrrr import retrieve_data
from prereise.gather.winddata.hrrr.calculations import calculate_pout
start_dt = datetime.fromisoformat("2020-01-01") end_dt = datetime.fromisoformat("2021-01-01") directory = "./"
grid = Grid("USA", "hifld") wind_farms = grid.plant.query("type == 'wind' or type == 'wind_offshore'").copy() wind_farms["state_abv"] = wind_farms.zone_id.map(grid.model_immutables.zones["id2abv"]) retrieve_data(start_dt=start_dt, end_dt=end_dt, directory=directory) df = calculate_pout(wind_farms=wind_farms, start_dt=start_dt, end_dt=end_dt, directory=directory) df.to_csv("wind.csv")
Downloading the wind data will take several hours, I'll update this post once it's done and I can confirm whether the method worked all the way through. **EDIT**: using the `daniel/decouple_profiles_from_grid` branch and the branch from #245 (rebased together), I was able to successfully download wind speeds and convert them to power profiles for the HIFLD grid.
Getting solar data can follow a similar pattern. Repeat steps 1 and 2 from wind data procedure above, make sure you have the SAM binaries installed, then:
from powersimdata import Grid
from prereise.gather.solardata.nsrdb import sam
from prereise.gather.solardata.helpers import to_reise
grid = Grid("USA", "hifld")
solar_plant = grid.plant.query("type == 'solar'").copy()
solar_plant.index.name = "plant_id"
data = sam.retrieve_data(YOUR_EMAIL_HERE, YOUR_NREL_API_KEY_HERE, solar_plant=solar_plant, grid_model="hifld", year=2020)
Note that the call signature for sam.retrieve_data
has changed, so that it doesn't depend on a hard-coded reference to the usa_tamu
grid constants, but can either take a grid (which will contain both the solar data and the model immutables) or the solar data and a grid model string which is used to instantiate a new ModelImmutables
object.
Getting solar data can follow a similar pattern. Repeat steps 1 and 2 from wind data procedure above, then:
from powersimdata import Grid from prereise.gather.solardata.nsrdb import sam from prereise.gather.solardata.helpers import to_reise grid = Grid("USA", "hifld") solar_plant = grid.plant.query("type == 'solar'").copy() solar_plant.index.name = "plant_id" data = sam.retrieve_data(YOUR_EMAIL_HERE, YOUR_NREL_API_KEY_HERE, solar_plant=solar_plant, grid_model="hifld", year=2020)
Note that the call signature for
sam.retrieve_data
has changed, so that it doesn't depend on a hard-coded reference to theusa_tamu
grid constants, but can either take a grid (which will contain both the solar data and the model immutables) or the solar data and a grid model string which is used to instantiate a newModelImmutables
object.
Don't forget to update the notebook!
Looking at the wind and solar code, there seem to be two different 'levels' of making new profiles for the HIFLD grid:
Now that #247 decouples solar profile generation from the Grid object, we could generate plant-specific profiles as part of the top-level grid-CSV-creation step, while we still have all the 'extra' data columns that are required to associate the main Form 860 records with the 'ancillary' table for solar-specific data. Once #249 is integrated, we could do the same for wind profiles. See https://github.com/Breakthrough-Energy/PreREISE/issues/242#issuecomment-993078516 for more context.
I believe this will be satisfied upon completion of #256, #260, and #261.
Now that I'm coming back to this, I'm realizing that we still need scripts for the creation of demand profiles. If our demand zones match the hourly data available from the EIA (https://www.eia.gov/opendata/qb.php?category=2122628), then we can either download and clean their data, or download pre-cleaned data from https://zenodo.org/record/4116342. If our demand zones don't match the EIA, then we will need another step of processing to re-align them.
:rocket:
Describe the workflow you want to enable
Similar to what was done for the TAMU Grid, we want scripts that can ingest data from external sources and produce profiles formatted for intake by PowerSimData/REISE.jl.