[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20010506: imgdisp.k in ROUTE Postprocess BATCH invocation



>From: Brian Colle <address@hidden>
>Organization: SUNY Stony Brook
>Keywords: 200105070058.f470wSp08974 McIDAS Frame

Brian,

>I just recently copied my ldm system to a new solaris SUN machine.
>Everything appears to be working except the ldm-mcidas batch.k script. I
>am getting the wrong mapping and date on the current imagery (i.e.,
>imgdisp.k: Failed to write nav for frame  1  in my batch.log file).
>
>Here is what I checked so far:
>
>1)  MCDATA, MCPATH, and PATH are defined for ldm the same as
>  in the batch.k script
>
>2)  dmap.k FRAME indicated:
>-r--      1644 Sep 06  1999 FRAME.PROG    /usr/local/ldm/mcidas/data
>-r--      1981 Sep 06  1999 FRAMECUR.PROG /usr/local/ldm/mcidas/data
>-rw-     58752 May 06 20:29 FRAMENH.001   /usr/local/ldm/data/mcidas
>
>I thought having FRAMENH.001 somewhere else besides within .mctmp would be
>a problem, but my other SUN ldm machine also has this and it
>works (it seems to be writing over it each time an image is created).

This was a good try on your part.  You should remove this copy of
FRAMENH.001.  Along those same lines, and most likely the cause of your
problem is copies of the frame directory file(s) in the wrong place.
Please run:

dmap.k Frame

I feel confident that you will see some copies of FrameN.M (where N and
M are integers) in one or more incorrect directories.  Like
FRAMENH.001, the FrameN.M files should only be created in the
~/.mctmp/nnnnn directories.  I am willing to bet that your dmap.k
listing will show one or more of these files (most likely Frame1.0) in
a directory like ~/mcidas/help.  All of these files need to be deleted.

>3) matched groups IDs between ldm (who runs the ROUTE Postprocess)
>and mcidas.

OK.

>The symptoms above appear to suggest some sort of permission problem, but
>I can't seem to hunt it down.

I am guessing that you have one ore more FrameN.M files in a ~mcidas
directory and they are not writable by the user running your LDM (and
by virtue of inheritance, your ROUTE PostProcess BATCH files).
Deleting the offending file(s) is your best bet.

>I attached the batch.k script (which works 
>on my my other SUN machine) to this email. Please let me know what I
>should try next.

Please let me know if the cleaning up of the FrameN.M file(s) cures
your problem.

>Thank you for your time.

You are welcome.

I am interested in your creating a batch.k file that gets executed as a
ROUTE PostProcss in Perl.  The file shows that you understand the
concept of intercepting BATCH invocations from ldm-mcidas decoder
entries in the LDM pqact.conf file and substituting a script in which
necessary McIDAS definitions are made.  I recommend that you modify
your script a bit by adding definitions of the Unix environment
variables MCTABLE_READ and MCTABLE_WRITE.  These environment variables
are used to define where your ADDE client routing table can be read and
written, respectively.  My McIDAS 7.7x distribution has examples of
setting these in shell script files.  For information on setting the
environment variables, please review the files mcbatch.sh and mcrun.sh
in the McIDAS installation data directory.

I am leaving your Perl version of batch.k in this message so it will
get indexed into our inquiry tracking system along with your query.


#! /usr/local/bin/perl

%index = ('ANT', 0, 'FLT1', 1, 'FLT2', 2, 'H2O8', 3, 'H2O9', 4, 
          'IR8', 5, 'IR9', 6, 'RES', 7, 'VIS8', 8, 'VIS9', 9,
          'MOLLIR', 10, 'MOLLH2O', 11, 'FLT', 1,
          'GW-IR', 6, 'GW-VIS', 9, 'GW-WV', 4, 'GE-IR', 5,
          'GE-VIS', 8, 'GE-WV', 3, 'MOLL', 10, 'MOLL-WV', 11);

@name = ("ant", "flt1", "flt2", "wv-e", "wv", "ir-e", "ir", "res", "vis-e",
         "vis", "ir-moll", "wv-moll");
@su = ("", "VAR", "VAR", "H2O", "H2O", "IRTEMP", "IRTEMP", "VAR", 
       "VISBRIT", "VISBRIT", "NONE", "NONE");
@latlon = (0, 10, 10, 20, 20, 20, 20, 10, 20, 20, 20, 20);
@enhanced = (0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1);
@e_name = ("ant_enhanced", "flt1_enhanced", "flt2_enhanced",
           "wv-e_enhanced", "wv_enhanced", "ir-e_enhanced",
           "ir_enhanced", "res_enhanced", "vis-e_enhanced",
           "vis_enhanced", "ir-moll_enhanced", "wv-moll_enhanced");
@e_latlon = (0, 0, 0,
             "LALO INT=10 10", "LALO INT=10 10", "LALO INT=10 10 LIN=1 777",
             "LALO INT=10 10 LIN=1 777", "LALO INT=10 10", "LALO INT=10 10",
             "LALO INT=10 10", "LALO INT=15 15", "LALO INT=15 15");
@e_grayscale = (0, 0, 0,
                "GRAY=YES","GRAY=YES","",
                "","GRAY=YES","GRAY=YES",
                "GRAY=YES","","GRAY=YES");
@e_bar = (0, 0, 0,
          0, 0, "1 ORIENT=HOR SU=IRTEMP LSIZE=8 BARDIM=USER 777 10 10 1000",
          "1 ORIENT=HOR SU=IRTEMP LSIZE=8 BARDIM=USER 777 10 10 1000", 0, 0,
          0, "1 ORIENT=HOR SU=IRTEMP LSIZE=8", 0);
          

close (STDOUT);
close (STDERR);
open(STDOUT, ">>/usr/local/ldm/logs/batch.log");
open(STDERR, ">>/usr/local/ldm/logs/batch.log");
select STDOUT;
$| = 1;
$_ = join($", @ARGV);
s/^BATCH //;
( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
                                                           gmtime(time);
printf "BATCH.k - %04d%02d%02d %02d%02d%02d - %s\n", $year+1900, $mon+1,
    $mday, $hour, $min, $sec, $_;
umask 002;

$ENV{'MCDATA'}='/usr/local/ldm/data/mcidas';
$ENV{'MCGUI'}='/usr/local/ldm/mcidas/bin';
$ENV{'MCPATH'} = '/usr/local/ldm/data/mcidas:/usr/local/ldm/mcidas/data:'.
    '/usr/local/ldm/mcidas/help';
$ENV{'PATH'}='.:/usr/local/ldm/mcidas/bin:/usr/local/ldm/bin:'.
    '/usr/local/ldm/ldm-mcidas/bin:'.
    '/usr/local/ldm/local/bin:/usr/local/bin:/usr/openwin/bin:/usr/ccs/bin:'.
    '/usr/bin:/usr/ucb';
chdir "/usr/local/ldm/data/mcidas";

# 700x872 335x612 182x250 480x640 600x1000

#
/\"(.*)\.BAT/;
if ($1 eq "") {
    s/\"/\\\"/;
    print "mcenv batch.k $_\n";
    exec "mcenv batch.k $_";
}
@par = split();
$i = $index{$1};
$kind = $1;
$area = sprintf("AREA%04d", $par[1]);
$adde = "MYDATA/IMAGES.$par[1]";
if ($i eq "") {
    if ($kind eq "MDR") {
        $l = `/usr/local/ldm/local/bin/arinfo -m -i $area`;
        ($size, $type) = split(' ', $l);
        $ENV{'SHELL'} = '/bin/sh';
        $OLDHOME = $ENV{'HOME'};
        $ENV{'HOME'} .= "/.batch/$$";
        mkdir $ENV{'HOME'}, 0775;
        open(MCIDAS, "|mcenv -f $size");
        print "imgdisp.k $adde 1 eu=MDR su=MDR\n";
        print MCIDAS "imgdisp.k $adde 1 eu=MDR su=MDR\n";
#       exec ("dmap.k Frame");
#       print "df.k $par[1] 1 EU=MDR SU=MDR\n";
#       print MCIDAS "df.k $par[1] 1 EU=MDR SU=MDR\n";
        print "map.k H 1\n";
        print MCIDAS "map.k H 1\n";
        print "frmsave.k 1 radar.gif FORM=GIF\n";
        print MCIDAS "frmsave.k 1 radar.gif FORM=GIF\n";
#       print "svgif.k 1 radar.gif\n";
#       print MCIDAS "svgif.k 1 radar.gif\n";
        close MCIDAS;
        rmdir "$ENV{'HOME'}/.mctmp";
        rmdir $ENV{'HOME'};
        $ENV{'HOME'} = $OLDHOME;
        exec("/usr/local/ldm/local/bin/fix_radar $par[1]");
    }
    elsif ($kind eq "BREF1") {
        exec("/usr/local/ldm/local/bin/fix_nids $par[1] BREF1");
    }
    else {
        s/\"/\\\"/;
        print "mcenv batch.k $_\n";
        exec "mcenv batch.k $_";
    }
    if ($kind eq "VEL1") {
        exec("/usr/local/ldm/local/bin/fix_nids $par[1] VEL1");
    }
}
else {
    $l = `/usr/local/ldm/local/bin/arinfo -m -i $area`;
    ($size, $type) = split(' ', $l);
    system ("/usr/local/ldm/local/bin/fix_sat1 $par[1] $name[$i]");
    $s = $su[$i];
    if ($s ne "") {
        if ($s eq "VAR") {
            if ($type eq "VIS") { $s = "VISBRIT"; }
            elsif ($type eq "IR") { $s = "IRTEMP"; }
            elsif ($type eq "WV") { $s = "H2O"; }
            else { $s = "IRTEMP"; }
        }
        elsif ($s eq "NONE") {$s = "";}
        $ENV{'SHELL'} = '/bin/sh';
        $OLDHOME = $ENV{'HOME'};
        $ENV{'HOME'} .= "/.batch/$$";
        mkdir $ENV{'HOME'}, 0775;
# make the standard, unenhanced images
        if ($kind eq "IR9" || $kind eq "GW-IR") {
            open(MCIDAS, "|mcenv -f $size -f 182x252");
        }
        else { open(MCIDAS, "|mcenv -f $size"); }
        print "imgdisp.k $adde 1 eu=IMAGE su=$s\n";
        print MCIDAS "imgdisp.k $adde 1 eu=IMAGE su=$s\n";
#       print "df.k $par[1] 1 EU=IMAGE SU=$s\n";
#       print MCIDAS "df.k $par[1] 1 EU=IMAGE SU=$s\n";
        print "map.k SAT 1 LALO -1 INT=$latlon[$i] $latlon[$i]\n";
        print MCIDAS "map.k SAT 1 LALO -1 INT=$latlon[$i] $latlon[$i]\n";
        print "frmsave.k 1 $name[$i].gif FORM=GIF\n";
        print MCIDAS "frmsave.k 1 $name[$i].gif FORM=GIF\n";
#       print "svgif.k 1 $name[$i].gif\n";
#       print MCIDAS "svgif.k 1 $name[$i].gif\n";
        if ($kind eq "IR9" || $kind eq "GW-IR") {

            print "imgremap.k $adde MYDATA/IMAGES.9876".
                " pro=PS latlon=47 125 res=9 size=182 252\n";
            print MCIDAS "imgremap.k $adde MYDATA/IMAGES.9876".
                " pro=PS latlon=47 125 res=9 size=182 252\n";
#           print "aamap.k $par[1] 9876 2 PS 47 125 9\n";
#           print MCIDAS "aamap.k $par[1] 9876 2 PS 47 125 9\n";
            print "imgdisp.k MYDATA/IMAGES.9876 2 EU=IMAGE SU=IRTEMP\n";
            print MCIDAS "imgdisp.k MYDATA/IMAGES.9876 2 EU=IMAGE SU=IRTEMP\n";
#           print "df.k 9876 2 EU=IMAGE SU=IRTEMP\n";
#           print MCIDAS "df.k 9876 2 EU=IMAGE SU=IRTEMP\n";
            print "map.k SAT 1 LALO -1 INT=10 10 LABEL=NO ".
                "GRA=2 IMA=2 NAME=UW3MILE\n";
            print MCIDAS "map.k SAT 1 LALO -1 INT=10 10 LABEL=NO ".
                "GRA=2 IMA=2 NAME=UW3MILE\n";
            print "frmsave.k 2 irsmall.gif FORM=GIF\n";
            print MCIDAS "frmsave.k 2 irsmall.gif FORM=GIF\n";
#           print "svgif.k 2 irsmall.gif\n";
#           print MCIDAS "svgif.k 2 irsmall.gif\n";
        }
        close MCIDAS;
# make the new enhanced images
        if ($enhanced[$i]) {
            $ename = $e_name[$i];
            if ($type eq "VIS") {$svga = "SVGAVIS"; }
            elsif ($type eq "IR") {$svga = "SVGAIR"; }
            elsif ($type eq "IR2") {$svga = "SVGAVIS"; }
            elsif ($type eq "WV") {$svga = "SVGAWV"; }
            else {$svga = "SVGAVIS"; }
            if ($size =~ /1400x/) {
                $size = "800x1024";
                if ($name[$i] =~ /.*-e$/) { 
                    $loc = "PLACE=CENTER LATLON=35 80";
                }
                else {$loc = "PLACE=CENTER LATLON=35 135";}
#               if ($name[$i] =~ /.*-e$/) { $loc = "EC 35 80";}
#               else {$loc = "EC 35 135";}
            } else {
                $loc = "";
#               $loc = "AU";
            }
            open(MCIDAS, "|mcenv -f $size");
            print "imglist.k $adde\n";
#           print "la.k $par[1]\n";
#change graphic color levels to 16
#change image color levels to 128
            print "lwu.k POKE TERMCHAR.001 16 7171\n";
            print "lwu.k POKE TERMCHAR.001 128 7180\n";
            print "lwu.k POKE TERMCHAR.001 16 7191\n";
            print "ucu.k POKE 500 16\n";
            print "ucu.k POKE 600 128\n";
            print "eg.k 1\n";
            print "gu.k REST ENHANCED\n";
            print MCIDAS "imglist.k $adde\n";
#           print MCIDAS "la.k $par[1]\n";
            print MCIDAS "lwu.k POKE TERMCHAR.001 16 7171\n";
            print MCIDAS "lwu.k POKE TERMCHAR.001 128 7180\n";
            print MCIDAS "lwu.k POKE TERMCHAR.001 16 7191\n";
            print MCIDAS "ucu.k POKE 500 16\n";
            print MCIDAS "ucu.k POKE 600 128\n";
            print MCIDAS "eg.k 1\n";
            print MCIDAS "gu.k REST ENHANCED\n";
# now load the image, make the map, set the enhancement table, and make the gif
#           exec ("dmap.k Frame");
            print "imgdisp.k $adde 1 $loc $gray\n";
            print MCIDAS "imgdisp.k $adde 1 $loc $gray\n";
#           print "df.k $par[1] 1 $loc 1 $e_grayscale[$i]\n";
#           print MCIDAS "df.k $par[1] 1 $loc 1 $e_grayscale[$i]\n";
            print "eu.k REST $svga $type $kind\n";
            print MCIDAS "eu.k REST $svga\n";
            if ($kind =~ /MOLL/) {
                print "map.k SAT 1 $e_latlon[$i] GRA=1\n";
                print MCIDAS "map.k SAT 1 $e_latlon[$i] GRA=1\n";
            } else {
                print "map.k H 1 $e_latlon[$i] GRA=1\n";
                print MCIDAS "map.k H 1 $e_latlon[$i] GRA=1\n";
            }
            if ($e_bar[$i]) {
                print "bar.k $e_bar[$i]\n";
                print MCIDAS "bar.k $e_bar[$i]\n";
            }
            print "frmsave.k 1 $e_name[$i].gif FORM=GIF\n";
            print MCIDAS "frmsave.k 1 $e_name[$i].gif FORM=GIF\n";
#           print "svgif.k 1 $e_name[$i].gif\n";
#           print MCIDAS "svgif.k 1 $e_name[$i].gif\n";
            close MCIDAS;
        } # end of new, enhanced image processing
        rmdir "$ENV{'HOME'}/.mctmp";
        rmdir $ENV{'HOME'};
        $ENV{'HOME'} = $OLDHOME;
    }
    system ("/usr/local/ldm/.profile");
    exec ("/usr/local/ldm/local/bin/fix_sat2 $par[1] $name[$i] $ename");
};

Tom Yoksas


NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.