Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Working with the US Geological Survey earthquake data set #12

Open
ageorgou opened this issue Oct 23, 2020 · 0 comments
Open

Working with the US Geological Survey earthquake data set #12

ageorgou opened this issue Oct 23, 2020 · 0 comments
Labels

Comments

@ageorgou
Copy link

ageorgou commented Oct 23, 2020

This exercise will look at how to read data from an online source (web service), explore and and process it.
You will write some code, then review each other's work on GitHub and discuss on Moodle.

Step 0: Setup

Make sure you have read the note chapters on working with files, Internet data and structured data files.

Set up your copy of this repository following the guide on Moodle. Then pull the latest changes (git pull upstream) and checkout the branch week04 (git checkout week04).

Step 1: Exploration

Read the exercise description in the lecture notes.
Your task will be to find the location and magnitude of the strongest earthquake in the UK in the last century. You don't need to create any maps or other plots!

Before you start, take some time to understand the structure of the data. To see the data, you can try different things; for example:

  • Get the response as shown in the exercise description: quakes = requests.get(...)
  • Save the response body (quakes.text) in a text file (give the file an appropriate extension to help applications display it nicely!)
  • Open the file in an editor like VS Code (you may want to automatically format it to make it look nicer). Some browsers may also display it so that the structure is clear.

The following questions may help you explore and understand how the data is laid out:

  • What format is the returned data (response.text) in? Can you read it into a data structure programatically?
  • How many broad "sections" does this response comprise?
  • How many earthquakes are returned? (hint: is there any metadata included that could tell you this? How would you interpret it?)
  • One section ("features") is by far larger than the others. How many entries does it hold?
  • Pick one feature in this big list:
    • Can you see its location? Is that as a place name or coordinates?
    • Can you see its magnitude?
    • How do you think the time of the earthquake is represented?

Step 2: Coding and discussion

When you think you understand enough, start writing your answer in the week04/quakes.py file in your fork.

When you are happy with your solution (or want some feedback!):

  1. Push your new code to your own fork.
  2. On GitHub, open a pull request from your fork to the week04 branch of the original repository.
  3. In the description, include the text Answers UCL-RITS/rse-classwork-2020#12. If you have finished the exercise, also give the answers you found (e.g. "The maximum magnitude is 3 and it occurred at coordinates (4.0, -3.8)."
  4. On Moodle, in the discussion forum for this exercise, open a new thread and give the URL of your pull request.
  5. Choose one of the other pull requests listed on that forum, and leave a review. Comment on things you find interesting or don't understand, any problems you think you spot, good solutions or potential improvements.
  6. You can also start a discussion on that forum if you want! It will only be visible to the six people in your group.

Sample solution

@poppynikou poppynikou mentioned this issue Oct 27, 2020
nuttamas added a commit to nuttamas/rse-classwork-2020 that referenced this issue Oct 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant