-
Notifications
You must be signed in to change notification settings - Fork 1
Sourcery Starbot ⭐ refactored redblackeagleman/peak-flow-calculator #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| Peak-Flow Calculator "Lite". Use with pre-calculated slope and flow direction rasters. | ||
| """ | ||
| output_data = main( | ||
| return main( |
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.
Function lite refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| output_data = main( | ||
| return main( |
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.
Function full refactored with the following changes:
- Remove unreachable code (
remove-unreachable-code) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| tc_hr = const_a * math.pow(max_flow_length, const_b) * math.pow((mean_slope / 100), const_c) | ||
| return tc_hr | ||
| return ( | ||
| const_a | ||
| * math.pow(max_flow_length, const_b) | ||
| * math.pow((mean_slope / 100), const_c) | ||
| ) |
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.
Function calculate_tc refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
|
|
||
| # Skip the first 10 rows of the csv, which are assorted header information. | ||
| for j in range (1, 11): | ||
| for _ in range (1, 11): |
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.
Function precip_table_etl_cnrccep refactored with the following changes:
- Replace assignment with augmented assignment (
aug-assign) - Replace unused for index with underscore (
for-index-underscore)
| h = tuple([ | ||
| i for i in list(etl.header(t2)) if (int(i) >= frequency_min and int(i) <= frequency_max) | ||
| ]) | ||
| h = tuple( | ||
| i | ||
| for i in list(etl.header(t2)) | ||
| if (int(i) >= frequency_min and int(i) <= frequency_max) | ||
| ) | ||
|
|
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.
Function precip_table_etl_noaa refactored with the following changes:
- Replace unneeded comprehension with generator (
comprehension-to-generator)
| if not isinstance(dem,Raster): | ||
| dem = Raster(dem) | ||
|
|
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.
Function prep_cn_raster refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp)
|
|
||
| cs = env.outputCoordinateSystem.exportToString() | ||
|
|
||
| # SOILS ------------------------------------- | ||
|
|
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.
Function build_cn_raster refactored with the following changes:
- Remove unnecessary call to keys() (
remove-dict-keys)
| results = {} | ||
|
|
||
| # make a raster object with the catchment raster | ||
| if not isinstance(catchment_areas,Raster): | ||
| c = Raster(catchment_areas) | ||
| else: | ||
| if isinstance(catchment_areas,Raster): | ||
| c = catchment_areas |
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.
Function derive_data_from_catchments refactored with the following changes:
- Remove unnecessary call to keys() (
remove-dict-keys)
| if where == "in_memory": | ||
| location = "in_memory" | ||
| elif where == "fgdb": | ||
| location = env.scratchGDB | ||
| elif where == "folder": | ||
| if where == "folder": | ||
| location = env.scratchFolder | ||
| elif where == "in_memory": | ||
| location = "in_memory" | ||
| else: | ||
| location = env.scratchGDB | ||
|
|
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.
Function so refactored with the following changes:
- Simplify conditional into switch-like form (
switch)
Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨
Here's your pull request refactoring your most popular Python repo.
If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.
Review changes via command line
To manually merge these changes, make sure you're on the
masterbranch, then run: