Skip to content

Commit

Permalink
Fixed bug in Notebook version
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Sahlberg authored and Andreas Sahlberg committed Mar 15, 2023
1 parent bfa8a84 commit 20c741b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions OnSSET_notebook.ipynb
Expand Up @@ -416,6 +416,11 @@
},
"outputs": [],
"source": [
"try:\n",
" onsseter.df.reset_index(inplace=True)\n",
"except ValueError:\n",
" pass\n",
"\n",
"yearsofanalysis = [intermediate_year, end_year]\n",
"\n",
"onsseter.condition_df()\n",
Expand Down Expand Up @@ -450,7 +455,11 @@
" 'diesel_truck_consumption': 14,\n",
" 'diesel_truck_volume': 300}\n",
"\n",
" onsseter.diesel_cost_columns(sa_diesel_cost, mg_diesel_cost, year)"
" try:\n",
" onsseter.diesel_cost_columns(sa_diesel_cost, mg_diesel_cost, year)\n",
" except ValueError:\n",
" print('To update the diesel cost, please re-run the notebook from the first cell')\n",
" break"
]
},
{
Expand Down Expand Up @@ -903,7 +912,7 @@
"anaconda-cloud": {},
"celltoolbar": "Raw Cell Format",
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -917,7 +926,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.10.6"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion onsset/onsset.py
Expand Up @@ -1072,7 +1072,7 @@ def calibrate_elec_current(self, elec_actual, elec_actual_urban, elec_actual_rur
self.df.loc[
(self.df[SET_ELEC_CURRENT] == 1), SET_ELEC_POP_CALIB] *= 1.1
self.df[SET_ELEC_POP_CALIB] = np.minimum(self.df[SET_ELEC_POP_CALIB], self.df[SET_POP_CALIB])
total_elec_modelled = self.df.loc[self.df[SET_ELEC_CURRENT] == 1, SET_ELEC_POP_CALIB.sum()]
total_elec_modelled = self.df.loc[self.df[SET_ELEC_CURRENT] == 1, SET_ELEC_POP_CALIB].sum()
total_elec_factor = total_elec_modelled / (urban_electrified + rural_electrified)
i += 1
else:
Expand Down

0 comments on commit 20c741b

Please sign in to comment.