Skip to content

Reference

Philip Maechling edited this page May 4, 2022 · 7 revisions

UCVM_plotting repo now contains scripts for plotting ucvm results. Command in ucvm_plotting repo are listed here:

UCVM Plotting Utility Scripts

  • plot_compare_plot.py
  print("\nPlot a scatter plot to compare two binary data files")
  print("Valid arguments:")
  print("\t-x, --xfile: file to use for x axis")
  print("\t-y, --yfile: file to use for y axis")
  print("\t-o, --ofile: png filename to use for resulting plot")
  print("./plot_compare_plot.py -x x.bin -y y.bin [-o o.png]")
  • plot_cross_section.py
    print("Plots a cross-section given two latitude, longitude points, a depth,")
    print("the CVM to plot, and a couple of other settings.")
    print("\nValid arguments:")
    print("\t-s, --starting: starting depth for cross-section (meters)")
    print("\t-e, --ending: ending depth for cross-section (meters)")
    print("\t-h, --horizontal: horizontal spacing for cross-section (meters)")
    print("\t-v, --vertical: vertical spacing for cross-section (meters)")
    print("\t-d, --datatype: either 'vs', 'vp', 'density', or 'poisson', without quotation marks")
    print("\t-c, --cvm: one of the installed CVMs")
    print("\t-z, --zrange: optional Z-range for elygtl:ely (e.g. -z 0,350)")
    print("\t-a, --scale: color scale, either 's' for smooth, 'd' for discretized or 'b' for bi-color scale, without quotes")
    print("\t-g, --gate: optional gate value for bi-color scale gate")
    print("\t-b, --origin: origin latitude, longitude from which to start plot (e.g. 34,-118)")
    print("\t-u, --destination: destination latitude, longitude to end plot (e.g. 35,-117)")
    print("\t-f, --datafile: optional input filename")
    print("\t-o, --outfile: optional png output filename")
    print("\t-t, --title: optional plot title")
    print("\t-H, --help: optional display usage information")
    print("\t-i, --installdir: optional UCVM isntall directory")
    print("\t-n, --configfile: optional UCVM configfile")
    print("UCVM %s\n" % VERSION)
  • plot_density_plot.py
  print("Usage: ./plot_density_plot.py -i  -d 100 -n Density(CCA)(x) Density(Algo)(Y)")
  print("Usage: ./plot_density_plot.py -i inputfile -d depth -n description")
  print("input file is a list of text file lines as returned by ucvm_query")
  print("-i inputfilename -e depth(meters) -n String describing data being plotted") 
  print("./plot_density_plot.py -i map_pts.txt -e 0.0 -n Density(CCA)(X) Density(Algo)(Y)")
  • plot_depth_profile.py
    print("Plots a depth profile given a latitude, longitude, a depth,")
    print("the CVM to plot, and a couple of other settings.")
    print("\nValid arguments:")
    print("\t-s, --startingpoint: latitude, longitude (e.g. 34,-118)")
    print("\t-b, --startingdepth: starting depth for depth profile (meters)")
    print("\t-e, --endingdepth: ending depth for depth profile (meters)")
    print("\t-d, --datatype: one or more 'vs', 'vp' and/or 'density'(e.g. vs,vp,density)")
    print("\t-v, --vertical: vertical spacing for depth interval (meters)")
    print("\t-c, --cvm: one of the installed CVMs")
    print("\t-z, --zrange: optional Z-range for elygtl:ely (e.g. -z 0,350)")
    print("\t-g, --threshold: optional Vs threshold to display as gating")
    print("\t-f, --datafile: optional binary input data filename")
    print("\t-F, --metadata: optional meta data filename")
    print("\t-o, --outfile: optional png output filename")
    print("\t-t, --title: optional plot title")
    print("\t-H, --help: optional display usage information")
    print("\t-i, --installdir: optional UCVM install directory")
    print("\t-n, --configfile: optional UCVM configfile")
    print("UCVM %s\n" % VERSION)
  • plot_elevation_cross_section.py
    print("Plots a cross-section given two latitude, longitude points, one or two elevations,")
    print("the CVM to plot, and a couple of other settings.")
    print("\nValid arguments:")
    print("\t-s, --starting: starting elevation for cross-section (meters)")
    print("\t-e, --ending: ending elevation for cross-section (meters)")
    print("\t-h, --horizontal: horizontal spacing for cross-section (meters)")
    print("\t-v, --vertical: vertical spacing for cross-section (meters)")
    print("\t-d, --datatype: either 'vs', 'vp', 'density', or 'poisson', without quotation marks")
    print("\t-c, --cvm: one of the installed CVMs")
    print("\t-z, --zrange: optional Z-range for elygtl:ely (e.g. -z 0,350)")
    print("\t-a, --scale: color scale, either 's' for smooth, 'd' for discretized or 'b' for bi-color scale, without quotes")
    print("\t-g, --gate: optional gate value for bi-color scale gate")
    print("\t-b, --origin: origin latitude, longitude from which to start plot (e.g. 34,-118)")
    print("\t-u, --destination: destination latitude, longitude to end plot (e.g. 35,-117)")
    print("\t-f, --datafile: optional input filename")
    print("\t-o, --outfile: optional png output filename")
    print("\t-t, --title: optional plot title")
    print("\t-H, --help: optional display usage information")
    print("\t-i, --installdir: optional UCVM isntall directory")
    print("\t-n, --configfile: optional UCVM configfile")
    print("UCVM %s\n" % VERSION)
  • plot_elevation_horizontal_slice.py
    print("Plots a elevation horizontal slice given two bounding latitude and longitude co-ordinates,")
    print("the CVM to plot, and a couple of other settings.")
    print("\nValid arguments:")
    print("\t-b, --bottomleft: bottom-left latitude, longitude (e.g. 34,-118)")
    print("\t-u, --upperright: upper-right latitude, longitude (e.g. 35,-117)")
    print("\t-s, --spacing: grid spacing in degrees (typically 0.01)")
    print("\t-e, --elevation: elevation for horizontal slice in meters (e.g. 1000)")
    print("\t-d, --datatype: either 'vs', 'vp', 'density', or 'poisson', without quotation marks")
    print("\t-c, --cvm: one of the installed velocity models")
    print("\t-a, --scale: color scale, either 's' for smooth, 'd' for discretized or 'b' for bi-color scale, without quotes")
    print("\t-g, --gate: optional gate value for bi-color scale gate")
    print("\t-f, --datafile: optional binary input data filename")
    print("\t-o, --outfile: optional png output filename")
    print("\t-t, --title: optional plot title")
    print("\t-H, --help: optional display usage information")
    print("\t-i, --installdir: optional UCVM isntall directory")
    print("\t-n, --configfile: optional UCVM configfile")
    print("UCVM %s\n" % VERSION)
  • plot_elevation_map.py
    print("Generates a Elevation map text file given two bounding latitude and longitude ")
    print("co-ordinates, the CVM to plot, and a couple of other settings.")
    print("\nValid arguments:")
    print("\t-b, --bottomleft: bottom-left latitude, longitude (e.g. 34,-118)")
    print("\t-u, --upperright: upper-right latitude, longitude (e.g. 35,-117)")
    print("\t-s, --spacing: grid spacing in degrees (typically 0.01)")
    print("\t-c, --cvm: one of the installed community velocity models")
    print("\t-a, --scale: color scale, either 's' for smooth or 'd' for discretized, without quotes")
    print("\t-f, --datafile: optional binary input data filename")
    print("\t-o, --outfile: optional png output filename")
    print("\t-t, --title: optional plot title")
    print("\t-H, --help: optional display usage information")
    print("\t-i, --installdir: optional UCVM install directory")
    print("\t-n, --configfile: optional UCVM configfile")
    print("UCVM %s\n" % VERSION)
  • plot_elevation_profile.py
    print("Plots a elevation profile given a latitude, longitude, a elevation,")
    print("the CVM to plot, and a couple of other settings.")
    print("\nValid arguments:")
    print("\t-s, --startingpoint: latitude, longitude (e.g. 34,-118)")
    print("\t-b, --startingelevation: starting elevation for elevation profile (meters)")
    print("\t-e, --endingelevation: ending elevation for elevation profile (meters)")
    print("\t-d, --datatype: one or more 'vs', 'vp' and/or 'density'(e.g. vs,vp,density)")
    print("\t-v, --vertical: vertical spacing for elevation interval (meters)")
    print("\t-c, --cvm: one of the installed CVMs")
    print("\t-z, --zrange: optional Z-range for elygtl:ely (e.g. -z 0,350)")
    print("\t-g, --threshold: optional  Vs threshold to display as gating")
    print("\t-f, --datafile: optional binary input data filename")
    print("\t-o, --outfile: optional png output filename")
    print("\t-t, --title: optional plot title")
    print("\t-H, --help: optional display usage information")
    print("\t-i, --installdir: optional UCVM isntall directory")
    print("\t-n, --configfile: optional UCVM configfile")
    print("UCVM %s\n" % VERSION)
  • plot_horizontal_slice.py
    print("Plots a horizontal slice given two bounding latitude and longitude co-ordinates,")
    print("the CVM to plot, and a couple of other settings.")
    print("\nValid arguments:")
    print("\t-b, --bottomleft: bottom-left latitude, longitude (e.g. 34,-118)")
    print("\t-u, --upperright: upper-right latitude, longitude (e.g. 35,-117)")
    print("\t-s, --spacing: grid spacing in degrees (typically 0.01)")
    print("\t-e, --depth: depth for horizontal slice in meters (e.g. 1000)")
    print("\t-d, --datatype: either 'vs', 'vp', 'density', or 'poisson', without quotation marks")
    print("\t-c, --cvm: one of the installed velocity models")
    print("\t-a, --scale: color scale, either 's' for smooth, 'd' for discretized or 'b' for bi-color scale, without quotes")
    print("\t-g, --gate: optional gate value for bi-color scale gate")
    print("\t-f, --datafile: optional binary input data filename")
    print("\t-o, --outfile: optional png output filename")
    print("\t-t, --title: optional plot title")
    print("\t-H, --help: optional display usage information")
    print("\t-i, --installdir: optional UCVM isntall directory")
    print("\t-n, --configfile: optional UCVM configfile")
    print("UCVM %s\n" % VERSION)
  • plot_scatter_plot.py
  print("Usage: ./plot_scatter_plot.py -i  -d 100 -n Density(CCA)(x) Density(Algo)(Y)")
  print("Usage: ./plot_scatter_plot.py -i inputfile -d depth -n description")
  print("input file is a list of text file lines as returned by ucvm_query")
  print("-i inputfilename -e depth(meters) -n String describing data being plotted")
  print("./plot_scatter_plot.py -i map_pts.txt -e 0.0 -n Density(CCA)(X) Density(Algo)(Y)")
  • plot_vs30_etree_map.py
    print("Generates a Vs30 map or text file given two bounding latitude and longitude ")
    print("co-ordinates, the CVM to plot, and a couple of other settings.")
    print("\nValid arguments:")
    print("\t-b, --bottomleft: bottom-left latitude, longitude (e.g. 34,-118)")
    print("\t-u, --upperright: upper-right latitude, longitude (e.g. 35,-117)")
    print("\t-s, --spacing: grid spacing in degrees (typically 0.01)")
    print("\t-c, --cvm: one of the installed community velocity models")
    print("\t-a, --scale: color scale, either 's' for smooth or 'd' for discretized, without quotes")
    print("\t-f, --datafile: optional binary input data filename")
    print("\t-o, --outfile: optional png output filename")
    print("\t-t, --title: optional plot title")
    print("\t-H, --help: optional display usage information")
    print("\t-i, --installdir: optional UCVM isntall directory")
    print("\t-n, --configfile: optional UCVM configfile")
    print("UCVM %s\n" % VERSION)
  • plot_vs30_map.py
    print("Generates a Vs30 map or text file given two bounding latitude and longitude ")
    print("co-ordinates, the CVM to plot, and a couple of other settings.")
    print("\nValid arguments:")
    print("\t-b, --bottomleft: bottom-left latitude, longitude (e.g. 34,-118)")
    print("\t-u, --upperright: upper-right latitude, longitude (e.g. 35,-117)")
    print("\t-s, --spacing: grid spacing in degrees (typically 0.01)")
    print("\t-c, --cvm: one of the installed community velocity models")
    print("\t-a, --scale: color scale, either 's' for smooth or 'd' for discretized, without quotes")
    print("\t-f, --datafile: optional binary input data filename")
    print("\t-o, --outfile: optional png output filename")
    print("\t-t, --title: optional plot title")
    print("\t-H, --help: optional display usage information")
    print("\t-i, --installdir: optional UCVM isntall directory")
    print("\t-n, --configfile: optional UCVM configfile")
  • plot_z10_map.py
   print("Generates a Z1.0 map or text file given two bounding latitude and longitude ")
    print("co-ordinates, the CVM to plot, and a couple of other settings.")
    print("\nValid arguments:")
    print("\t-b, --bottomleft: bottom-left latitude, longitude (e.g. 34,-118)")
    print("\t-u, --upperright: upper-right latitude, longitude (e.g. 35,-117)")
    print("\t-s, --spacing: grid spacing in degrees (typically 0.01)")
    print("\t-z, --interval: Z-interval, in meters, for Z%.1f to be queried (lower value means more precision)")
    print("\t-c, --cvm: one of the installed CVMs")
    print("\t-a, --scale: color scale, either 's' for smooth or 'd' for discretized, without quotes")
    print("\t-f, --datafile: optional binary input data filename")
    print("\t-x, --x: optional x steps matching the datafile")
    print("\t-y, --y: optional y steps matching the datafile")
    print("\t-o, --outfile: optional png output filename")
    print("\t-t, --title: optional plot title")
    print("\t-H, --help: optional display usage information")
    print("\t-i, --installdir: optional UCVM install directory")
    print("\t-n, --configfile: optional UCVM configfile")
    print("UCVM %s\n" % VERSION)
  • plot_z25_map.py
    print("Generates a Z2.5 map or text file given two bounding latitude and longitude ")
    print("co-ordinates, the CVM to plot, and a couple of other settings.")
    print("\nValid arguments:")
    print("\t-b, --bottomleft: bottom-left latitude, longitude (e.g. 34,-118)")
    print("\t-u, --upperright: upper-right latitude, longitude (e.g. 35,-117)")
    print("\t-s, --spacing: grid spacing in degrees (typically 0.01)")
    print("\t-z, --interval: Z-interval, in meters, for Z%.1f to be queried (lower value means more precision)")
    print("\t-c, --cvm: one of the installed CVMs")
    print("\t-a, --scale: color scale, either 's' for smooth or 'd' for discretized, without quotes")
    print("\t-f, --datafile: optional binary input data filename")
    print("\t-x, --x: optional x steps matching the datafile")
    print("\t-y, --y: optional y steps matching the datafile")
    print("\t-o, --outfile: optional png output filename")
    print("\t-t, --title: optional plot title")
    print("\t-H, --help: optional display usage information")
    print("\t-i, --installdir: optional UCVM install directory")
    print("\t-n, --configfile: optional UCVM configfile")
    print("UCVM %s\n" % VERSION)
  • make_map_grid.py
    print("Plots the return values from ucvm_query for a horizontal slice given two bounding latitude and longitude co-ordinates,")
    print("the CVM to plot, and a couple of other settings.")
    print("\nValid arguments:")
    print("\t-b, --bottomleft: bottom-left latitude, longitude (e.g. 34,-118)")
    print("\t-u, --upperright: upper-right latitude, longitude (e.g. 35,-117)")
    print("\t-s, --spacing: grid spacing in degrees (typically 0.01)")
    print("\t-e, --depth: depth for horizontal slice in meters (e.g. 1000)")
    print("\t-c, --cvm: one of the installed velocity models")
    print("\t-o, --outfile: output filename containing list of lines from ucvm_query")
    print("\t-H, --help: optional display usage information")
    print("\t-i, --installdir: optional UCVM isntall directory")
    print("\t-n, --configfile: optional UCVM configfile")
    print("UCVM %s\n" % VERSION)
  • run_depth.sh
echo "==== test plot_depth_profile -H ==="
plot_depth_profile.py -H

echo "==== test plot_depth_profile -s -b -e -d -v -c -o ==="
plot_depth_profile.py -s 34,-118 -b 0 -e 50000 -d vs,vp,density -v 500 -c cvmh -o depth.png 

echo "==== view_png -f ==="
view_png.py -f depth.png

echo "=== cleanup ==="
rm depth.png depth_matprops.json depth_meta.json
  • run_test.sh
#!/bin/bash

echo "==== test plot_depth_profile -H ==="
plot_depth_profile.py -H

echo "==== test plot_depth_profile -s -b -e -d -v -c -o ==="
plot_depth_profile.py -s 34,-118 -b 0 -e 50000 -d vs,vp,density -v 500 -c cvmh -o depth.png 

echo "=== verify ==="
rc=0

echo "=== cleanup ==="
rm depth.png depth_matprops.json depth_meta.json

exit rc

pycvm utilities list

utilities/pycvm/pycvm

  • basin_slice.py
  • common.py
  • cross_section.py
  • cybershake.py
  • depth_profile.py
  • difference.py
  • elevation_cross_section.py
  • elevation_horizontal_slice.py
  • elevation_profile.py
  • elevation_slice.py
  • horizontal_slice.py
  • map_grid_horizontal_slice.py
  • nafe_drake.py
  • vs30_etree_slice.py
  • vs30_slice.py

Plotting Cmd Syntax

Example of command syntax for a python plotting utility, that will export to an X-window:

  • $UCVM_INSTALL_DIR/ucvm_plotting/view_png.py -f ~maechling/test_ucvm_plotting/gmt.png