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 cs ratio #127

Merged
merged 4 commits into from
Dec 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
added method to bias correct based on baseline clearsky ratio
  • Loading branch information
grantbuster committed Dec 20, 2022
commit f88dde5c0d6c167279ac1653d4cddb8cca5fc262
13 changes: 12 additions & 1 deletion sup3r/bias/bias_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ def get_base_data(base_fps, base_dset, base_gid, base_handler,

out = []
out_ti = []
base_cs_ghi = None
for fp in base_fps:
with base_handler(fp) as res:
base_ti = res.time_index
Expand All @@ -384,6 +385,10 @@ def get_base_data(base_fps, base_dset, base_gid, base_handler,
else:
base_data = -base_ws * np.cos(np.radians(base_wd))

elif base_dset == 'clearsky_ratio':
base_data = res['ghi', :, base_gid]
base_cs_ghi = res['clearsky_ghi', :, base_gid]

else:
base_data = res[base_dset, :, base_gid]

Expand All @@ -394,7 +399,13 @@ def get_base_data(base_fps, base_dset, base_gid, base_handler,
slices = [np.where(base_ti.date == date)
for date in sorted(set(base_ti.date))]
base_ti = np.array(sorted(set(base_ti.date)))
if daily_reduction.lower() == 'avg':

if (base_dset == 'clearsky_ratio'
and daily_reduction.lower() == 'avg'):
base_data = np.array([base_data[s0].sum()
/ base_cs_ghi[s0].sum()
for s0 in slices])
elif daily_reduction.lower() == 'avg':
base_data = np.array([base_data[s0].mean()
for s0 in slices])
elif daily_reduction.lower() == 'max':
Expand Down