Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions hourlize/reeds_to_rev.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ def get_retirements_of_preexisting(df_cap_exog, years):
)
df_ret_exist = df_cap_exog.copy()
df_ret_exist["MW"] = df_ret_exist.groupby(["tech", "region"])["MW"].diff()
df_ret_exist["MW"].fillna(0, inplace=True)
df_ret_exist["MW"] = df_ret_exist["MW"].fillna(0)
df_ret_exist["MW"] = df_ret_exist["MW"] * -1
else:
df_ret_exist = pd.DataFrame()
Expand Down Expand Up @@ -2163,7 +2163,7 @@ def run(
save_outputs(df_sc_out, out_dir_path, tech, reduced_only)

except Exception as e: # pylint: disable=broad-exception-caught
print(f"***Error for {rev_row.tech}...\n{traceback.format_exc()}")
print(f"***Error for {rev_row.tech}...")
raise e

print("Completed reeds_to_rev!")
Expand Down
4 changes: 2 additions & 2 deletions postprocessing/retail_rate_module/ferc_distadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def get_ferc_costs(
(dfall.t == 1993) | (dfall.state.isin(['AK','HI']))
].index).reset_index(drop=True)
### Assign DC to MD (since that's how ReEDS treats it)
dfall.state.replace({'DC':'MD'}, inplace=True)
dfall['state'] = dfall['state'].replace({'DC':'MD'})
### Fill missing states
dfall.state = dfall.apply(lambda row: missingstates.get(row['Utility Name'],row.state), axis=1)
### Add a column for region
Expand Down Expand Up @@ -446,7 +446,7 @@ def get_ferc_costs(
df_extrapolate_dim['t'] = df_extrapolate_dim['index'] + df_loop['t'].max() + 1

df_extrapolate_dim['index'] = numprojyears - df_extrapolate_dim['index']
df_extrapolate_dim['index'][df_extrapolate_dim['index'].values < 0] = 0
df_extrapolate_dim.loc[df_extrapolate_dim['index'] < 0, 'index'] = 0

# List the years of historical data used for extrapolation
slopeyears = np.array(df_loop['t'].tail(numslopeyears))
Expand Down
8 changes: 4 additions & 4 deletions postprocessing/retail_rate_module/retail_rate_calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,13 +876,13 @@ def main(run_dir, inputpath='inputs.csv', write=True, verbose=0):
on=['i', 't'], how='left')
# Fill in any missing eval_period with the default 20 years
# This should apply to upgrades only
df_gen_capex['eval_period'].fillna(20, inplace=True)
df_gen_capex['eval_period'] = df_gen_capex['eval_period'].fillna(20)
df_gen_capex = df_gen_capex.merge(
depreciation_sch[['i', 't', 'depreciation_sch']],
on=['i', 't'], how='left')
# Fill in any missing eval_period with the default 20 years
# This should also apply to upgrades only
df_gen_capex['depreciation_sch'].fillna('20', inplace=True)
df_gen_capex['depreciation_sch'] = df_gen_capex['depreciation_sch'].fillna('20')

#%% # For historical capital expenditures, we use a pre-calculated result.
# The expenditures are based on a EIA-NEMS database of historical capacity
Expand Down Expand Up @@ -919,11 +919,11 @@ def main(run_dir, inputpath='inputs.csv', write=True, verbose=0):
eval_period_init[['i', 'region', 't', 'eval_period']],
on=['i', 'region', 't'], how='left')
# Fill in any missing eval_period with the default 20 years
df_gen_capex_init['eval_period'].fillna(20, inplace=True)
df_gen_capex_init['eval_period'] = df_gen_capex_init['eval_period'].fillna(20)
df_gen_capex_init = df_gen_capex_init.merge(
dep_sch_init[['i', 'region', 't', 'depreciation_sch']],
on=['i', 'region', 't'], how='left')
df_gen_capex_init['depreciation_sch'].fillna('20', inplace=True)
df_gen_capex_init['depreciation_sch'] = df_gen_capex_init['depreciation_sch'].fillna('20')

#%% # Combine both new and historical capital expenditures
df_gen_capex = pd.concat(
Expand Down
4 changes: 2 additions & 2 deletions reeds/input_processing/recf.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def main(reeds_path, inputs_case):
recf = pd.concat(
[df_windons, df_windofs, df_upv, df_distpv]
+ [df_pvb[pvb_type] for pvb_type in df_pvb],
sort=False, axis=1, copy=False)
sort=False, axis=1)

### Downselect RECF data to resource adequacy and weather years
recf = recf.loc[recf.index.year.isin(resource_adequacy_years)]
Expand All @@ -444,7 +444,7 @@ def main(reeds_path, inputs_case):

# Sorting profiles of resources to match the order of the rows in resources
resources = resources.sort_values(['resource','area'])
recf = recf.reindex(labels=resources['resource'].drop_duplicates(), axis=1, copy=False)
recf = recf.reindex(labels=resources['resource'].drop_duplicates(), axis=1)

### Scale up distpv by 1/(1-distloss)
recf.loc[
Expand Down
4 changes: 4 additions & 0 deletions reeds/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def flush(self):
datefmt="%Y-%m-%d %H:%M:%S",
handlers=[logging.FileHandler(logpath, mode='a'), sh, eh],
)
### Route warnings.warn() through the logging system at WARNING level.
### Without this they reach the sys.stderr redirect below and get logged as ERROR.
logging.captureWarnings(True)

log = logging.getLogger(__name__)
sys.stdout = StreamToLogger(log, logging.INFO)
sys.stderr = StreamToLogger(log, logging.ERROR)
Expand Down
Loading