Giter VIP home page Giter VIP logo

recent-quakes's People

Contributors

aculich avatar galaxynight-day avatar

Watchers

 avatar  avatar

recent-quakes's Issues

Unicode Error With Existing Code

We got this error "File "", line unknown
SyntaxError: encoding declaration in Unicode string" when we ran Recent Earthquakes.py. Any ideas why?

Visualization, Plotting the data

After parameterizing the data to account for a specified state, how do I change the plot_data function to account for the change in state. Is the current code fixed to Alaska or is it fluid already?

iPython Notebook - Kernal Issues

Within my iPython notebook there is something wrong internally we are unable to figure out.

Within our data file, we are unable to run, restart, and interrupt kernals from loading. The extensive time to run the kernal causes a kernal to fail and 'die.' Within the Virtual Machine we have an error message:

[IPKernalApp] Bad config encountered during initialization:
[IPKernalApp] The 'pylab' trait of an IPKernalApp instance must be any of['tk', 'qt', 'wx', 'gtk', 'osx', 'inline', 'auto'] or None, but a value to u'incline' <type 'unicode'> was specified.
[NotebookApp] Kernal a7684762-05bd-4f46-aa603-9e2c9b0ab01c failed to respond to heartbeat

How can we fix this in order to run our finalized code? This is out of our knowledge base, and a bit too confusing for us.

helpPlease @stat157 @aculich @kqdtran

Role Assignments

Our team is still unclear as to what the analyst and the presenter should be doing. "All 4 members of your vertical group should work together no matter what individual roles you have assigned." is not sufficiently clear.

Group 1 Reproducibility Issues

Error with code in 2nd cell:

#d = json.loads(urllib.urlopen(url).read())
#data = pd.DataFrame(d.items())
#data

#opening it locally
d = json.load(open('1.0_week.geojson'))
data = pd.DataFrame(d.items())
data

---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-2-6c51623ddb65> in <module>()
      4 
      5 #opening it locally
----> 6 d = json.load(open('1.0_week.geojson'))
      7 data = pd.DataFrame(d.items())
      8 data

IOError: [Errno 2] No such file or directory: '1.0_week.geojson'

Installing pandas on VM

When I try installing Pandas on the VM, I get an error that says:
"Something wicked happened resolving 'us.archive.ubuntu.com:http' (-11 - System error)

For those who get an error for using read_json

The problem is that you need pandas version 0.12 to use read_json. So first, check whether you have most current version of pandas or not. If not, I recommend you to do following steps.

sudo pip install python-dateutil --upgrade
-this sudo code will install package that you will need for updating pandas
sudo easy_install --upgrade pytz
-this sudo code will install package that you will need for updating pandas
sudo apt-get build-dep python-lxml
-this sudo code will install package that you will need for updating pandas
sudo easy_install --upgrade scipy
-this sudo code will install package that you will need for updating pandas
sudo easy_install --upgrade statsmodels
-this sudo code will install package that you will need for updating pandas

sudo easy_install --upgrade pandas
-this will upgrade your pandas package

Folium/Leaflet.js - an alternative way to plot the earthquake data

Folium is a Python package we found out in OH today, and my group proceeded to install and play around with it as an alternative to BaseMap for plotting quakes. It allows you to plot the data in as few as 3 lines of code, using Leaflet.js under the hood.

Leaflet is a Javascript library with awesome interactive maps (and it's also mobile-friendly!). Everything is done in Python using Folium, so there's no html/css/javascript involved.

You can take a look at the examples in the docs to get started with Folium. Here's the interactive earthquake map my group made today http://bl.ocks.org/kqdtran/7063887. It's not really polished yet, but I guess it kinda works. The circle's radius is the magnitude of the quake, and if you click on the circle, it should show the information about the earthquake.

If you decide to play around with Folium, keep us all posted how that goes!

Edit: To install Folium, run sudo pip install folium on the command line!

Accessing JSON data

@reenashah and I are trying to load the JSON data using pandas read_json function (documented here). the problem is, we can't find the URL for the live earthquake data feed. (to replace the line

url = 'http://earthquake.usgs.gov/earthquakes/catalogs/eqs7day-M1.txt'

with a url that loads in the non-deprecated JSON data.

we've been browsing http://earthquake.usgs.gov/earthquakes/feed/ and clicked on a link labeled "API Documentation" but it leads us to a message about the government shutdown.

has anyone successfully located the URL for the live JSON feed?

Need a Group

Hello,

I posted on the facebook group for visualizers saying that I needed a group yesterday, but no one has responded.

If you're in group and have a spot open, please let me join!

My email is [email protected]

Thanks!

Group 10 Reproducibility Issues

Everything works except the code in the last cell

#For any other states
CI=past_7days[past_7days['Src']=='ci']
box1 = {'llcrnrlon' : -130, 'llcrnrlat' :30, 'urcrnrlon' : -70., 'urcrnrlat' : 50}
plot_quakes(CI, box1)

Steps to Curate Data

I'm pretty new to python and I know others are as well.

It would be really helpful if someone could briefly list some steps to curate the data so I can have some direction in my google/stackoverflow searches.

Thanks!

Unicode from USGS website

I was able to successfully read the data into python using json.loads, but after printing, the data appear to be in unicode as everything has a u' in front of it: "u'geometry': {u'type': u'Point', u'coordinates'" for example.
This leads to a problem trying to extract elements because I keep getting these types of attribute errors.
AttributeError: 'unicode' object has no attribute 'iteritems'

Has anyone else had this problem? If so, how did you work around it?

Group 09, Reproducibility Issues - from Group 02

How do I open iPython Notebook? Instructions not present.
Code produces an error when run on my virtual machine:

Error 1:
Can't find Cache file. Using online version and creating one instead.

Error 2:
ALASKA
-179.4843
50.0796
-130
69.1603
/usr/lib/pymodules/python2.7/mpl_toolkits/init.py:2: UserWarning: Module dap was already imported from None, but /usr/lib/python2.7/dist-packages is being added to sys.path
import('pkg_resources').declare_namespace(name)

JSON in iPython Notebook

I installed pandas since I didn't have it previously, as well as the other packages from the preliminary set up steps.

sudo apt-get install python-pandas

I was able to reproduce the iPython Notebook when we read as a csv file, but I'm also having trouble in reading in JSON format. I chose the following feed:
http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/1.0_week.geojson

But when running the cell with code

import urllib
from pandas import read_json

There was an

ImportError: cannot import name read_json

The instructions say

You should use the pandas JSON parser to read the data instead of the read_csv function in the original code.

but I'm not sure why the error is occurring. Also as I was searching online, there seem to be differences between the urllib and urllib2 packages, and sometimes people have been importing json directly and then using json.loads

import json

Am I using the wrong feed or importing the wrong packages or using the wrong functions?

Thanks!

variables in csv is not same variables in JSON

For example,
csv file have Src variable but it seems JSON file does not have variable called Src,
I thought we have to reproduce same output with current dataset. I wonder which variable in Json is equivalent to Src.

Group 2 issue w generalization

The hard-coded values were removed from the plotting function, but they're stored in a dictionary so you can't generalize to do any other regions than california and alaska.
@lauraccunningham

there's a spreadsheet cache of the data, but no way to cache live data. and no mechanism for extracting cached data from the spreadsheet.
there is also no indication of the magnitude or depth of the quakes in the plotting methods, although depth/mag are all in the group's data frame.

otherwise, the group's exact code is reproducible. just not generalizable.

Earthquake Data: Running Homework-03 on your Machine & Visualizations

For the assignment, I understand we all need to individually save our data to run it during the production stages of our homework assignment. Will you be running our code on your own set of cached data as well as ours? or only our cached data?

Regarding Homework-02 due last week, what types of visualizations are you looking for with this assignment? Did you have a preference on how we visualize the data, or do we have free reign as before? If you have a particular example that you think stands out from last week, can you please point us in the right direction so that I can begin thinking about our final project and practice before then.

Ideas about visualization

I wanted to share my ideas about visualization and hopefully get some help on debugging them since our group's data isn't ready yet.

  1. First I want to filter the panda dataframe so that we only have data relevant to the state of interest.

def state_data(state, data):
sdata=data[state in data.location]
return sdata[0:10]

  1. Next, we dig into that data to find values of the bbox by taking max and min long/lats for the new data set.

quakes = state_data("California",data)

from mpl_toolkits.basemap import Basemap

def bbox(quakes):
#create a variable called x to create margins
x=50

#calculate quake bounding box from lat,lon
Max_lat=quakes[,1]+x
Min_lat=quakes[,1]+x
Max_long=quakes[,2]+x
Min_long=quakes[,2]+x
centerlat=mean(quakes[,1])
centerlon=mean(quakes[,2])

#create bounded box
b=[]
return b
  1. Use the bbox to create a nice area for the visualization map

Am I missing anything up to this point? Does any of it not make sense? Also, how do I synch a python compiler to my sublime text 2? Thank you guys!

Datetime and Region

From the data feed I am using, the datetime and region variables don't completely match in format to the one from the older feed based on the text file. Do we need to change the datetime format and also remove the distance and direction info from the region variable?

i.e.
1382220868060 and 92km E of Ciudad Constitucion, Mexico

Group 3 plotting function (plot_quakes())

input parameter names do not match the attribute name in the dataframe:
ex: Longitude in the datafrome, but used dataframe.Lon

also, did not see the points representing the earthquakes...

Group 4 issues

TclError: no display name and no $DISPLAY environment variable]

It also looks like you guys have have hard-coded some things.

Analyzing the Data

Are we supposed to be analyzing the data as well as visualizing the earthquakes?

packages is being added to sys.path from pkg_resources import resource_stream

I got an error when I import read_json

/usr/local/lib/python2.7/dist-packages/pytz-2013.7-py2.7.egg/pytz/init.py:29: UserWarning: Module dap was already imported from None, but /usr/lib/python2.7/dist-packages is being added to sys.path
from pkg_resources import resource_stream

I wonder why i'm having this error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.