#!perl                                                      #<HTML><PRE>
#
# Perl script to display the colour saturation of the snapshots
#
# Version: 5.50
# Date: 2001, March 27
#
# Usage:
#     perl fdmax.pl SEP DIV ROT PS
# Parameters:
#     SEP...  Name of the history file.
#     DIV...  Filename of the 4-D data cube of the "normalized" wavefield
#             divergence (P waves).
#     ROT...  Filename of the 4-D data cube of the X2 component of the
#             "normalized" wavefield rotation (S waves).
#     PS...   Output PostScript figure to be displayed and edited.
#             Refer to 'print' commands at the end of this file.
#
# ======================================================================
#
  @ARGVsave=@ARGV;
  @ARGV=();
  require 'go.pl';
  &CHK("forms/","sep.pl");
  require 'sep.pl';
  @ARGV=@ARGVsave;
#
  &CHK("fd/","fdmax.pro");
  &CHK(""   ,"$ARGV[0]" );
  &CHK(""   ,"$ARGV[1]" );
  &CHK(""   ,"$ARGV[2]" );
#
  &RSEP1($ARGV[0]);
  &RSEP3("N4"   ,$N4   ,1);
  &RSEP3("D4"   ,$D4   ,1);
  &RSEP3("SAMP" ,$SAMP ,1);
  &RSEP3("VSAT" ,$VSAT ,1);
  &RSEP3("VSAT4",$VSAT4,0);
#
  &ECHO( ">$ARGV[3]","%!");
  &ECHO(">>$ARGV[3]","/N4    $N4    def");
  &ECHO(">>$ARGV[3]","/D4    $D4    def");
  &ECHO(">>$ARGV[3]","/SAMP  $SAMP  def");
  &ECHO(">>$ARGV[3]","/VSAT  $VSAT  def");
  &ECHO(">>$ARGV[3]","/VSAT4 $VSAT4 def");
#
  open(LU,">fdmax.h");
  print LU "N1=111    N3=41     N4=321 \n";
  print LU "D1=1.000  D3=1.000  D4=0.004300 \n";
  print LU "O1=0.000  O3=0.000  O4=0.000 \n";
  print LU "N1NEW=1  N2NEW=1  N3NEW=1  GNORM=999. \n";
  print LU "GRD='$ARGV[1]'  GRDNEW='fdmax.tmp' \n";
  close (LU) || die "Error in writing history file fdmax.h";
  &RUN("grdnorm","'fdmax.h' /");
  &APPEND("$ARGV[3]","fdmax.tmp");
#
  open(LU,">>fdmax.h");
  print LU "GRD='$ARGV[2]'  GRDNEW='fdmax.tmp' \n";
  close (LU) || die "Error in writing history file fdmax.h";
  &RUN("grdnorm","'fdmax.h' /");
  &APPEND("$ARGV[3]","fdmax.tmp");
  &APPEND("$ARGV[3]","fdmax.pro");
#
  print "-----------------------------------------------------------------\n";
  print "Display and edit file '$ARGV[3]' to adjust the colour saturation!\n\n";
  print "Black line in figure '$ARGV[3]' corresponds to the maximum colour\n";
  print "saturation, green dots to P waves and blue dots to S waves.\n";
  print "Change SAMP to amplify S waves with respect to P waves,\n";
  print "VSAT to adjust the initial level of the saturation line and\n";
  print "VSAT4 to adjust its exponential decay.\n\n";
  print "When figure '$ARGV[3]' is OK, modify SAMP, VSAT and VSAT4 in the\n";
  print "history file accordingly!\n";
# ======================================================================
1;                                                               #</PRE>
