Index: /branches/eam_branches/ipp-pstamp-20260421/ippScripts/scripts/ipp_site_lookup.pl
===================================================================
--- /branches/eam_branches/ipp-pstamp-20260421/ippScripts/scripts/ipp_site_lookup.pl	(revision 43098)
+++ /branches/eam_branches/ipp-pstamp-20260421/ippScripts/scripts/ipp_site_lookup.pl	(revision 43098)
@@ -0,0 +1,97 @@
+#!/usr/bin/env perl
+
+# use this program to find the value of elements in the site.config
+
+use warnings;
+use strict;
+
+use IPC::Cmd 0.36 qw( can_run run );
+use File::Spec;
+use PS::IPP::Config qw( :standard );
+
+my $ipprc = PS::IPP::Config->new(); # this is used for PATH, NEB filename conversions
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+
+# Parse the command-line arguments
+my ($dvo_db, $psastro_db, $tess_id, $verbose, $help);
+
+GetOptions('dvodb=s'        => \$dvo_db,     # translate dvo database 
+	   'tess_id=s'      => \$tess_id,    # translate tessalation
+	   'psastro_db=s'   => \$psastro_db, # translate PSASTRO.CATDIRS
+	   'verbose'        => \$verbose,
+	   'help'           => \$help       # give help listing
+    ) or pod2usage( 2 );
+
+pod2usage( -msg => "return values from site.config\nUsage: $0 [--dvodb DVO] [--psastro_db CATDIR] [--tess_id TESS]", -exitval => 2) if defined $help;
+
+unless (defined $dvo_db or defined $psastro_db or defined $tess_id) {
+    pod2usage( -msg => "Usage: $0 [--dvodb DVO] [--psastro_db CATDIR] [--tess_id TESS]\n specify one of --dvodb, --psastro_db or --tess_id", -exitval => 2 );
+}
+
+# pod2usage( -msg => "Required options: ??", -exitval => 3) unless @ARGV > 0;
+
+# if tess_id is not defined in the list of tessellations in ipprc,
+# then tess_id needs to be an absolute path, or it must start with
+# file://, path://, or neb://
+if ($tess_id) {
+    # test if tess_id is listed in the TESSELLATION metadata block
+    my $tess_dir = $ipprc->tessellation_catdir( $tess_id ); # Tessellation catdir for DVO
+    unless (defined $tess_dir) { die "configuration error"; }
+    if ($tess_dir eq $tess_id) {
+	$tess_dir = "NONE";
+    }
+    if ($verbose) {
+	print "TESS: $tess_id = $tess_dir\n";
+    } else {
+	print "$tess_dir\n";
+    }
+}
+
+# dvodb needs to be an absolute path, or it must start with file://, path://, or neb://
+if ($dvo_db) {
+    # test if dvo_db is listed in the DVO.CATDIRS metadata block
+    my $catdir = $ipprc->dvo_catdir( $dvo_db ); # catdirs for DVO
+    unless (defined $catdir) { die "configuration error"; }
+    if ($catdir eq $dvo_db) {
+	$catdir = "NONE";
+    }
+    if ($verbose) {
+	print "DVODB: $dvo_db = $catdir\n";
+    } else {
+	print "$catdir\n";
+    }
+}
+
+# psastro_db needs to be an absolute path, or it must start with file://, path://, or neb://
+if ($psastro_db) {
+    # test if psastro_db is listed in the PSASTRO.CATDIRS metadata block
+    my $catdir = $ipprc->psastro_catdir( $psastro_db ); # catdirs for PSASTRO
+    unless (defined $catdir) { die "configuration error"; }
+    if ($catdir eq $psastro_db) {
+	$catdir = "NONE";
+    }
+    if ($verbose) {
+	print "PSASTRO_DB: $psastro_db = $catdir\n";
+    } else {
+	print "$catdir\n";
+    }
+}
+
+exit 0;
+
+sub fixpath {
+    my $path = shift;
+    my $valid = 0;
+    $valid |= ($path =~ m|^file://|);
+    $valid |= ($path =~ m|^path://|);
+    $valid |= ($path =~ m|^neb://|);
+    $valid |= ($path =~ m|^/|);
+
+    if (!$valid) {
+	$path = File::Spec->rel2abs( $path );
+    }
+    return $path;
+}
+
