solaranywhere weather data compatibility issue?

7 posts / 0 new
Last post
solaranywhere weather data compatibility issue?

I am attempting to use a time series csv file from (TMY3 format).

SAM 2014.11.24 appears to be unable to read the file...I'm wondering whether an incompatibility was introduced with 2014.11.24?

I've attached error message screenshots and the csv file I'm attempting to use.

Thanks for any help..

Paul Gilman

Dear Doug,

There are a couple issues with the TMY3 format file generated by SolarAnywhere that will prevent it from running in SAM:

  • Missing data. Some columns have no values, and some rows may have missing values.
  • The time stamp is inconsistent with the TMY3 time convention: The hour time stamp for the last hour of the day is 0:00 instead of 24:00, and the final hour of the year is on January 1 instead of December 31.

I've written an LK script that you can use in SAM to convert your file to the SAM CSV format that SAM can read. To use it:

  1. Download the script (LK 4.65 KB).
  2. Start SAM, and click Open script and open the LK file you downloaded in Step 1. (If SAM is already open, you can open the script SAM Start menu.) Read the description of what the script does in the comment block at the top of the script.
  3. Click Run at the top of the scripting window. If all goes well, the script should create a SAM CSV file with the data from your SolarAnywhere file and save it in the same folder as the SolarAnywhere file.
  4. Open your SAM project file, and on the Location and Resource page, add the folder that contains the SAM CSV file to the Folder Settings list (click Folder Settings) and refresh the library.
  5. Click View hourly data to see the data. Missing data should be visible in the graphs as -999 values.

Best regards,

Paul Gilman

For an expanded version of the SolarAnywhere conversion script, see the LK Script Cookbook on the Sample Files page. The script performs the following conversion tasks:

  • Convert SolarAnywhere and SolarAnywhere TMY3 files to SAM CSV. The script determines the input file format from the number of columns in the header row. This simple approach should be robust enough for files from SolarAnywhere, but may cause problems if you try to convert files that are not in one of the SolarAnywhere formats.
  • For SolarAnywhere files with historical data over a multi-year period, the script creates a separate SAM CSV file for each year and appends the year to the file name so that you can use the set of files for P50/P90 simulations in SAM.
  • The script replaces blanks in the original file with -999 flag values in the SAM CSV file to avoid simulation errors in SAM. See the comments in the script for more details about how this might affect simulations.
  • When you convert a file with one year of data, the script displays the converted file in the time series data viewer.

To use the script:

  1. Download the LK file from the Sample Files page.
  2. Start SAM, and click Open Script on the Welcome page. You do not need to run the script from an open case.
  3. Navigate to the folder that contains the LK script and open it.
  4. Read the information about the script in the comments, which appear as green text in the script editing window.
  5. Click Run at the top of the script editing window and open the SolarAnywhere file you want to convert.

    The script will save the converted SAM CSV file(s) in the folder that contains the original SolarAnywhere file. To use the SAM CSV files in SAM, you can either add them to your weather file folder, or use the Use a specific weather file on disk option. See the Help topic "Weather Files and Libraries" under "Weather Data" for more details.

The SolarAnywhere data is only suitable for SAM's photovoltaic and solar water heating models because it does not contain metorological data for atmospheric pressure and humidity required by the concentrating solar power models.

Best regards,


I have the script and have tested it against all 3 versions of the SolarAnywhere data files. I'm running into a problem with the non-TMY3 files; I am more specifically concerned about the SolarAnywhere, standard top of hour, end of period integration files. The error message that occurs is: error: array index out of bounds: 9 (len: 8) in line 165 (data[6] = arr[9]; // dhi) that is part of the conversion process. If I comment out the line the code runs fine and seems to convert the file correctly, but I wanted to make sure that I wasn't losing important data in the process or if there is a better solution.

Thank you.

Paul Gilman

Hello ngierty,

Would you mind emailing me the file you are trying to convert? I want to make sure to test the script with a file in the same format that you are using, and the best way to do that is to use your file.

Best regards,

piphomer's picture

Hi Paul,

When I download the script at the link at the top of this page, it converts my CPR files perfectly. When I try to use the script built into SAM (under Macros - Solar Resource File Converter), it fails. Is there a difference between the two scripts? Can you update the script in SAM so that it's the same as the downloadable one?



Paul Gilman

Hi Phillip,

Thank you for the suggestion. The script is different from the macro -- I made some improvements to the version posted on the Samples page.

We should be able to update the macro version of the script for the next release of SAM.

Best regards,

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer