Skip to content

Marine Wave Energy model fails to read weather file if Location ID is not a number #1994

@cpaulgilman

Description

@cpaulgilman

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:

  1. Download weather file from SAM Forum post.
  2. Create a new Marine Wave case.
  3. On the Wave Resource page click Add/remove weather file folders and add the folder containing the weather file from Step 1.
  4. Note that weather file does not get added to the library.
  5. Open the weather file with a text editor, and edit the Location ID value in Row to a numeric value.
  6. Repeat Step 3 above.
  7. 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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions