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

Ideas about visualization #19

Open
davidwang001 opened this issue Oct 21, 2013 · 1 comment
Open

Ideas about visualization #19

davidwang001 opened this issue Oct 21, 2013 · 1 comment

Comments

@davidwang001
Copy link

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!

@timothyhoang
Copy link

That sounds like a good idea, but I don't know how you can generalize the function plot_quakes by using bbox(quakes), because bbox(quakes) would have to return something different for different areas/countries/states,
but only takes in one parameter. It might just be easier to add parameters for the bounding box in plot_quakes:

plot_quakes(quakes, centerlat, centerlon, dimensionsOfBoundingBox)

Keep in mind that bounding box for basemap is determined by 2 corner points, which are determined by 4 parameters - so you need to initialize:

llcrnrlon - lower left hand corner longitude degree
llcrnrlat - lower left hand corner latitude degree
urcrnrlon - upper right hand corner longitude
urcrnrlat - upper right hand corner latitude

From the looks of you bbox code, it might be easier to do something lke this:

#calculate quake bounding box from centerlat,centerlon for a region of dimensions a x a you want to plot around  point (centerlon, centerlat) 

Max_lat=centerlat+a
Min_lat=centerlat-a
Max_long=centerlon+a
Min_long=centerlon-a

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

No branches or pull requests

2 participants