Plotting Scripts - SCECcode/ucvm_docker GitHub Wiki
UCVM Docker images now contain both the UCVM command line codes, and the UCVM plotting codes. Users can generate basic plots, output the plots to png, preserve the data files, and view the plots on their system using native tools their system provides for viewing "png" image files.
A list of UCVM plotting scripts are give on the main UCVM plotting wiki at: UCVM Plotting Scripts
An example of creating a UCVM plot in a UCVM Docker image is below:
In this example, we assume the user is running a UCVM docker container on their system and have a terminal window open showing the UCVM Docker image command line. We will assume they are running a UCVM Docker image that includes velocity model "cvms5".
Following command specifies the dimensions of the plot, the material properties to be plotted, "vs", and the output file name to be used "cross-cvms5.png". The plotting script will run, and write the output file to the "target" directory.
(Python2) [maechlin@4c46768b304f target]$ plot_cross_section.py -b 34.0,-122.00 -u 34.0,-117.5 -s 0 -e 2000 -h 500 -v 10 -d vs -a d -c cvms5 -o cross-cvms5.png Using parameters: starting_depth = 0 data_type = vs ending_depth = 2000 vertical_spacing = 10 outfile = cross-cvms5.png lat2 = 34.0 horizontal_spacing = 500 color = d cvm = cvms5 lon1 = -122.00 lat1 = 34.0 lon2 = -117.5 Retrieving data. Please wait...
On a Mac, the utility program "Preview" can open and view the resulting "PNG" file that is in 'target' subdirectory. Other programs can also be used to view the file.
Another option is setting up X11 forwarding from the Docker container to the local host's X11 server. On a Mac, install the latest XQuartz and start the UCVM Docker container like the following:
# Get Mac IP address $ IP=`ifconfig -l | xargs -n1 ipconfig getifaddr` $ echo "Remember to run: xhost - "$IP # Allow connections from Mac to XQuartz $ /opt/X11/bin/xhost + "$IP" $ docker run --platform linux/amd64 --rm -it -e DISPLAY=$"${IP}:0" --mount type=bind,source="$(pwd)"/target,destination=/app/target sceccode/ucvm_227_cvms5:0710
When plot is ready, you may display the PNG file using a UCVM plotting utility: view_png.py
(Python2) [maechlin@4c46768b304f target]$ view_png.py -f cross-cvms5.png Using parameters: ('datafile', ' = ', 'cross-cvms5.png')
and a X window with the plot will show up on your screen.
Lastly, you may want to cleanup the xhost connections