I'm working on an LK script that runs a PV model across a large number of weather files (from disk), and I want to set the tilt on the PV array to latitude rounded to the nearest 5 deg. Unfortunately, it appears that when I load a weather file from disk, the location information in SAM (lat/lon/etc.) does not automatically populate from the weather file? Is there a way to force SAM to reload the location metadata from the weather file?
Related to this: can I be confident that even though the GUI is not displaying updated location, that SAM behind the scenes is using the updated latitude, longitude, etc. from the loaded weather file in addition to the irradiance data? Or do I need to change those explicitly using my script?
The location metadata, including latitude and longitude values, that SAM displays in the user interface are from a temporary file (SolarResourceData.csv, in C:\Users\[windows-user-name]l\AppData\Local\SAM\sam-2014.11.24) that SAM creates on installation and again anytime you click Refresh Library on the Location and Resource page. The temporary file only lists metadata from files in the solar resource library. The file makes it possible for SAM to quickly display those values when you move your cursor through the list of locations in the library list -- its only purpose is for displaying values in the UI.
If you choose the User a specific weather file on disk option on the Location and Resource page, SAM does not display location data from that file on the input page. We included that option for LK scripters because the LK script does not interact with the library.
When you run a simulation, SAM takes the latitude, longitude, and elevation values from the weather file, not the temporary file.
In your LK script, to read the latitude value from the weather file, you'll have to read it directly from the file, not from the "Latitude" input variable on the Location and Resource page.
Best regards,
Paul.