-
Notifications
You must be signed in to change notification settings - Fork 0
Yinbo/zone profile gen refactor #32
Yinbo/zone profile gen refactor #32
Conversation
…ne; Refactor: add plot_boolean to control whether or not plot result profiles
How was this tested to ensure folders are created if none exist? Was the |
Will need to clean up history by getting rid of the |
Run |
Add condition line: if not os.path.exists() to decide if the folder is existed
|
There's some changes that I made to get rid of some debugging lines, e.g. print(). So can I just delete the comment, but keep the changes to code? |
def hourly_load_fit(load_temp_df, plot_boolean): | ||
"""Fit hourly heating, cooling, and baseload functions to load data | ||
|
||
:param pandas.DataFrame load_temp_df: hourly load and temperature data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add text describing this input - see ":param pandas.DataFrame..." and other examples in other functions/scripts. This should include two requested possible values (e.g. "yes" and "no"). There should be a default for it to not produce plots, e.g. plot_boolean="no"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with docstring
prereise/gather/demanddata/bldg_electrification/zone_profile_generator.py
Show resolved
Hide resolved
def main(zone_name, zone_name_shp, base_year, year, plot_boolean=False): | ||
"""Run profile generator for one zone for one year. | ||
|
||
:param str zone_name: name of load zone used to save profile. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment
prereise/gather/demanddata/bldg_electrification/zone_profile_generator.py
Show resolved
Hide resolved
) | ||
plt.xlabel("Temp (°C)") | ||
plt.ylabel("Load (MW)") | ||
if not os.path.exists('./dayhour_fits/dayhour_fits_graphs'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use os.path.isdir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
+ str(round(np.mean(profile), 2)) | ||
+ " MW" | ||
) | ||
if not os.path.exists('./Profiles/Profiles_graphs'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use os.path.isdir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
if not os.path.exists('./Profiles/Profiles_stats'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use os.path.isdir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* feat: puma latitude and longitude added to puma_data dataframe * feat: puma latitude/longitude csv to be appeneded to puma_data * feat: national pumas and balanacing authorities shapefiles * feat: zone profile generator * refactor: linting * refactor: linting * refactor: replace while loop in bkpt_scale() with a sorting method * refactor: move all logic within functions or if block (#26) * refactor: simplify hourly_load_fit and improve pandas 1.3 compatibility (#27) * zone_profile_gen.py updates from Evan - puma.area error fix, cooling equations update, zonal_data() refactor, wb/db fit update, profile year added * feat: updated min daily number of load/temp points to fit to from 8 to 10 * feat: folder for generated profiles * feat: folder for zone day hour coefficients * feat: hourly fits graphs, profile stats export * "profiles, hourly fits, and profile graphs" * graphs * profiles for zones in NY, CA, and TX. update to zone_profile_generator to account for puma_data year update * linting * linting * feat: add wetbulb temp and darkness fraction functions to era5_data_a… (#29) * feat: add wetbulb temp and darkness fraction functions to era5_data_agg.py, now renamed weather_data_agg.py * chore: code style cleanup * chore: import sorting * chore: linting fixes Co-authored-by: Daniel Olsen <[email protected]> * Mike/weather write fix (#30) * fix: reference const.state_list * refactor: save dark_frac output to local files * refactor: save temps_wetbulb to local files * chore: remove unused state_list * style: linting fixes with black * fix: remove 2010 reference for cdd65 * chore: update puma_data * refactor: use base_year from const.py * refactor: rename load_year to base_year * Yinbo/zone profile gen refactor (#32) * Fix: create output folders if the address is not exist on local machine; Refactor: add plot_boolean to control whether or not plot result profiles * test * style: style correction using 'black' * style:switch the order of package importing * style * chore: change os.path.exists to os.path.isdir in order to avoid same file names * chore: add docstring * style: docstring style fixed Co-authored-by: danielolsen <[email protected]> Co-authored-by: Daniel Olsen <[email protected]> Co-authored-by: mbwaite <[email protected]> Co-authored-by: yinboHU <[email protected]>
Pull Request doc
Purpose
Fix errors when running on local machines.
What the code is doing
Changes are on 'zone_profile_generator.py'
Testing
The code is able to run
Where to look
Usage Example/Visuals
Time estimate
5 mins