Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Plotting Examples

meihuisu edited this page May 30, 2019 · 48 revisions

Plotting Tools Overview

Current UCVMC plotting scripts combine several function into specialized plotting scripts. The user defines a region of interest, usually by defining the bottom point (southern and western most) lat,lon and then an upper point (the northern, and most eastern point), and resolution information. Then the plotting scripts discritized the region, determined a collection of lat,lons, depths to query the model. Then for each geographical point, it queries the selected model or models through UCVM, and collects the returned values. It then calls a matplotlib script to display the plots or save it into a file. The colors in the plots show how some velocity model parameter such as Vp, Vs, or rho varies throughout the region.

Since the plotting scripts call the velocity models for each point, the script can take time to run. If you specify a highly detailed plot, the script can take several minutes before it produces an image. It is often worthwhile to plot a lower resolution version of the desired image, confirm that the plot looks right, then specify a high resolution version, because high resolution version can take a long time to run.

Examples of how the scripts can be called to produce plots are shown below. In each case, the scripts were after UCVMC was installed, and all the tests invoked by the "make check" passed. In each case, the scripts were called from the installation_dir/utilities directory but maybe called otherwise if installation_dir is supplied on command line.

Exporting X-windows to client computer

If you are running UCVM on a remote system, the plotting scripts will try to return the image to your computer using Xwindows unless an output filename is supplied. For you to see the resulting plots remotely, you need to enable your computer to accept incoming Xwindows displays. The following steps may help you run the plotting scripts on remote computers and display the images remotely.

First, ssh into the remote UCVM system using xwindows

Unless you are logged into a terminal on a Linux system where UCVMC is installed, you may need to ssh into the UCVM server and export the Xwindows to your local display. As one example, I can ssh from my Mac into a linux server with the following command. I need to have a xwindows client installed on my local Mac. The program I used on a Mac running Sierra is XQuartz. On the local laptop you may need to Comment out any export DISPLAY commands in your .bash_profile. You may also need to grant permission to startup xwindows on your local system by typing:

%xhost +

Then, ssh into the UCVM server, with this command:

%ssh -X username@hpc.usc.edu

%ssh -Y username@hpc-login2.usc.edu

Then, once logged into the remote server, you can test your xwindows connection, by exporting a simple Xwindow application. On most linux systems, you can type:

% xclock

If this program runs, on the remote system, and clock is displayed on your local system, you xwindows are working properly and UCVMC plots should be exported correctly. You can close the clock, it is not needed for UCVMC plotting.

Running plotting scripts

In a correctly installed UCVM system, the user runs the plotting scripts by moving into the installation_dir/utilities. This is the subdirectory that contains the python plotting scripts.

There are two ways to run the plotting scripts. In the first, the user invokes the script without any parameters, and the script prompts the user for each required parameters.

In the second way of running the scripts, the user invokes the script and defines the required parameters on the command line. This is more effiecent and makes it possible to script multiple plots, and repeat plots, without requiring the user to type information into a terminal window. The command line tends to reduce entry errors when creating multiple plots. The examples below use the command line parameter approach.

plot_depth_profile.py

The following command will produce a depth profile of vs, vp and density at (34,-118) from depth of 0 to 50000m

./plot_depth_profile.py -s 34,-118 -b 0 -e 50000 -d vs,vp,density -v 500 -c cvmh -o depth_profile.png

plot_horizontal.py

The following command will produce a horizontal plot that will appear on your local screen.

./plot_horizontal_slice.py -b 33.5,-118.75 -u 34.5,-117.5 -s 0.01 -e 500 -d vs -a s -c cvmh

The following command will produce a horizontal slice of Vp from cvmh at depth of 500m

-bash-4.2$ ./plot_horizontal_slice.py -b 33.5,-118.75 -u 34.5,-117.5 -s 0.01 -e 500 -d vp -a dd -c cvmh -o horizontal_slice_2.png

The following command will produce a horizontal slice from cvms-4

./plot_horizontal_slice.py -b 33.5,-118.75 -u 34.5,-117.5 -s 0.01 -e 500 -d vs -c cvms -a d -o horizontal_slice_4.png

and

./plot_horizontal_slice.py -b 34,-118 -u 35,-117 -s 0.01 -e 1000 -d vs -c cvms -a d -o horizontal_slice_3.png

plot_cross_section.py

The following command will produce a cross section plot.

./plot_cross_section.py -b 34.0,-118.75 -u 34.0,-117.5 -s 0 -e 5000 -h 500 -v 50 -d vs -a s -c cvmh -o cross_section_1.png

and

./plot_cross_section.py -b 34.0,-118.0 -u 35.0,-117.0 -h 100 -v 10 -d vs -c cvms -a d -s 0 -e 5000 -o cross_section_2.png

A cross section of the CVM-S4.26 model is produced with this command:

./plot_cross_section.py -b 34.0,-118.75 -u 34.0,-117.5 -s 0 -e 500 -h 500 -v 5 -d vs -a d -c cvms5 -o cross_section_3.png

plot_elevation_cross_section.py

The following command will produce a cross section plot by elevation. Note the sign of vertical step and the ending elevation.

./plot_elevation_cross_section.py -b 35.0,-121 -u 35,-118 -s 2000 -e -8000 -h 1000 -v -10 -d vp -a s -c cvmh -o elevation_cross_section.png

plot_elevation_profile.py

The following command will produce a profile plot by elevation. Note the sign of vertical step and the ending elevation.

./plot_elevation_profile.py -b 34.0,-115  -b 1000 -e -3000 -v -10 -d vp, vp,density  -c cvmh -o elevation_profile.png

plot_elevation_map.py

The following command will produce an elevation plot showing values across the region.

./plot_elevation_map.py -b 33.35,-118 -u 34.35,-117 -s 0.01 -a d -c cvmh -o elevation_map.png

plot_vs30_map.py

The following command will produce a plot showing Vs30 values across the region, based on vs30 calculation using the underlying model, rather than the topography and Vs30map provided by UCVM for calculating the GTL values.

./plot_vs30_map.py -b 33.5,-118.75 -u 34.5,-117.5 -s 0.01 -a s -c cvmh -o vs30_map.png

plot_vs30_etree_map.py

The following command will produce a plot showing Vs30 etree values across the region, based on the topography and Vs30 map provided by UCVM for calculating the GTL values.

./plot_vs30_etree_map.py -b 33.5,-118.75 -u 34.5,-117.5 -s 0.01 -a s -c cvmh -o vs30_etree_map.png

plot_z10_map.py

The following command will produce a z10 map, that shows depth to Vs1000m/s.

./plot_z10_map.py -b 33.5,-118.75 -u 34.5,-117.5 -s 0.01 -a s -c cvms -o z10_map.png

plot_z25_map.py

The following command will produce a z25 map, that shows depth to Vs2500m/s.

./plot_z25_map.py -b 33.5,-118.75 -u 34.5,-117.5 -s 0.01 -a sd -c cvms -o z25_map.png

plot_density_plot.py

The following command will produce an scatter plot of Rho versus density from Vs of a region at a specific depth. A point grid is generated by supplying two points to make_map_grid.py.

./make_map_grid.py -b 30.5,-126 -u 42.5,-120.51 -s 0.01 -e 1000 -c cvmh  -o map_grid.txt

./plot_density_plot.py -i map_grid.txt  -e 1000 -o density_plot.png -n "CVMH Vp Density Scatter Plot 0k"

plot_scatter_plot.py

The following command will produce an scatter plot of Vp density at a region at a specific depth. A point grid is generated by supplying two points to make_map_grid.py.

./make_map_grid.py -b 30.5,-126 -u 42.5,-120.51 -s 1 -e 0 -c cvmh  -o map_grid.txt

./plot_scatter_plot.py -i map_grid.txt  -e 0 -o sctter_plot.png -n "CVMH Vp Density Scatter Plot 0k"

plot_cross_section.py and plot_horzontal_slice.py in bicolor

The following commands produce plots in bi-color colormap with user selected gating point (default is 2500m)

./plot_cross_section.py -b 35.21,-121 -u 35.21,-118 -c cca -s 0 -e 5000 -v 100 -h 1000 -g 2.5 -a b -d vs -o cross_section_cca_bi.png

./plot_horizontal_slice.py -b 34.21,-121.0 -u 36.21,-118 -s 0.05 -e 200 -d vs -a b -c cca -o horizontal_cca_vs_bi.png

Plot commands from the SRL paper

Paper Maps Commands:

./plot_z10_map.py -b 33.65,-118.6 -u 34.125,-118.0 -s 0.01 -c cvms -o z10.png

./plot_cross_section.py -b 33.8875,-118.6 -u 33.8875,-118.0 -s 0 -e 2000 -h 50 -v 10 -d vs -a d -c cvmh -o cross.png

Clone this wiki locally