-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make_SAM_files
and SolarResource.get_SAM_df
updates
#124
Conversation
""" | ||
Get SAM solar resource DataFrame for given site | ||
|
||
Parameters | ||
---------- | ||
site : int | ||
Site to extract SAM DataFrame for | ||
Site to extract SAM DataFrame for. | ||
extra_cols : dict, optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, i like this. Always a good idea to add kwargs that can be endlessly expanded (instead of something like sufrace_albedo=True just to add the single new col).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agreed!
res_df['Minute'] = self.time_index.minute | ||
|
||
time_zone = self.meta.loc[site, 'timezone'] | ||
time_interval = len(self.time_index) // 8760 | ||
|
||
for var in ['dni', 'dhi', 'wind_speed', 'air_temperature']: | ||
main_cols = ['dni', 'dhi', 'wind_speed', 'air_temperature'] | ||
extra_cols = extra_cols or {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting! I've never seen this. So it will go to the {} if extra_cols is bool(False)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup! I love using this pattern when I use an optional input with a default value of None
in the function declaration. I feel it is an elegant way to get around the fact that you should never use mutables as default arguments.
`make_SAM_files` and `SolarResource.get_SAM_df` updates
Added one new input parameter to the
make_SAM_files
and one new input parameter to theSolarResource.get_SAM_df
function to facilitate the addition of user input to files. This was necessary for the processing of the 2020 TMY files for PVWatts (see email chain from Janine Keith starting on January 21, 2022).The new input parameter to
make_SAM_files
isextra_meta_data
, which is a dictionary mapping a meta column name to a meta column value. This allows users to add extra meta data to their output files.The new input parameter to
SolarResource.get_SAM_df
isextra_cols
, which pulls extra data from the SAM solar resource DataFrame. The key of the dictionary represents the name of the column to copy from the SAM solar resource DataFrame, and the value represents the name to give the data in the output.Together, these new options could used likes this:
The output would then look something like this:
Note the addition of
TMY Year
in the meta data and theSurface Albedo
column in the time series data.