-
Notifications
You must be signed in to change notification settings - Fork 42
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
base: main
Are you sure you want to change the base?
Conversation
... | ||
with open('earthquake.json','w') as data_file: | ||
data_file.write(json.dumps(textData)) |
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.
Does this save what you want, or is it formatted strangely? There may be a related question on Moodle.
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) |
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.
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
.
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.
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!
Answers UCL-MPHY0021-21-22/RSE-Classwork#13
Answers UCL-MPHY0021-21-22/RSE-Classwork#15