#connect SQL database
    SQL_db = os.path.join(DATABASE_DIR, 'timeline.db')
    
    stations, subdir_len = psstationSQL.get_stationsSQL(SQL_db, 
                           xml_inventories=xml_inventories,
                           dataless_inventories=dataless_inventories,
                           startday=FIRSTDAY,
                           endday=LASTDAY,
                           verbose=False)
    
    DECLUSTER = False
    
    if DECLUSTER: 
        stat_coords = np.asarray([station.coord for station in stations])
        COORDS = Coordinates(input_list=stat_coords)
        declustered_coords = COORDS.decluster(degree_dist=0.1)
    
        stations = [station for station in stations if 
                    station.coord in declustered_coords]      

    # Loop on time interval
     #number of time steps
    N = int(((LASTDAY - FIRSTDAY).days + 1)*60*24 / XCORR_INTERVAL)
    
    dates = [FIRSTDAY + dt.timedelta(minutes=i) for i in \
             [j*XCORR_INTERVAL for j in range(N)]]
    
    
    #begin = raw_input("\nPress enter to begin the program ")
    
    # initialise preprocess class: METHOD - Bensen et al. (2007)
Example #2
0
#-----------------------------------------------------------------------------

# Generate InShape class
SHAPE = InShape(shape_path)
# Create shapely polygon from imported shapefile
UNIQUE_SHAPE = SHAPE.shape_poly()
print type(UNIQUE_SHAPE)
# Generate InPoly class
INPOLY = InPoly(shape_path)
GEODESIC = Geodesic()
COORDS = Coordinates()
INPOLY = InPoly(shape_path)
POLY_NODES = INPOLY.poly_nodes()

# decluster the points to desired specifications.
coords = COORDS.decluster(inputs=coords, degree_dist=0.5)

lonmin, lonmax = np.floor(min(coords[:, 0])), np.ceil(max(coords[:, 0]))
latmin, latmax = np.floor(min(coords[:, 1])), np.ceil(max(coords[:, 1]))
print lonmin, lonmax, latmin, latmax

plt.figure()
plt.scatter(coords[:, 0], coords[:, 1])
plt.show()



kappa = [np.vstack([[coord1[0],coord1[1],coord2[0],coord2[1]]\
                    for coord2 in coords]) for coord1 in coords]

Example #3
0
# Generate InShape class
SHAPE = InShape(shape_path)
# Create shapely polygon from imported shapefile
UNIQUE_SHAPE = SHAPE.shape_poly()
print type(UNIQUE_SHAPE)
# Generate InPoly class
INPOLY = InPoly(shape_path)
GEODESIC = Geodesic()
COORDS = Coordinates()
INPOLY = InPoly(shape_path)
POLY_NODES = INPOLY.poly_nodes()


# decluster the points to desired specifications.
coords = COORDS.decluster(inputs=coords, degree_dist=0.5)


lonmin, lonmax = np.floor(min(coords[:, 0])), np.ceil(max(coords[:, 0]))
latmin, latmax = np.floor(min(coords[:, 1])), np.ceil(max(coords[:, 1]))
print lonmin, lonmax, latmin, latmax


plt.figure()
plt.scatter(coords[:, 0], coords[:, 1])
plt.show()


kappa = [np.vstack([[coord1[0], coord1[1], coord2[0], coord2[1]] for coord2 in coords]) for coord1 in coords]