Describe the bug
SAM's weather file reader generates an error if the first two rows of a SAM CSV file have a different number of columns, assuming they are header rows with comma-separated values.
This helped us recently identify some of the NSRDB weather files that had missing version numbers, and this new issue with commas in come of the header values.
Consider making the weather file check more robust so that it continues to work over time as the information in the header rows changes. SAM only needs the latitude, longitude, elevation, and time zone from the header, so ideally should be able to read the file as long as that information is available.
To Reproduce
- Download and extract sample SAM CSV file with unequal number of columns in first two header rows:
33.73_-118.26_33.7323_-118.263_psm3-tmy_60_tmy.zip
- Start SAM and run Solar Resource File Checker macro.
- See error
Expected behavior
Error should only be generated if latitude, longitude, elevation and/or time zone is missing from header (or invalid?)
Additional Notes
The online PVWatts Calculator and PVWatts API run the weather file checker, so solution needs to work with weather files returned by https://developer.nrel.gov/docs/solar/data-query/v2/ in addition to weather files from the NSRDB (test NSRDB PSM3 tmy-2020 data for Washington, DC addresses).
Describe the bug
SAM's weather file reader generates an error if the first two rows of a SAM CSV file have a different number of columns, assuming they are header rows with comma-separated values.
This helped us recently identify some of the NSRDB weather files that had missing version numbers, and this new issue with commas in come of the header values.
Consider making the weather file check more robust so that it continues to work over time as the information in the header rows changes. SAM only needs the latitude, longitude, elevation, and time zone from the header, so ideally should be able to read the file as long as that information is available.
To Reproduce
33.73_-118.26_33.7323_-118.263_psm3-tmy_60_tmy.zip
Expected behavior
Error should only be generated if latitude, longitude, elevation and/or time zone is missing from header (or invalid?)
Additional Notes
The online PVWatts Calculator and PVWatts API run the weather file checker, so solution needs to work with weather files returned by https://developer.nrel.gov/docs/solar/data-query/v2/ in addition to weather files from the NSRDB (test NSRDB PSM3 tmy-2020 data for Washington, DC addresses).