#!/bin/sh
# Sutoolcsp_example1 - for program SUTOOLCSV
# Author: Andre Latour, July 2021
#
  echo "---------------------------------------------------------------------------"
  echo "---  sutoolcsv processes fixed-format and csv text files.                  "
  echo "---  Which means you can easily see the inputs and results. But read this  "
  echo "---  file for suggested changes to input so you can understand easier.     "
  echo "                                                                           "
  echo "---  The idea of this example is to show novice users how to proceed.      "
  echo "                                                                           "
  echo "     I suggest you start by viewing files shots.png and receiver.png       "
  echo "     which show the locations of shot and receiver lines and points        "
  echo "     of the 3D land survey contained in the input SPS2 files.              "
  echo "---------------------------------------------------------------------------"
#
# First test:
#
  sutoolcsv rfile=l2xall.txt setid=x match=sps2 forms=sps2 names=sps2all wfile=l2xall2.csv
#
  echo " --- that was the first run of sutoolcsv ---"
#
# Now look at the output l2xall2.csv in a simple text editor (like "vi"). 
#
# Now run:
#
  sutoolcsv rfile=l2xall2.csv wfile=l2xall2.txt
#
  echo " --- that was the second run of sutoolcsv ---"
#
# This converts the csv back to fixed format. Look at the output l2xall2.txt file.
#
# And/or Run:
#
  diff l2xall2.txt l2xall.txt
#
# Notice that the data records are identical.  
#
# Now go back to the l2xall2.csv file and put a 3 where the second 0 is located:
#        that is, change     C_SU_ID,%.0f,%.0f... to  C_SU_ID,%.0f,%.3f...
#
#
# Rerun:
#
# sutoolcsv rfile=l2xall2.csv wfile=l2xall2.txt
#
# Note that the top "7" value has become "7.000" (and so on for that "column" of numbers). 
#
#
# Next, change the 18_grnofr_27 to 18_grnofr_25 in the l2xall2.csv file.
#
# Rerun:
#
# sutoolcsv rfile=l2xall2.csv wfile=l2xall2.txt
#
# Note that the "100.00" on first data record has moved 2 spaces to the left (and so on for that "column" of numbers).
#
#
#----
#
# You can run the same kinds of tests for the SPS2 S and R files:
#
  sutoolcsv rfile=l2sall.txt setid=s match=sps2 forms=sps2 names=sps2all wfile=l2sall2.csv
  echo " --- that was the third run of sutoolcsv ---"
  sutoolcsv rfile=l2sall2.csv wfile=l2sall2.txt
  echo " --- that was the fourth run of sutoolcsv ---"
  diff l2sall2.txt l2sall.txt
#
  sutoolcsv rfile=l2rall.txt setid=r match=sps2 forms=sps2 names=sps2all wfile=l2rall2.csv
  echo " --- that was the fifth run of sutoolcsv ---"
  sutoolcsv rfile=l2rall2.csv wfile=l2rall2.txt
  echo " --- that was the sixth run of sutoolcsv ---"
  diff l2rall2.txt l2rall.txt
#
#----
#
# Once converted to csv files, it is relatively easy to produce plots/maps of the shot and receiver locations.
# As seen in the following files:
#
# shots.png 
# receiver.png
#
# One thing to note is that the shot lines and receiver lines are at right-angles. 
# This is quite typical for 3D. For 2Ds, the shot and receiver line is the same.
#
  echo "                                                                           "
  echo "                                                                           "
  echo "---------------------------------------------------------------------------"
  echo "---  sutoolcsv processes fixed-format and csv text files.                  "
  echo "---  Which means you can easily see the inputs and results. But read this  "
  echo "---  file for suggested changes to input so you can understand easier.     "
  echo "                                                                           "
  echo "---  The idea of this example is to show novice users how to proceed.      "
  echo "                                                                           "
  echo "     I suggest you start by viewing files shots.png and receiver.png       "
  echo "     which show the locations of shot and receiver lines and points        "
  echo "     of the 3D land survey contained in the input SPS2 files.              "
  echo "---------------------------------------------------------------------------"
