Skip to content
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

Gb/bc #148

Merged
merged 4 commits into from
Mar 7, 2023
Merged

Gb/bc #148

merged 4 commits into from
Mar 7, 2023

Conversation

grantbuster
Copy link
Member

No description provided.

Copy link
Collaborator

@ppinchuk ppinchuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments below.

Kind of surprising at first that windspeed would not be bias-corrected in a solar data file even though solar data contains wind speeds. I think the suggestion I threw out could address this discrepancy, but it may not be a big deal.


Parameters
----------
bc_df : None | pd.DataFrame
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can bc_df actually be None? Seems like that would error out (and also not be very useful). My guess is this is leftover text from a pervious version?

Also what do you mean by "extracted DataFrame"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really good at copy pasta. Extracted is left over bc at some point it's either a string filepath or "extracted" e.g. read from the filepath

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha haha

None if not provided or extracted DataFrame with wind or solar
resource bias correction table. This has columns: gid, adder,
scalar. If either adder or scalar is not present, scalar defaults
to 1 and adder to 0. Only windspeed, GHI, and DNI are corrected.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I was surprised that the code only corrects windspeed or GHI + DNI. In retrospect it makes sense, but I think the docstring misled me into thinking the code should do something it does not intend to do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep good point, will edit.

scalar = np.expand_dims(bc_df.loc[site_arr[isin], 'scalar'].values, 0)
adder = np.expand_dims(bc_df.loc[site_arr[isin], 'adder'].values, 0)

if 'windspeed' in self._res_arrays:
Copy link
Collaborator

@ppinchuk ppinchuk Mar 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This almost does not work for NSRD. Are you intentionally relying on the implementation detail of solar data to include an underscore in the variable name (i.e. wind_speed instead of windspeed)? It's possible this is a standard I am not aware of, but it could lead to problems down the line otherwise.

One solution that may not be too much extra work to implement is to ask explicitly for a wind or a solar bc_df (or both!):

def bias_correct(self, wind=None, solar=None):
    ...

Then in reV, users could just specify bias_correct={"wind": "/path/to/wind/bc_df.csv", "solar": "/path/to/solar/bc_df.csv"}, and the _parse_bc function could take care of loading in the DataFrames to pass to this function.

Anyways, I won't insist on anything but just some food for thought

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow haha you're totally right, this could have easily went to wind for solar data and skipped the irrad vars. Easier fix is just to check for 'ghi' first which is the more precise condition.

Copy link
Collaborator

@ppinchuk ppinchuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@grantbuster grantbuster merged commit 348abdd into main Mar 7, 2023
@grantbuster grantbuster deleted the gb/bc branch March 7, 2023 17:19
github-actions bot pushed a commit that referenced this pull request Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants