mplot (version 2.0)

You can also look at:
#! /usr/bin/perl

##############################################################################
#
# SYNTAX: mplot filename
#
# DESCRIPTION: This is a short script to plot several quantities of interest
# DESCRIPTION: from ASCA filter (.mkf) files.
# DESCRIPTION: Three postscript files are produced:
# DESCRIPTION: <OL>
# DESCRIPTION: <LI> filename_mkfc.ps, XSELECT parameters for both SIS and GIS
# DESCRIPTION: <LI> filename_mkfs.ps, XSELECT parameters used for just the SIS
# DESCRIPTION: <LI> filename_mkfm.ps, bit-rate and modes of the various
# DESCRIPTION:      instruments
# DESCRIPTION: </OL>
# DESCRIPTION: <P>
# DESCRIPTION: This routine was originally implemented as an STOOL
# DESCRIPTION: but it is more appropriately implemented as a processing
# DESCRIPTION: utility. The main reason is that this script calls FTOOLS
# DESCRIPTION: so it is a good idea to have this under the same FTOOLS
# DESCRIPTION: version control as the rest of processing.
# DESCRIPTION: The original STOOL was written 2/7/96.
# DESCRIPTION: It was converted to a processing utility on 6/12/97.
#
# VERSION: 2.0
#
# HISTORY: 0.0 -> 1.0 2/6/98
# HISTORY: Switched the order of the labels for the BIT_RATE quantity.
# HISTORY: Also added FRAME mode to the SIS data modes.
# HISTORY: The change was actually in the "lists/mkf_common" file.
# HISTORY: 
# HISTORY: 1.0 -> 1.1 4/23/98
# HISTORY: Modified plot scripts to comply with the FTOOLS 4.1 version of 
# HISTORY: fplot. The new version keeps the default plot commands around
# HISTORY: and a number of these defaults had to be over-ridden.
# HISTORY: 
# HISTORY: 1.1 -> 2.0 1999-05-07
# HISTORY: Converted from ksh to perl
#
# CALLS: $UTIL/log_entry
# CALLS: $UTIL/setup_parfile
# CALLS: $UTIL/ftool_test
# CALLS: $FTOOL/fplot
#
##############################################################################

#$DEBUG = 1;

$file = $ARGV[0];

$UTIL = $ENV{"UTIL"};
$FTOOL = $ENV{"FTOOL"};
$LISTS = $ENV{"LISTS"};

$base = $file ;
$base =~ s/.mkf$//;

`$UTIL/log_entry "Plotting quantities from $file"`;

###########################
# Basic plot command files
###########################
$compco = "mkf_common";
$sispco = "mkf_sis";
$modpco = "mkf_modes";

####################################
# Clear out any old temporary files
####################################
unlink "$compco.pco";
unlink "$sispco.pco";
unlink "$modpco.pco";
unlink 'pgplot.ps';

####################
# Common parameters
####################
open IN, "<$LISTS/$compco";
open OUT, ">${compco}.pco";
while (<IN>) {

    s/MKF/$file/;
    print OUT;
}
close(OUT);

`$UTIL/setup_parfile $FTOOL/fplot.par infile=$file              \\
                                      xparm=TIME                       \\
                                      yparm="ACS ANG_DIST SAA ELV COR" \\
                                      rows="-"                         \\
                                      device="/ps"                     \\
                                      pltcmd="\@${compco}"                \\
                                      offset=yes`;

`$FTOOL/fplot >stdout.log 2>stderr.log`;
`$UTIL/ftool_test fplot $? $0 2 stdout.log stderr.log`;

rename 'pgplot.ps', "${base}_mkfc.ps";

#################
# SIS parameters
#################
open IN, "<$LISTS/$sispco";
open OUT, ">$sispco.pco";
while (<IN>) {
    s/MKF/$file/;
    print OUT;
}
close(OUT);

`$UTIL/setup_parfile $FTOOL/fplot.par infile=$file                       \\
                                      xparm=TIME                         \\
                                      yparm="FOV BR_EARTH T_DY_NT T_SAA" \\
                                      rows="-"                           \\
                                      device="/ps"                       \\
                                      pltcmd="\@${sispco}"                  \\
                                      offset=yes`;

`$FTOOL/fplot >stdout.log 2>stderr.log`;
`$UTIL/ftool_test fplot $? $0 2 stdout.log stderr.log`;

rename 'pgplot.ps', "${base}_mkfs.ps";

###################
# Instrument modes
###################
open IN, "<$LISTS/$modpco";
open OUT, ">$modpco.pco";
while (<IN>) {
    s/MKF/$file/;
    print OUT;
}
close(OUT);

`$UTIL/setup_parfile $FTOOL/fplot.par infile=$file      \\
                                      xparm=TIME        \\
                                    yparm="BIT_RATE S0_MODE S1_MODE GIS_MODE"\\
                                      rows="-"          \\
                                      device="/ps"      \\
                                      pltcmd="\@${modpco}" \\
                                      offset=yes`;

`$FTOOL/fplot >stdout.log 2>stderr.log`;
`$UTIL/ftool_test fplot $? $0 2 stdout.log stderr.log`;

rename 'pgplot.ps', "${base}_mkfm.ps";

####################
# Clean up and exit
####################
unlink "$compco.pco";
unlink "$sispco.pco";
unlink "$modpco.pco";

exit 0;