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

Test Cases Basin Query

meihuisu edited this page May 28, 2019 · 17 revisions

Basin Query

There are 3 different basin query programs in UCVM, basin_query, basin_query_mpi, and basin_query_mpi_complete. The query is to determine at which depth do the Vs values exhibit an 'upward' crossing behavior with the target threshold value supplied by the user.

basin_query accepts latlons and returns 3 depth values tuple that is, first-crossing, second crossing and the last crossing with the threshold.

basin_query_mpi accepts a bottom-left most latlon and a x and a y values in Lon, lat directions to determine a region-of-interest(ROI) and return a first-cross datafile for the whole region. This is of special interest when the size of ROI and/or result data is too great to fit on a single processor.

basin_query_mpi_complete expands original basin_query_mpi with five different crossing algorithms and returns five different set of crossing depth datafile, and in addition, the complete result data(optional)and a metadata file for the query command in json format is saved.

basin_query

The input file to the basin_query is slightly different than the input file to ucvm_query. The basin_query input file does not include the depth, only the lat/lon.

The contents of the testlatlosonly.txt input filename with four test points:

-118.0 34.0
-118.5 34.5
-119.0 33.0
-120.0 33.0

On command line, the user specifies the ucvm.conf file (-f ./conf/ucvm.conf), the model name (-m cvmsi), the Vs value they use to define basin surface (-v 2500), and the file containing the lon,lat of the points of interest (./tests/test_latlonsonly.txt).

./bin/basin_query -f ./conf/ucvm.conf -m cvmsi -v 2500 < ./tests/inputs/test_latlonsonly.txt > ./basin_query_results.txt

This query returns
 -118.0000    34.0000   1940.000   4660.000   4660.000
 -118.5000    34.5000    320.000    320.000    320.000
 -119.0000    33.0000      0.000      0.000      0.000
 -120.0000    33.0000      0.000      0.000      0.000

Return parameters

The basin_query method returns three depths in meters. The first is depth to the first occurence of the given Vs value. The second depth is the second occurrence of the Vs value. The third depth is the last occurence of the Vs value. The second and third values may be different than the first in cases where the velocity model contains velocity inversions (i.e. locations where lower velocity materials are found beneath higher velocity values).

The test query above shows that for two of the query points, depth returned is 0, indicating that the Vs value from the model at the surface at least as high as the specified basin Vs value. This might occur in regions with hard rock at the surface.

Query at locations showing velocity inversion in the model

Inversion is where returning 4th or 5th columns differ from the 3rd column which is the first crossing encountered

./bin/basin_query -f ./conf/ucvm.conf -m cca -v 2500 
input:
-118.645 34.5
-118.650 34.5
-118.655 34.5

output:
 -118.6450    34.5000    440.000    440.000    440.000
 -118.6500    34.5000    460.000   1620.000   1620.000
 -118.6550    34.5000    480.000   1780.000   1780.000

A cross section plot of the region shows indeed an inversion

./plot_cross_section.py -b 34.5,-118.7 -u 34.5,-118.6 -h 100 -v 10 -d vs -c cca -a d -s 0.0 -e  5000 -o cca_inversion.png

Query with model tiling in basin_query

When query returns no data, the returning value would be negative.

  
  input: 
 -122.5000    35.1000
 -122.3000    35.1000
 -122.1000    35.1000
 -121.9000    35.1000    
 -121.7000    35.1000 
./bin/basin_query -f ./conf/ucvm.conf -m cencal,cvms -v 2500 

 output: 
 -122.5000    35.1000      0.000      0.000      0.000
 -122.3000    35.1000      0.000      0.000      0.000
 -122.1000    35.1000      0.000      0.000      0.000
 -121.9000    35.1000    900.000    900.000    900.000
 -121.7000    35.1000      0.000      0.000      0.000
./bin/basin_query -f ./conf/ucvm.conf -m cencal -v 2500 

  output:
 -122.5000    35.1000     -1.000     -1.000     -1.000
 -122.3000    35.1000     -1.000     -1.000     -1.000
 -122.1000    35.1000     -1.000     -1.000     -1.000
 -121.9000    35.1000    900.000    900.000    900.000
 -121.7000    35.1000     -1.000     -1.000     -1.000
-bash-4.2$ ./bin/basin_query -f ./conf/ucvm.conf -m cvms -v 2500 

  output: 
 -122.5000    35.1000      0.000      0.000      0.000
 -122.3000    35.1000      0.000      0.000      0.000
 -122.1000    35.1000      0.000      0.000      0.000
 -121.9000    35.1000      0.000      0.000      0.000
 -121.7000    35.1000      0.000      0.000      0.000

basin_query_mpi_complete

The five crossing algorithms of basin_query_mpi_complete,

  1. First Crossing -- If there is no crossing, return -1 or else return the first upward crossing's depth

  2. Second or First Crossing -- If there is no crossing, return -1. If there are more than one crossing, return the 2nd to the first or else return the depth of the first crossing

  3. Last Crossing -- If there is no crossing, return -1 or return the last upward crossing's depth

  4. Second only Crossing -- If there is no crossing or less than 2 crossings, return -1. Return the 2nd crossing depth even if there is more than 2 crossings.

  5. Last but not Second or First Crossing -- If there is no crossing or there are less than or equal to 2 crossings, return -1, or return the last crossing's depth

how to run basin_query_mpi_complete

mpirun -np 20 ./basin_query_mpi_complete 
 -b ${TEST_RESULT}/cca_z2.5.first,
 ${TEST_RESULT}/cca_z2.5.firstOrSecond,
 ${TEST_RESULT}/cca_z2.5.last,
 ${TEST_RESULT}/cca_z2.5.secondOnly,
 ${TEST_RESULT}/cca_z2.5.threeLast 
 -o ${TEST_RESULT}/cca_z2.5.result,
 ${TEST_RESULT}/cca_z2.5.json 
 -f ucvm.conf -m cca -i 20 -v 2500 -l 33.35,-123.0 -s 0.005 -x 1551 -y 1201

and to plot the output data files,

 ./plot_z25_map.py -f cca_z2.5.firstOrSecond 
 -o cca_z2.5_firstOrSecond_map.png 
 -e "(first or second crossing)" -b 33.349998,-123.000000 
 -u 39.355000,-115.245003 -c cca -s 0.005000 -x 1551 -y 1201

The raw crossing result file

An Ascii file of top 3 crossings plus the last crossing per grid point within ROI region. This result file can be post processed to determine the best strategy to use in selecting the suitable crossing to use.

The format of the content:

lon lat count crossing1 crossing2 crossing3 crossing4

 *no crossing
     lon  lat  0  -1  -1  -1  -1
 *1 crossing (c1 = first crossing = last crossing)
     lon  lat  1  c1  -1  -1  -1
 *2 crossings (c1 = first, c2 = 2nd = last)
     lon  lat  2  c1  c2  -1  -1
 *3 crossings (c1 = first, c2 = 2nd, c3 = third = last)
     lon  lat  3  c1  c2  c3  -1
 *4 crossings (c1 = first, c2 = 2nd, c3 = third, c4 = fourth = last)
     lon  lat  4  c1  c2  c3  c4
 *5 crossings (c1 = first, c2 = 2nd, c3 = third, c5 = fifth = last)
     lon  lat  5  c1  c2  c3  c5
 *6 crossings (c1 = first, c2 = 2nd, c3 = third, c6 = sixth = last)
     lon  lat  6  c1  c2  c3  c6
Clone this wiki locally