Пример #1
0
def compute_distances(position_y, position_x, source_y, source_x, latlon=True):
    """
    Compute the y and x distance between the observation location and the source location

    @param position_y: Obsevation y position
    @param position_x: Observation x position
    @param source_y: Source y position
    @param source_x: Source x position
    @param latlon: Interpret positions as latitudes and longitudes

    @return The y and x distance between observation location and source locaiton
    """
    if latlon == True:
        y_distance = mo.wgs84_distance((source_y, source_x),
                                       (position_y, source_x))
        x_distance = mo.wgs84_distance((source_y, source_x),
                                       (source_y, position_x))
        x_distance = x_distance * np.sign(position_x - source_x)
        y_distance = y_distance * np.sign(position_y - source_y)

    else:
        x_distance = position_x - source_x
        y_distance = position_y - source_y

    return y_distance, x_distance
Пример #2
0
def closed_pipe(xdata, lat, lon, source_depth, amplitude, pipe_delta):
    '''
    Compute the surface deformation due to changes in a closed pipe source

    For reference, see "Volcano Deformation", Dzurisin 2006, pg 292
    (http://link.springer.com/book/10.1007/978-3-540-49302-0)

    @param xdata: List of the position data with each array element containing [ direction (x, y, or z), lat, lon ]
    @param lat: Latitude of source
    @param lon: Longitude of source
    @param source_depth: Depth of source
    @param amplitude: Ampltiude of source
    @param pipe_delta: Pipe delta from source depth to top/bottom

    @return list of resulting deformation for each point in xdata
    '''
    nu_v = .25
    source_coords = (lat, lon)

    results = []

    for data in xdata:

        dim = data[0]
        station_coords = (float(data[1]), float(data[2]))
        # print(station_coords)

        y_distance = mo.wgs84_distance(source_coords,
                                       (station_coords[0], source_coords[1]))
        x_distance = mo.wgs84_distance(source_coords,
                                       (source_coords[0], station_coords[1]))
        x_distance = x_distance * np.sign(station_coords[1] - source_coords[1])
        y_distance = y_distance * np.sign(station_coords[0] - source_coords[0])

        result = None
        c1 = source_depth + pipe_delta
        c2 = source_depth - pipe_delta
        R_1 = (x_distance**2 + y_distance**2 + c1**2)**(1 / 2)
        R_2 = (x_distance**2 + y_distance**2 + c2**2)**(1 / 2)
        r2 = (x_distance**2 + y_distance**2)
        if dim == 'x':
            result = amplitude * ((c1 / R_1)**3 + 2 * c1 *
                                  (-3 + 5 * nu_v) / R_1 +
                                  (5 * c2**3 * (1 - 2 * nu_v) - 2 * c2 * r2 *
                                   (-3 + 5 * nu_v)) / R_2**3) * x_distance / r2
        elif dim == 'y':
            result = amplitude * ((c1 / R_1)**3 + 2 * c1 *
                                  (-3 + 5 * nu_v) / R_1 +
                                  (5 * c2**3 * (1 - 2 * nu_v) - 2 * c2 * r2 *
                                   (-3 + 5 * nu_v)) / R_2**3) * y_distance / r2
        elif dim == 'z':
            result = -amplitude * (c1**2 / R_1**3 + 2 * (-2 + 5 * nu_v) / R_1 +
                                   (c2**2 * (3 - 10 * nu_v) - 2 * r2 *
                                    (-2 + 5 * nu_v)) / R_2**3)
        else:
            print("Did not understand dimension")

        results.append(result)
    return results
Пример #3
0
def finite_sphere(xdata, lat, lon, source_depth, amplitude, alpha_rad):
    '''
    Compute the surface deformation due to changes in a finite sphere source

    For reference, see "Volcano Deformation", Dzurisin 2006, pg 290
    (http://link.springer.com/book/10.1007/978-3-540-49302-0)

    @param xdata: List of the position data with each array element containing [ direction (x, y, or z), lat, lon ]
    @param lat: Latitude of source
    @param lon: Longitude of source
    @param source_depth: Depth of source
    @param amplitude: Ampltiude of source
    @param alpha_rad: Alpha radius of the source

    @return list of resulting deformation for each point in xdata

    '''
    nu_v = .25
    C1 = (1 + nu_v) / (2 * (-7 + 5 * nu_v))
    C2 = 15 * (-2 + nu_v) / (4 * (-7 + 5 * nu_v))
    source_coords = (lat, lon)

    results = []

    for data in xdata:

        dim = data[0]
        station_coords = (float(data[1]), float(data[2]))
        # print(station_coords)

        y_distance = mo.wgs84_distance(source_coords,
                                       (station_coords[0], source_coords[1]))
        x_distance = mo.wgs84_distance(source_coords,
                                       (source_coords[0], station_coords[1]))
        x_distance = x_distance * np.sign(station_coords[1] - source_coords[1])
        y_distance = y_distance * np.sign(station_coords[0] - source_coords[0])

        R3 = (x_distance**2 + y_distance**2 + source_depth**2)**(3 / 2)
        result = None
        if dim == 'x':
            result = amplitude * alpha_rad**3 * (
                1 + (alpha_rad / source_depth)**3 *
                (C1 + C2 * source_depth**2 / R3**(2 / 3))) * x_distance / R3
        elif dim == 'y':
            result = amplitude * alpha_rad**3 * (
                1 + (alpha_rad / source_depth)**3 *
                (C1 + C2 * source_depth**2 / R3**(2 / 3))) * y_distance / R3
        elif dim == 'z':
            result = amplitude * alpha_rad**3 * (
                1 + (alpha_rad / source_depth)**3 *
                (C1 + C2 * source_depth**2 / R3**(2 / 3))) * source_depth / R3
        else:
            print("Did not understand dimension")

        results.append(result)
    return results
Пример #4
0
def mogi(xdata, lat, lon, source_depth, amplitude):
    '''
    Compute the surface deformation due to changes in a mogi source

    @param xdata: List of the position data with each array element containing [ direction (x, y, or z), lat, lon ]
    @param lat: Latitude of source
    @param lon: Longitude of source
    @param source_depth: Depth of source
    @param amplitude: Amplitude of mogi source

    @return list of resulting deformation for each point in xdata
    '''
    source_coords = (lat, lon)

    results = []

    for data in xdata:

        dim = data[0]
        station_coords = (float(data[1]), float(data[2]))
        # print(station_coords)

        y_distance = mo.wgs84_distance(source_coords,
                                       (station_coords[0], source_coords[1]))
        x_distance = mo.wgs84_distance(source_coords,
                                       (source_coords[0], station_coords[1]))

        x_distance = x_distance * np.sign(station_coords[1] - source_coords[1])
        y_distance = y_distance * np.sign(station_coords[0] - source_coords[0])

        R3 = (x_distance**2 + y_distance**2 + source_depth**2)**(3 / 2)

        result = None

        if dim == 'x':
            result = amplitude * x_distance / R3
        elif dim == 'y':
            result = amplitude * y_distance / R3
        elif dim == 'z':
            result = amplitude * source_depth / R3
        else:
            print("Did not understand dimension")

        results.append(result)
    return results
Пример #5
0
def sill(xdata, lat, lon, source_depth, amplitude):
    '''
    Compute the surface deformation due to changes in a sill-like source

    For reference, see "Volcano Deformation", Dzurisin 2006, pg 297
    (http://link.springer.com/book/10.1007/978-3-540-49302-0)

    @param xdata: List of the position data with each array element containing [ direction (x, y, or z), lat, lon ]
    @param lat: Latitude of source
    @param lon: Longitude of source
    @param source_depth: Depth of source
    @param amplitude: Ampltiude of source

    @return list of resulting deformation for each point in xdata
    '''
    source_coords = (lat, lon)
    results = []

    for data in xdata:

        dim = data[0]
        station_coords = (float(data[1]), float(data[2]))
        # print(station_coords)

        y_distance = mo.wgs84_distance(source_coords,
                                       (station_coords[0], source_coords[1]))
        x_distance = mo.wgs84_distance(source_coords,
                                       (source_coords[0], station_coords[1]))
        x_distance = x_distance * np.sign(station_coords[1] - source_coords[1])
        y_distance = y_distance * np.sign(station_coords[0] - source_coords[0])

        R5 = (x_distance**2 + y_distance**2 + source_depth**2)**(5 / 2)
        result = None
        if dim == 'x':
            result = amplitude * x_distance * source_depth**2 / R5
        elif dim == 'y':
            result = amplitude * y_distance * source_depth**2 / R5
        elif dim == 'z':
            result = amplitude * source_depth**3 / R5
        else:
            print("Did not understand dimension")

        results.append(result)
    return results
Пример #6
0
    def process(self, obj_data):
        ''' 
        Apply geolocation filter to data set
        
        @param obj_data: Table data wrapper
        '''

        lat = self.ap_paramList[0]()
        lon = self.ap_paramList[1]()
        radius = self.ap_paramList[2]()

        remove_list = []

        for label, data in obj_data.getIterator():
            data_lat = obj_data.info(label)['Lat']
            data_lon = obj_data.info(label)['Lon']

            if wgs84_distance((lat, lon), (data_lat, data_lon)) > radius:
                remove_list.append(label)

        obj_data.removeFrames(remove_list)
Пример #7
0
def geocalc(lat1, lon1, lat2, lon2):

    return wgs84_distance((lat1, lon1), (lat2, lon2))
Пример #8
0
def rising_open_pipe(xdata, lat, lon, source_depth, amplitude, pipe_delta,
                     open_pipe_top):
    '''
    Compute the surface deformation due to changes in a rising width amplitude open pipe source

    For reference, see "Volcano Deformation", Dzurisin 2006, pg 295
    (http://link.springer.com/book/10.1007/978-3-540-49302-0)

    @param xdata: List of the position data with each array element containing [ direction (x, y, or z), lat, lon ]
    @param lat: Latitude of source
    @param lon: Longitude of source
    @param source_depth: Depth of source
    @param amplitude: Ampltiude of source
    @param pipe_delta: Pipe delta from source depth to top/bottom
    @param open_pipe_top: Depth of the top of the open pipe

    @return list of resulting deformation for each point in xdata
    '''
    nu_v = .25
    source_coords = (lat, lon)

    results = []

    for data in xdata:

        dim = data[0]
        station_coords = (float(data[1]), float(data[2]))
        # print(station_coords)

        y_distance = mo.wgs84_distance(source_coords,
                                       (station_coords[0], source_coords[1]))
        x_distance = mo.wgs84_distance(source_coords,
                                       (source_coords[0], station_coords[1]))
        x_distance = x_distance * np.sign(station_coords[1] - source_coords[1])
        y_distance = y_distance * np.sign(station_coords[0] - source_coords[0])

        result = None
        c0 = open_pipe_top
        c1 = source_depth + pipe_delta
        R_0 = (x_distance**2 + y_distance**2 + c0**2)**(1 / 2)
        R_1 = (x_distance**2 + y_distance**2 + c1**2)**(1 / 2)
        r2 = (x_distance**2 + y_distance**2)
        if dim == 'x':
            result = amplitude * (
                -(c0**2 / R_0**3) + 2 * nu_v / R_0 +
                (c1**2 - 2 * (c1**2 + r2) * nu_v) / R_1**3) * x_distance / c1
        elif dim == 'y':
            result = amplitude * (
                -(c0**2 / R_0**3) + 2 * nu_v / R_0 +
                (c1**2 - 2 * (c1**2 + r2) * nu_v) / R_1**3) * y_distance / c1
        elif dim == 'z':
            result = -amplitude * ((c0**3 / R_0**3) - c1**3 / R_1**3 + c1 *
                                   (-1 + 2 * nu_v) / R_1 + c0 *
                                   (1 - 2 * nu_v) / R_0 +
                                   (-1 + 2 * nu_v) * np.log(c0 + R_0) -
                                   (-1 + 2 * nu_v) * np.log(c1 + R_1)) / c1
        else:
            print("Did not understand dimension")

        results.append(result)
    return results