-
Notifications
You must be signed in to change notification settings - Fork 54
Feature add: Download wind resource for Alaska #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… for other resource heights
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks slick and useful for future resource integration! Some small notes and questions, otherwise good to go imo.
def combine_and_write_srw_files(file_resource_heights, output_filepath): | ||
|
||
data = [None] * 2 | ||
for height, f in file_resource_heights.items(): | ||
if os.path.isfile(f): | ||
with open(f) as file_in: | ||
csv_reader = csv.reader(file_in, delimiter=',') | ||
line = 0 | ||
for row in csv_reader: | ||
if line < 2: | ||
data[line] = row | ||
else: | ||
if line >= len(data): | ||
data.append(row) | ||
else: | ||
data[line] += row | ||
line += 1 | ||
|
||
with open(output_filepath, 'w', newline='') as fo: | ||
writer = csv.writer(fo) | ||
writer.writerows(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a docstring please?
} | ||
return combined_resource_data | ||
|
||
def combine_CSV_to_wind_data(file_resource_heights, fake_resource_year = '1900'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this fake_resource_year
used for? If it's just to pass in a year to other functions and has no real meaning, could we change it to None
and then modify the functions that use it elsewhere? Or maybe even have None
be the default for those functions and then only use the year if it's not None. Feel free to call me if this isn't making sense, I just want to avoid confusion about why there's a fake_resource_year
Co-authored-by: John Jasa <[email protected]>
Co-authored-by: John Jasa <[email protected]>
Co-authored-by: John Jasa <[email protected]>
if isinstance(wind_resource_filepath,list): | ||
if len(wind_resource_filepath) != len(resource_heights): | ||
raise ValueError("wind resource filepath must be a list of filenames that same length as") | ||
file_resource_heights = dict(zip(resource_heights,filepaths)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the filepaths variable be defined here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for improving the usability of the wind resource setup!
API Calls to WIND Toolkit Alaska
Added ability to make API calls to WIND Toolkit Alaska and download resource data for Alaska sites. This also required added tools to convert csv files to the proper wind resource data format that is expected by WindPlant.
PR Checklist
RELEASE.md
has been updated to describe the changes made in this PRdocs/
files are up-to-date, or added when necessaryRelated issues
Impacted areas of the software
modified files:
hopp/simulation/technologies/resource/wind_resource.py
combine_files()
function to callcombine_and_write_srw_files()
function frompysam_wind_tools.py
hopp/tools/resource/wind_tools.py
hopp/simulation/technologies/sites/site_info.py
wind_resource_region
is new attribute that can be used to specify the wind resource region as Alaska ("conus" is default for existing wind resource downloads, "ak" is used for Alaska)hopp/simulation/technologies/resource/resource.py
call_api()
updated to replace possible weird characters in download data (mostly relevant for BC-HRRR dataset which is not yet included)tests added:
tests/hopp/test_site_info.py
test_alaska_wind_resource()
new integration test of Alaska wind resource data with SiteInfotests/hopp/test_wind_resource_tools.py
: test the new functioncombine_wind_files()
inhopp/tools/resource/pysam_wind_tools.py
for combining wind resource datatest_pysam_combine_wind_files_csv
test_pysam_combine_wind_files_srw
tests/hopp/test_wind.py
test_alaska_wind_floris
: tests that floris simulation is compatible with resource data format from Alaska wind datatest_alaska_wind_pysam
: tests that pysam simulation is compatible with resource data format from Alaska wind datanew files:
hopp/tools/resource/pysam_wind_tools.py
: functions to convert csv files into wind data format and combine wind resource files (either csv or srw)hopp/simulation/technologies/resource/alaska_wind.py
: script similar to wind_resource.py that downloads wind resource data for Alaska.hopp/simulation/resource_files/wind/66.68_-162.5_WTK_Alaksa_2019_60min_80m_100m.csv
: resource file for Alaska site that is used in new testschanges to docs/ files:
docs/_toc.yaml
: updated to include Alaska winddocs/api/resource/index.md
: updated to include Alaska winddocs/api/resource/wind_api.md
: updated to specify that this is for continental U.S. sites and include the constraints for wind resource year.docs/api/resource/alaska_wind.md
: new file with documentation for Alaska wind API callsAdditional supporting information
Test results, if applicable