コード例 #1
0
BIN_EDGES = list()
COUNTS = list()
CUMML = list()


if n > 0:
	print "- number of places = {}".format(n)

	for c in range(n): # for each volcano in the list

		print "PROCESSING %s" % place[c]
	
		# how many earthquakes have there been in the last week?
		subset_expr = "time > %f && deg2km(distance(lat, lon, %s, %s))<20.0" % (twoweeksagoepoch, lat[c], lon[c])
		print subset_expr
		dictorigin, n = modgiseis.dbgetorigins(catalogpath, subset_expr)
		print "- number of events in past week = {}".format(n)

		# if > 0, load all time history and bin them 
		if n > 0:
			subset_expr = "time > %f && deg2km(distance(lat, lon, %s, %s))<20.0" % (epoch1989, lat[c], lon[c])
			print "'%s'" % subset_expr
                	dictorigin, n = modgiseis.dbgetorigins(catalogpath, subset_expr)
			print "- number of events in all-time = {}".format(n)
			time = dictorigin['time']
			time_firstevent = time[0] # assuming they are sorted
			if verbose:
				print 'firstevent: %s' % modgiseis.datenum2datestr(time_firstevent)
				print 'lastevent: %s' % modgiseis.datenum2datestr(time[-1])
			bin_edges, snum, enum = modgiseis.compute_bins(dictorigin, time_firstevent, datenumnow, 7.0) # function name is a misnomer - we are computing bin_edges
コード例 #2
0
            		verbose = True
        	elif o in ("-h", "--help"):
            		usage()
            		sys.exit()
        	else:
            		assert False, "unhandled option"

	if verbose:
		print "dbpath = " + dbpath
		print "outfile = " + outfile
		print "subset_expr = " + subset_expr

	######## LOAD THE EVENTS 
	# load events from the database dbpath, and apply subset_expr if there is one
	dictorigin = dict();
	dictorigin, numevents = modgiseis.dbgetorigins(dbpath, subset_expr)

	# if we loaded some events, create plots
	if numevents > 0:

		###### PLOT DATA HERE 

		# Let matplotlib automatically decide where to put date (x-axis) tick marks, and what style of labels to use
		locator = mpl.dates.AutoDateLocator()
		formatter = mpl.dates.AutoDateFormatter(locator)

		# create the figure canvas
		fig1 = plt.figure()

		# add subplot - ml versus time
		ax1 = fig1.add_subplot(311)
コード例 #3
0
BIN_EDGES = list()
COUNTS = list()
CUMML = list()

if n > 0:
    print "- number of places = {}".format(n)

    for c in range(n):  # for each volcano in the list

        print "PROCESSING %s" % place[c]

        # how many earthquakes have there been in the last week?
        subset_expr = "time > %f && deg2km(distance(lat, lon, %s, %s))<20.0" % (
            twoweeksagoepoch, lat[c], lon[c])
        print subset_expr
        dictorigin, n = modgiseis.dbgetorigins(catalogpath, subset_expr)
        print "- number of events in past week = {}".format(n)

        # if > 0, load all time history and bin them
        if n > 0:
            subset_expr = "time > %f && deg2km(distance(lat, lon, %s, %s))<20.0" % (
                epoch1989, lat[c], lon[c])
            print "'%s'" % subset_expr
            dictorigin, n = modgiseis.dbgetorigins(catalogpath, subset_expr)
            print "- number of events in all-time = {}".format(n)
            time = dictorigin['time']
            time_firstevent = time[0]  # assuming they are sorted
            if verbose:
                print 'firstevent: %s' % modgiseis.datenum2datestr(
                    time_firstevent)
                print 'lastevent: %s' % modgiseis.datenum2datestr(time[-1])
コード例 #4
0
        				try:
                				os.makedirs(htmldir)
        				except:
                				sys.exit("Could not make directory %s" % htmldir)

        	else:
            		assert False, "unhandled option"

	if verbose:
		print "dbpath = " + dbpath
		print "description = " + description

	######## LOAD THE EVENTS 
	# load events from the database dbpath, and apply subset_expr if there is one
	dictorigin = dict();
	dictorigin, numevents = giseis.dbgetorigins(dbpath, subset_expr)

	# read the dict of places
	dictplaces = dict()
	dictplaces = read_volcanoes()
	n_week = dict()
	n_year = dict()
	RADIUS_IN_KM = 25.0

	for index in dictplaces.keys():
	        record = dictplaces[index]
	        print "\nProcessing " + record['place'] + ":"
	        radius_expr = "deg2km(distance(lat, lon, " + record['lat'] + ", " + record['lon'] + ")) < %f" % RADIUS_IN_KM
	
	        # create the figure canvas
	        fig1 = plt.figure()