Skip to content

3 Example: South Napa Area, Northern California (Worrell Thesis)

Luke Pajer edited this page Oct 28, 2020 · 3 revisions

          3.4    Combined Solutions

Import the Slam Calculator Package

import geo_slam_calculator_v1 as slam

Define the DEM area

area = slam.DEM(longitude=-122.28996, latitude=38.17058, lon_del=0.2, lat_del=0.2)

lat_min, lat_max, lon_min, lon_max = area.get_bounds()
lat_min, lat_max, lon_min, lon_max

dem_file = area.get_dem(lat_min, lat_max, lon_min, lon_max)
Begin Downloading DEM File...  
Downloaded DEM file in 7.1 seconds  
Processing...  
Complete.  

Get Quaternary Faults and Folds Shapefile

from geo_slam_calculator_v1 import qFaults

qfaults = qFaults.get_qfaults()
Warning: Be courteous to the USGS API and do not download this file more than once, as this is a very large file.
Downloaded Quaternary Faults and Folds Shape File in 1.3 seconds

Get the Earthquake Data for the 2014 Magnitude 3.9 Earthquake

data = slam.get_data(lat_min=lat_min, lat_max=lat_max, lon_min=lon_min, lon_max=lon_max)
events_2014 = data.event_query(start_time='2014-08-25', end_time='2014-08-27', min_mag=3.9)
Downloaded Regional Earthquake Data in 0.6760 seconds

image

focal_data_2014 = data.focal_data(earthquakes=events_2014)
focal_data_2014.focal_data

image

focal_data_2014.error_data

image

Filter the data for the earthquake of interest

eq1_2014 = focal_data_2014.data[focal_data_2014.data['ID']=='A'].reset_index(drop=True)

image
image

Prepare Variables for Swath Calculation

The err_computations function below is using the arguements provided in the Worrell thesis project.

swaths_init = slam.swaths(elevation=dem_file.elevation)

# Calculate the Grid North Adjustment
gridNorthAdjustment_2014 = swaths_init.grid_adjustment(longitude=-122.28996, latitude=38.17058, zoneMeridian=-123)

# Combine Focal Data Points
focal_data_2014 = swaths_init.focal_metrics(lon=eq1_2014.longitude[0], lat=eq1_2014.latitude[0], depth=10.183)

# Nodal 1 Computations
nodal_comps_2014 = swaths_init.nodal_comps(strike=eq1_2014.np2_strike, grid_adjust=gridNorthAdjustment_2014, 
                                      strike_uncert=eq1_2014.np2S_uncert, plunge=eq1_2014.np2_dip,
                                      dip_ang=eq1_2014.np2D_uncert)

# Determine Errors Relative to the Nodal Plane
err_comps_2014 = swaths_init.err_computations(eh1=26, eh2=26, eh1Az=90, ez=0.026, 
                                         grid_adjust=gridNorthAdjustment_2014)

# Calculate the Light Direction for the DEM map
lightDirection_2014 = swaths_init.light_direction(nodal_comps_2014[1])

image

Calculate Swath Bounds

swaths_2014 = swaths_init.swath_calc(npDipPlunge=nodal_comps_2014[3], npDipAngUncert=nodal_comps_2014[4], 
                                     npDipTr=nodal_comps_2014[1], npDipTrendUncert=nodal_comps_2014[2], 
                                     widthFactor=1.5, multiplier=1.5, cellsize=dem_file.cellsize, 
                                     cellsize_res=30, eh1=err_comps_2014[0], eh1Az=err_comps_2014[1], 
                                     eh2=err_comps_2014[2], ez=err_comps_2014[3], lat=focal_data_2014[0], 
                                     lon=focal_data_2014[1], focalDepth=focal_data_2014[2], 
                                     bounds=dem_file.bounds, thin=True)

image

Calculate Swath Shading

swaths_shade_2014 = swaths_init.get_shade(swaths_2014.swaths, trend='NS')
Begin computing Seismo-Lineament boundary area
Finished assessment of Seismo-Lineament boundary area in 10.31 seconds

Plot Swaths for 2014 Earthquake

maps = slam.SLAM_viz(elevation=dem_file.elevation)
maps.elevation_map(middle_road=swaths_2014.middle_road, swaths_shade=swaths_shade_2014, 
                   lightDirection=lightDirection_2014, altDeg=12.5, lon=eq1_2014.longitude[0], lat=eq1_2014.latitude[0], 
                   lon_max=lon_max, lon_min=lon_min, lat_max=lat_max, lat_min=lat_min, 
                   strike=eq1_2014.np1_strike, dip=eq1_2014.np1_dip, rake=eq1_2014.np1_rake, title='A1')

maps.physical_map(middle_road=swaths_2014.middle_road, swaths_shade=swaths_shade_2014, 
                  lon=focal_data_2014[1], lat=focal_data_2014[0], lon_max=lon_max, 
                  lon_min=lon_min, lat_max=lat_max, lat_min=lat_min, strike=eq1_2014.np1_strike, 
                  dip=eq1_2014.np1_dip, rake=eq1_2014.np1_rake, title='A1', tiler_size=11)

Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL

Get the Earthquake Data for the 2014 Magnitude 3.8 Earthquake

data = slam.get_data(lat_min=lat_min, lat_max=lat_max, lon_min=lon_min, lon_max=lon_max)
events_2014_b = data.event_query(start_time='2014-08-23', end_time='2014-08-25', min_mag=3.6)
Downloaded Regional Earthquake Data in 1.2241 seconds

image

focal_data_2014_b = data.focal_data(earthquakes=events_2014_b)
focal_data_2014_b.focal_data

image

focal_data_2014_b.error_data

image

Filter the data for the earthquake of interest

eq1_2014_b = focal_data_2014_b.data[focal_data_2014_b.data['ID']=='B'].reset_index(drop=True)

image
image

Prepare Variables for Swath Calculation

The err_computations function below is using the arguements provided in the Worrell thesis project.

swaths_init = slam.swaths(elevation=dem_file.elevation)

# Calculate the Grid North Adjustment
gridNorthAdjustment_2014_b = swaths_init.grid_adjustment(longitude=-122.28996, latitude=38.17058, zoneMeridian=-123)

# Combine Focal Data Points
focal_data_2014_b = swaths_init.focal_metrics(lon=eq1_2014_b.longitude[0], lat=eq1_2014_b.latitude[0], depth=9.121)

# Nodal 1 Computations
nodal_comps_2014_b = swaths_init.nodal_comps(strike=eq1_2014_b.np1_strike, grid_adjust=gridNorthAdjustment_2014_b, 
                                      strike_uncert=eq1_2014_b.np1S_uncert, plunge=eq1_2014_b.np1_dip,
                                      dip_ang=eq1_2014_b.np1D_uncert)

# Determine Errors Relative to the Nodal Plane
err_comps_2014_b = swaths_init.err_computations(eh1=14, eh2=14, eh1Az=90, ez=0.014, 
                                                grid_adjust=gridNorthAdjustment_2014_b)

# Calculate the Light Direction for the DEM map
lightDirection_2014_b = swaths_init.light_direction(nodal_comps_2014_b[1])

image

Calculate Swath Bounds

swaths_2014_b = swaths_init.swath_calc(npDipPlunge=nodal_comps_2014_b[3], npDipAngUncert=nodal_comps_2014_b[4], 
                                       npDipTr=nodal_comps_2014_b[1], npDipTrendUncert=nodal_comps_2014_b[2], 
                                       widthFactor=1.5, multiplier=1.5, cellsize=dem_file.cellsize, 
                                       cellsize_res=30, eh1=err_comps_2014_b[0], eh1Az=err_comps_2014_b[1], 
                                       eh2=err_comps_2014_b[2], ez=err_comps_2014_b[3], lat=focal_data_2014_b[0], 
                                       lon=focal_data_2014_b[1], focalDepth=focal_data_2014_b[2], 
                                       bounds=dem_file.bounds, thin=True)

image

Calculate Swath Shading

swaths_shade_2014_b = swaths_init.get_shade(swaths_2014_b.swaths, corners_fill=['NW', 'SW', 'SE'], trend='NS')
Begin computing Seismo-Lineament boundary area
Finished assessment of Seismo-Lineament boundary area in 10.91 seconds

Plot Swaths for 2014 Earthquake

maps = slam.SLAM_viz(elevation=dem_file.elevation)
maps.elevation_map(middle_road=swaths_2014_b.middle_road, swaths_shade=swaths_shade_2014_b, 
                   lightDirection=lightDirection_2014_b, altDeg=12.5, lon=focal_data_2014_b[1], 
                   lat=focal_data_2014_b[0], lon_max=lon_max, lon_min=lon_min, 
                   lat_max=lat_max, lat_min=lat_min, strike=eq1_2014_b.np2_strike, dip=eq1_2014_b.np2_dip, 
                   rake=eq1_2014_b.np2_rake, faults=qfaults, title='A2')

maps.physical_map(middle_road=swaths_2014_b.middle_road, swaths_shade=swaths_shade_2014_b, 
                  lon=focal_data_2014_b[1], lat=focal_data_2014_b[0], lon_max=lon_max, lon_min=lon_min, 
                  lat_max=lat_max, lat_min=lat_min, strike=eq1_2014_b.np2_strike, 
                  dip=eq1_2014_b.np2_dip, rake=eq1_2014_b.np2_rake, title='A2', faults=qfaults, tiler_size=11)

Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL

Get the Earthquake Data for the 2014 Magnitude 3.6 Earthquake

This keys off of the data pulled in the previous section.

focal_data_2014_b = data.focal_data(earthquakes=events_2014_b)
eq1_2014_c = focal_data_2014_b.data[focal_data_2014_b.data['ID']=='A'].reset_index(drop=True)

image
image

Prepare Variables for Swath Calculation

The err_computations function below is using the arguements provided in the Worrell thesis project.

swaths_init = slam.swaths(elevation=dem_file.elevation)

# Calculate the Grid North Adjustment
gridNorthAdjustment_2014_c = swaths_init.grid_adjustment(longitude=-122.28996, latitude=38.17058, zoneMeridian=-123)

# Combine Focal Data Points
focal_data_2014_c = swaths_init.focal_metrics(lon=eq1_2014_c.longitude[0], lat=eq1_2014_c.latitude[0], depth=9.121)

# Nodal 1 Computations
nodal_comps_2014_c = swaths_init.nodal_comps(strike=eq1_2014_c.np2_strike, grid_adjust=gridNorthAdjustment_2014_c, 
                                      strike_uncert=eq1_2014_c.np2S_uncert, plunge=eq1_2014_c.np2_dip,
                                      dip_ang=eq1_2014_c.np2D_uncert)

# Determine Errors Relative to the Nodal Plane
err_comps_2014_c = swaths_init.err_computations(eh1=20, eh2=20, eh1Az=90, ez=0.021, 
                                                grid_adjust=gridNorthAdjustment_2014_c)

# Calculate the Light Direction for the DEM map
lightDirection_2014_c = swaths_init.light_direction(nodal_comps_2014_c[1])

image

Calculate Swath Bounds

swaths_2014_c = swaths_init.swath_calc(npDipPlunge=nodal_comps_2014_c[3], npDipAngUncert=nodal_comps_2014_c[4], 
                                       npDipTr=nodal_comps_2014_c[1], npDipTrendUncert=nodal_comps_2014_c[2], 
                                       widthFactor=1.5, multiplier=1.5, cellsize=dem_file.cellsize, 
                                       cellsize_res=30, eh1=err_comps_2014_c[0], eh1Az=err_comps_2014_c[1], 
                                       eh2=err_comps_2014_c[2], ez=err_comps_2014_c[3], lat=focal_data_2014_c[0], 
                                       lon=focal_data_2014_c[1], focalDepth=focal_data_2014_c[2], 
                                       bounds=dem_file.bounds, thin=True)

image

Calculate Swath Shading

swaths_shade_2014_c = swaths_init.get_shade(swaths_2014_c.swaths, trend='NS', corners_fill=['SW'])
Begin computing Seismo-Lineament boundary area
Finished assessment of Seismo-Lineament boundary area in 10.91 seconds

Plot Swaths for 2014 Earthquake

maps = slam.SLAM_viz(elevation=dem_file.elevation)
maps.elevation_map(middle_road=swaths_2014_c.middle_road, swaths_shade=swaths_shade_2014_c, 
                   lightDirection=lightDirection_2014_c, altDeg=12.5, 
                   lon=focal_data_2014_c[1], lat=focal_data_2014_c[0], lon_max=lon_max, lon_min=lon_min, 
                   lat_max=lat_max, lat_min=lat_min, strike=eq1_2014_c.np2_strike, dip=eq1_2014_c.np2_dip, 
                   rake=eq1_2014_c.np2_rake, faults=qfaults, title='A3')

maps.physical_map(middle_road=swaths_2014_c.middle_road, swaths_shade=swaths_shade_2014_c, 
                  lon=focal_data_2014_c[1], lat=focal_data_2014_c[0], 
                  lon_max=lon_max, lon_min=lon_min, lat_max=lat_max, lat_min=lat_min, strike=eq1_2014_c.np2_strike, 
                  dip=eq1_2014_c.np2_dip, rake=eq1_2014_c.np2_rake, title='A3', faults=qfaults, tiler_size=11)

Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL

swaths_mult = [swaths_2014.swaths, swaths_2014_b.swaths, swaths_2014_c.swaths]
middle_road_mult = [swaths_2014.middle_road, swaths_2014_b.middle_road, swaths_2014_c.middle_road]
swaths_shade_mult = [swaths_shade_2014, swaths_shade_2014_b, swaths_shade_2014_c]
lon_mult = [focal_data_2014[1], focal_data_2014_b[1], focal_data_2014_c[1]]
lat_mult = [focal_data_2014[0], focal_data_2014_b[0], focal_data_2014_c[0]]
strike_mult = [eq1_2014.np1_strike, eq1_2014_b.np1_strike, eq1_2014_c.np1_strike]
dip_mult = [eq1_2014.np1_dip, eq1_2014_b.np1_dip, eq1_2014_c.np1_dip]
rake_mult = [eq1_2014.np1_rake, eq1_2014_b.np1_rake, eq1_2014_c.np1_rake]
title = ['A1', 'A2', 'A3']
colors_ = ['lightblue', 'green', 'yellow']
maps.elevation_mult(swaths_shade=swaths_shade_mult, lightDirection=lightDirection_2014, altDeg=12.5, 
                    lon=lon_mult, lat=lat_mult, lon_max=lon_max, lon_min=lon_min, 
                    lat_max=lat_max, lat_min=lat_min, strike=strike_mult, dip=dip_mult, 
                    rake=rake_mult, title=title, colors_=colors_)

maps.physical_mult(lon=lon_mult, lat=lat_mult, lon_max=lon_max, lon_min=lon_min, 
                   lat_max=lat_max, lat_min=lat_min, strike=strike_mult, 
                   dip=dip_mult, rake=rake_mult, title=title, tiler_size=11, focal_size=0.5)

Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL