- Posts: 7
Failure to download 5-min resolution wind data
- Jubeyer
- Topic Author
Less
More
20 Apr 2021 15:27 #9484
by Jubeyer
Failure to download 5-min resolution wind data was created by Jubeyer
Hi,
I am a pretty new user of SAM. I have been trying to download wind data at 5-min resolution from the windtoolkit throught SAM's "FetchResourceFiles" option. I have followed the documentation and come up with my code like this but it is not working and it only pulls up data at hourly interval. I have tried with setting resource_type='' (since it is written that for windtoolkit; it is the '') and 'psm3-5min' both but none of them seem to work propoerly. Can anyone please help to figure that out.
Regards,
Jubeyer
I am a pretty new user of SAM. I have been trying to download wind data at 5-min resolution from the windtoolkit throught SAM's "FetchResourceFiles" option. I have followed the documentation and come up with my code like this but it is not working and it only pulls up data at hourly interval. I have tried with setting resource_type='' (since it is written that for windtoolkit; it is the '') and 'psm3-5min' both but none of them seem to work propoerly. Can anyone please help to figure that out.
Regards,
Jubeyer
Code:
wtkfetcher = tools.FetchResourceFiles(
tech='wind',
nrel_api_key=sam_api_key,
nrel_api_email=sam_email,resource_year='2009',resource_interval_min=5,resource_height=80,resource_type='psm3-5min')
# --- List of (lon, lat) tuples or Shapely points ---
lon_lats = [(lon, lat)]
wtkfetcher.fetch(lon_lats)
# --- Get resource data file path ---
wtk_path_dict = wtkfetcher.resource_file_paths_dict
wtk_fp = wtk_path_dict[lon_lats[0]]
Temp_File=tools.SRW_to_wind_data(wtk_fp)
#read_file = pd.read_csv (wtk_fp)
#read_file.to_csv (r'Path where the CSV will be saved\File name.csv', index=None)
# --- Initialize generator ---
if wtk_fp is not None:
generator = wp.default('WindPowerSingleOwner')
generator.Resource.assign({'wind_resource_model_choice': 0})
generator.Resource.assign({'wind_resource_filename': wtk_fp})
# --- Initialize financial model ---
financial = so.from_existing(generator, 'WindPowerSingleOwner')
print('Wind Power - Single Owner Results')
generator.execute()
#turbine_output=generator.Outputs.turbine_output_by_windspeed_bin
power_output=generator.Outputs.gen
Please Log in or Create an account to join the conversation.
- pgilman
Less
More
- Posts: 5447
22 Apr 2021 12:31 #9495
by pgilman
Replied by pgilman on topic Failure to download 5-min resolution wind data
Hi Jubeyer,
The formatting of the FetchResourceFiles() function documentation makes it a little hard to read, but between it and the Wind Toolkit API documentation, I think you should try changing the value of the resource_type parameter to an empty string (''):
nrel-pysam.readthedocs.io/en/master/Tools.html
developer.nrel.gov/docs/wind/wind-toolkit/wtk-download/
Best regards,
Paul.
The formatting of the FetchResourceFiles() function documentation makes it a little hard to read, but between it and the Wind Toolkit API documentation, I think you should try changing the value of the resource_type parameter to an empty string (''):
nrel-pysam.readthedocs.io/en/master/Tools.html
developer.nrel.gov/docs/wind/wind-toolkit/wtk-download/
Best regards,
Paul.
Please Log in or Create an account to join the conversation.
- Jubeyer
- Topic Author
Less
More
- Posts: 7
22 Apr 2021 12:48 #9497
by Jubeyer
Replied by Jubeyer on topic Failure to download 5-min resolution wind data
OK. I have already tried that one as I have mentioned already, it still downloads 8760 data which is the hourly resolution instead of 8760*12 (for 5 min interval). I am attaching my code here so you can take a look.
Best Regards,
Jubeyer
Best Regards,
Jubeyer
Attachments:
Please Log in or Create an account to join the conversation.
- pgilman
Less
More
- Posts: 5447
22 Apr 2021 15:43 - 22 Apr 2021 15:44 #9503
by pgilman
Replied by pgilman on topic Failure to download 5-min resolution wind data
Hi Jubeyer,
Here is an example of a URL that should download 5-minute wind resource data from the WIND Toolkit API (replace "xxx" with your developer.nrel.gov API key and email address). I tested this with my key and email address, so hopefully it will work with yours:
The source code for the PySAM resource tools functions is here github.com/NREL/pysam/blob/master/files/ResourceTools.py .
Hopefully that is enough information to help you move forward.
Best regards,
Paul.
Here is an example of a URL that should download 5-minute wind resource data from the WIND Toolkit API (replace "xxx" with your developer.nrel.gov API key and email address). I tested this with my key and email address, so hopefully it will work with yours:
Code:
https://developer.nrel.gov/api/wind-toolkit/v2/wind/wtk-download.csv?api_key=xxx&email=xxx@xxx.xxx&wkt=POINT(-105.22+39.75)&attributes=windspeed_80m,winddirection_80m,temperature_80m,pressure_100m&names=2014&utc=false&interval=5
The source code for the PySAM resource tools functions is here github.com/NREL/pysam/blob/master/files/ResourceTools.py .
Hopefully that is enough information to help you move forward.
Best regards,
Paul.
Last edit: 22 Apr 2021 15:44 by pgilman.
Please Log in or Create an account to join the conversation.
- Jubeyer
- Topic Author
Less
More
- Posts: 7
22 Apr 2021 16:05 #9504
by Jubeyer
Replied by Jubeyer on topic Failure to download 5-min resolution wind data
Hi Paul,
Thanks a lot for your reply. However, I was able to download 5-min data in csv format but my issue was with downloading 5-min resoultion data in .srw format which is not working.
Anyway, I have figured a way out. Downloading data in csv format and converting it back to in .srw format but it would be nice if the .srw did work without the workaround.
Regards,
Jubeyer
Thanks a lot for your reply. However, I was able to download 5-min data in csv format but my issue was with downloading 5-min resoultion data in .srw format which is not working.
Anyway, I have figured a way out. Downloading data in csv format and converting it back to in .srw format but it would be nice if the .srw did work without the workaround.
Regards,
Jubeyer
Please Log in or Create an account to join the conversation.
- pgilman
Less
More
- Posts: 5447
22 Apr 2021 16:11 #9507
by pgilman
Replied by pgilman on topic Failure to download 5-min resolution wind data
Hi Jubeyer,
The .srw file download is a special API endpoint that does not support downloading subhourly files.
We have plans to update the download tools to support direct downloads from the WIND Toolkit API rather from this special endpoint.
If you would like to make your code for converting from the CSV format to the SRW format available to other PySAM users, we would welcome your contribution.
Best regards,
Paul.
The .srw file download is a special API endpoint that does not support downloading subhourly files.
We have plans to update the download tools to support direct downloads from the WIND Toolkit API rather from this special endpoint.
If you would like to make your code for converting from the CSV format to the SRW format available to other PySAM users, we would welcome your contribution.
Best regards,
Paul.
Please Log in or Create an account to join the conversation.
Moderators: pgilman