This is probably somewhat related to #185 but think we could do something to simplify the names of solar columns. Right now the function download_nsrdb_data leaves in place the names from NSRDB (including the issue from #185 that time_utc isn't created). Components like SolarPySAMBase then search for columns using this block of code:
self.ghi_array = self._get_solar_data_array(df_solar, "Global Horizontal Irradiance")
self.dni_array = self._get_solar_data_array(df_solar, "Direct Normal Irradiance")
self.dhi_array = self._get_solar_data_array(df_solar, "Diffuse Horizontal Irradiance")
self.temp_array = self._get_solar_data_array(df_solar, "Temperature")
self.wind_speed_array = self._get_solar_data_array(df_solar, "Wind Speed at")
def _get_solar_data_array(self, df_, column_substring):
"""Get the values of the first column in the df whose name contains the specified substring.
Args:
df_ (pd.DataFrame): The DataFrame to search for the column.
column_substring (str): The substring to look for in the column names.
Returns:
np.ndarray: The values of the matching column as a NumPy array.
"""
for column in df_.columns:
if column_substring in column:
return df_[column].values
raise ValueError(f"Could not find column with substring {column_substring} in df_solar")
In general this feels all a bit untidy, and maybe even confusing since "Wind Speed at" is being used to make us ambivalent to the height, but this would presumably break if two heights included, or choose the first? Some fix up needed here.
This is probably somewhat related to #185 but think we could do something to simplify the names of solar columns. Right now the function
download_nsrdb_dataleaves in place the names from NSRDB (including the issue from #185 thattime_utcisn't created). Components likeSolarPySAMBasethen search for columns using this block of code:In general this feels all a bit untidy, and maybe even confusing since "Wind Speed at" is being used to make us ambivalent to the height, but this would presumably break if two heights included, or choose the first? Some fix up needed here.