Skip to content

Commit

Permalink
Fix jupyter notebook so it works regardless of loop name
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenkj1 committed Oct 10, 2023
1 parent fd0b0ea commit 7acff85
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions SolarEnergy/Irradiance/PowerGraphs-AvonRd.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,30 @@
"outputs": [],
"source": [
"import os\n",
"import glob\n",
"from pathlib import Path\n",
"import pandas\n",
"import json\n",
"import math\n",
"from matplotlib import pyplot\n",
"\n",
"mdp = os.path.join(Path.home(), 'data')\n",
"chkfldr = os.path.join(mdp, os.listdir(mdp)[0])\n",
"\n",
"def getdataframe(fname):\n",
" if os.path.isfile(fname):\n",
" jsonpath = fname\n",
" else:\n",
" mdp = os.path.join(os.getcwd(), 'data')\n",
" jsonpath = os.path.join(mdp, os.listdir(mdp)[0], fname)\n",
" print(\"Loading\", jsonpath)\n",
" datf = pandas.read_json(jsonpath)\n",
" return datf\n",
"\n",
"# Load in the Dataframes for the various PV array configurations\n",
"dfs = []\n",
"dfldrcont = glob.glob(os.path.join(chkfldr, \"*.json\"))\n",
"for i in range(4):\n",
" filenam = f\"loop-parallel-1-model-1-{i}-modeldata.json\"\n",
" filenam = dfldrcont[i]\n",
" tdf = getdataframe(filenam)\n",
" dfs.append(tdf)\n",
"# Now scale (by area) and sum the datafiles Azim, 0: 70 deg., 1: 250 , 2: 150, 3: 330\n",
Expand Down

0 comments on commit 7acff85

Please sign in to comment.