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

working with earthquake data set #22

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

YinwenYang
Copy link

@YinwenYang YinwenYang commented Oct 28, 2021

...
with open('earthquake.json','w') as data_file:
data_file.write(json.dumps(textData))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this save what you want, or is it formatted strangely? There may be a related question on Moodle.

Comment on lines +62 to +65
for earthquake in data['features']:
if (get_magnitude(earthquake) > get_magnitude(max_earthquake)):
max_earthquake = earthquake
return get_magnitude(max_earthquake),get_location(max_earthquake)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This solves the problem, but you are calling get_magnitude(max_earthquake) repeatedly. It would be more efficient to store it in a variable, and update it when you find a new max_earthquake.

Copy link
Collaborator

@ageorgou ageorgou left a comment

Choose a reason for hiding this comment

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

You haven't given your plotting file the .py extension, which means that many editors and tools won't recognise it as Python code. This also makes it harder to read on GitHub, for example. Otherwise, the code for the plots looks good!

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.

2 participants