Skip to content
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

initial PR for sun angle input #13

Merged
merged 13 commits into from
Jun 6, 2024

Conversation

tomellm
Copy link
Contributor

@tomellm tomellm commented May 22, 2024

#5 Created a second cli function that allows the user to input the sun altitude directly. This avoids having to calculate the shadows completely and just does a sun angle comparison directly.

Doing a quick comparison of the outputs using find and find_sun it seems that they are the same, but there is the obvious difference of how blurred the sun version is. I'm not quite sure as to why that is.

image image

*Will edit notebook once feature is more stable

Please consider that I have practically no knowledge on python best practices so please do correct me on where things should be done differently.

@tomellm tomellm marked this pull request as draft May 22, 2024 18:46
@tomellm
Copy link
Contributor Author

tomellm commented May 23, 2024

@GalenReich

@GalenReich GalenReich marked this pull request as ready for review May 23, 2024 14:42
Copy link
Collaborator

@GalenReich GalenReich left a comment

Choose a reason for hiding this comment

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

Hey! Looks good for a first pass! I've added a few comments, the main thing is about making sure the Finder object can be reused multiple times without getting into a state that breaks. Do ask any questions if anything is unclear.

Formatting with black

I ran the black formatter over the code - it's a handy way of making sure that your Python formatting follows the standard.

I realize that in doing this review the docs for developers are nonexistant in this repo - apologies, that's on me!

You can use poetry install --with dev to get black, and then you can invoke it with black ./ in the project folder and it will format all the Python files to keep things clean and tidy 🧹

shadowfinder/shadowfinder.py Outdated Show resolved Hide resolved
shadowfinder/shadowfinder.py Outdated Show resolved Hide resolved
shadowfinder/shadowfinder.py Outdated Show resolved Hide resolved
shadowfinder/shadowfinder.py Outdated Show resolved Hide resolved
shadowfinder/cli.py Outdated Show resolved Hide resolved
shadowfinder/cli.py Outdated Show resolved Hide resolved
Adds second cli function that allows for direct solar angle input
avoiding having to calculate the shadows across the world.
@tomellm tomellm force-pushed the tom/#5-direct-solar-input branch from 5cce1ce to e998a57 Compare May 23, 2024 16:50
@GalenReich
Copy link
Collaborator

Hi @tomellm, just looking through this now! Thanks! 🙌

As a hopefully helpful note, it's not good practice to force push when you're working on any code with another person (as with a pull request under review). Force pushing rewrites the history of the branch and makes it harder to collaborate and follow the code development. For example, force pushing overwrote my formatting commit - this isn't a problem in this instance, but I wanted to let you know for future reference.

A couple of tips:

Use git pull often when collaborating, it means that your local code won't get behind the code on the origin, and help you avoid merge conflicts.

If you do have to force push, try using git push --force-with-lease it will mean you don't accidentally overwrite commits your local doesn't know about.

Hope that helps - I only found out about --force-with-lease fairly recently and my mind was blown 🤯

@tomellm
Copy link
Contributor Author

tomellm commented May 28, 2024

Hey @GalenReich, sorry for using force push. In all the environments I have been in we have always practiced the rebase and force push approach and avoided committing to someone else's branch unless discussed. But in any case I will stop doing this in the future and thank you for telling me. It makes sense that in a more collaborative environment people would push to each-others branches. ;)

Condition checks that only one of the two input options are set
and not both. Meaning either object/shadow or sun angle
@GalenReich
Copy link
Collaborator

Yeah, my understanding (though I'm happy to be corrected) is that once a PR is opened, committing to the branch is fair game as part of the PR process. And adding more commits once a review is complete just helps track the changes - it'll all get squashed (or merge commited) at the end of the PR anyway, so consolidating commits as you go isn't needed.

But it's all a learning journey, and is ultimately about what works! I'm enjoying reviewing this PR and hope it's interesting and helpful for you! 🚀

@tomellm
Copy link
Contributor Author

tomellm commented May 29, 2024

Yess its definitely very helpful, I'm very happy that you are having so much patience with me ;). As for the commiting, it totally makes sense that once a PR is opened its fair game, I'm just used to a different style I guess. (And the squashing does tackle the consolidation issue).

I would love to work on another issue on this project (or another project) if thats welcome. Also feel free to merge this one if the last changes work for you.

@GalenReich
Copy link
Collaborator

Okay, this is looking great! Thank you so much for your hard work. I'm going to do some testing now myself, and amend the accompanying notebook so it includes the new feature! Then I'll get it all merged in one go 🌟

@GalenReich GalenReich self-assigned this May 31, 2024
@GalenReich GalenReich linked an issue May 31, 2024 that may be closed by this pull request
@GalenReich GalenReich merged commit 9ac3f15 into bellingcat:main Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add direct solar angle input
2 participants