Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

feat: add wetbulb temp and darkness fraction functions to era5_data_a… #29

Merged
merged 4 commits into from
Jan 19, 2022

Conversation

evanpatz
Copy link
Collaborator

…gg.py, now renamed weather_data_agg.py

Pull Request doc

Purpose

What is the larger goal of this change?
Add wetbulb temperature and darkness fraction functions to era5_data_agg script, now named weather_data_agg.py

What the code is doing

How is the purpose executed?
The same code that was used to generate wetbulb temperatures and darkness fractions, just moved into modular functions within this script

Testing

How did you test this change (unit/functional testing, manual testing, etc.)?
New functions produced correct output csv's.

Where to look

  • It's helpful to clarify where your new code lives if you moved files around or there could be confusion/
    New functions added to this file:
    -dark_fractions()
    -generate_dark_fracs()

-t_to_twb()
-generate_wetbulb_temps()

  • What files are most important?
    weather_data_agg.py

Time estimate

How long will it take for reviewers and observers to understand this code change?
5 minutes

@danielolsen danielolsen force-pushed the evan/zone_profile_gen branch from 41d7685 to 5ef9b71 Compare January 4, 2022 23:03
@danielolsen danielolsen force-pushed the evan/weather_data_agg branch 2 times, most recently from cd7fcda to 55ba46c Compare January 4, 2022 23:10
@danielolsen danielolsen force-pushed the evan/zone_profile_gen branch from 5ef9b71 to 3bf669a Compare January 5, 2022 16:38
@danielolsen danielolsen force-pushed the evan/weather_data_agg branch from 55ba46c to ad7411c Compare January 5, 2022 16:41
Copy link
Contributor

@mbwaite mbwaite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from my end

@danielolsen danielolsen force-pushed the evan/weather_data_agg branch from 3d44358 to 84cbe57 Compare January 12, 2022 21:34
Copy link
Collaborator

@danielolsen danielolsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few minor places where we will want to clean things up, but I think this is safe to merge into evan/zone_profile_gen for now, and we can focus on those issues (and any others that pop up) before that branch gets merged.

)


state_list = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we have state abbreviations in prereise.gather.const, we can use them (plus "DC", and minus "AK" and "HI") to build this list.

Comment on lines +313 to +316
puma_dark_frac.to_csv(
f"https://besciences.blob.core.windows.net/datasets/bldg_el/pumas/dark_frac/dark_frac_pumas_{state}_{year}.csv",
index=False,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the meaning here (and within generate_wetbulb_temps) is 'save these CSVs, then upload them to the blob storage so that they can be retrieved later', but please correct me if I'm wrong.

If so, I don't think we can currently write to the blob storage this way, so we'll need to change this to write to local files and then perform the upload ourselves.

Comment on lines -66 to +71
# Create folder to store data for given variable if it doesn't yet exist
# Create folder to store data for given variable if it doesn"t yet exist
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

black is being silly

Copy link
Collaborator

@limingzhou2004 limingzhou2004 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the only thing left is to add several libraries into the pipenv file, cdsapi, psychrolib, xarray, suntime.

@mbwaite mbwaite merged commit 552dadc into evan/zone_profile_gen Jan 19, 2022
mbwaite pushed a commit that referenced this pull request Jan 20, 2022
#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]>
@mbwaite mbwaite deleted the evan/weather_data_agg branch January 24, 2022 21:01
mbwaite added a commit that referenced this pull request Jan 25, 2022
* 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]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants