NatLabRockies / NatLabRockies/SAM
Marine Wave Energy model fails to read weather file if Location ID is not a number
Open
@mjprilliman is already working on this.
Since Jan 22, 2025.
bug
- Dominant language
- C++
- Stars
- 486
- Forks
- 219
- Avg merge
- 10h 10m
- Merged PRs (30d)
- 2
Description
Describe the bug
When the Location ID in the weather file is not a number, the std::stod() function used to read the value returns an error and stops the file reading process.
See https://sam.nrel.gov/forum/forum-general/4905-wave-resource-simulation.
To Reproduce
Steps to reproduce the behavior:
- Download weather file from SAM Forum post.
- Create a new Marine Wave case.
- On the Wave Resource page click Add/remove weather file folders and add the folder containing the weather file from Step 1.
- Note that weather file does not get added to the library.
- Open the weather file with a text editor, and edit the Location ID value in Row to a numeric value.
- Repeat Step 3 above.
- Note weather file is added to library.
In general, I think anytime std::stod() or std::stof() is used, the value returned should be checked and if it is invalid (not a number), a useful error message should be generated. (This is also an issue with the wind file reader.)
Operating System and Version
- SAM 2024.12.12
- Windows 11
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.