Skip to content

Instantly share code, notes, and snippets.

@palewire
Last active May 20, 2021 19:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save palewire/7173ec9df34f55457a92df098898c887 to your computer and use it in GitHub Desktop.
Save palewire/7173ec9df34f55457a92df098898c887 to your computer and use it in GitHub Desktop.
Intensity maps of the 7.1 magnitude earthquake that struck Searles Valley, Calif., on July 5, 2019.

3D earthquake intensity maps

On July 5, a 7.1 magnitude earthquake rumbled beneath the Searles Valley in California's Mojave Desert.

The U.S. Geological Survey mapped its intensity as it rippled across Southern California.

Here's that data modeled in 3D.

Instructions

  1. Download the intensity shapefiles from USGS
  2. Delete excess columns and converted the map to GeoJSON with QGIS
  3. Rasterize the vector data with gdal_rasterize
gdal_rasterize -a PARAMVALUE -te -119.6 33.5 -115.5 38 -ts 500 500 mmi.geojson mmi.tif
  1. Convert it to a sanitized STL file with R's rayshader package
library(rayshader)
mmitif = raster::raster("mmi.tif")
mmimat = matrix(raster::extract(mmitif, raster::extent(mmitif)), nrow = ncol(mmitif), ncol = nrow(mmitif))
mmimat %>%
  sphere_shade(texture = "desert") %>%
  add_shadow(ray_shade(mmimat, zscale = 0.005, maxsearch = 300), 0.45) %>% 
  add_shadow(ambient_shade(mmimat, zscale=0.01), 0.5) %>%
  plot_3d(mmimat, zscale = 0.01, fov = 0, theta = 135, zoom = 0.85, phi = 25, windowsize = c(1000, 800))
render_snapshot()
save_3dprint("mmi.stl", maxwidth = 4, unit = "in")
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment