ISIS to Phase

# 4 Aug 2017 - Eric E. Palmer
# Script to do many of the steps required for building a photometric cube
# Requires a lot of directory setup.
#       Calibrated images in working/NEW_IMAGES
#  EDR images in img-<last4)[LR]
# Modified by JRW Oct 6 2017
# Modified by JRW Aug 28 2019

# Usage
#                gen.sh <calibratedIMG> <last4[LR]>
file=$1
out=$2

if [ '$file' == '' ]
then
        echo "Usage $0 <calibratedIMG> <last4L>"
fi

if [ '$out' == '' ]
then
        echo "Usage $0 <calibratedIMG> <last4L>"
fi

echo "File: $file"
echo "Outfile: $out"

if [ 'two' == 'two' ]
then
#       lronac2isis FROM=$file.IMG TO=$file.cub
#       spiceinit FROM=$file.cub shape=ellipsoid
#       caminfo FROM=$file.cub TO=info.txt

        # Generate phase data
        phocube FROM=$file.cub TO=phoP-$out.cub EMISSION=false I=false PHASE=true LAT=false LON=false
        isis2pds FROM=phoP-$out.cub to=phoP-$out.img BITTYPE=u16bit STRETCH=linear MINPER=0 MAXPER=100

        # Clean up
#        rm $file.cub
        rm phoP-$out.cub
fi

calFile=`echo $file | tr E C`
echo "calFile: $calFile"

# Create an image that is really the image's phase
#ln -s ../working/NEW_IMAGES orig
#../bin/mergePhase $calFile emiss.img
#mv M*C.IMG orig


# Get the directory ready for dumpMapLRO.f
#ln -s ../working/MAPFILES .

# 5 Aug 2018 - John Weirich
# Wrapper for ISISp.sh to run multiple files
# Usage
#       sh wrapperISISe.sh <imageList>
# Modified to work for ISISp.sh 21 Sep 2018
# Modified Nov 20 2018 to include last 5 digits.

file=$1
list=`cat $file`


for i in $list
do

# need to determine the last five characters since
# that is how the directories are set up
  strLength=`echo $i | wc | cut -c23-24`
  if [ "$strLength" != "13" ]
  then
    if [ "$strLength" != "14" ]
    then
      echo "string length not supported"
      exit
    fi
  fi

  if [ "$strLength" == "13" ]
  then
    lastFive=`echo $i | cut -c6-11`
  fi
  if [ "$strLength" == "14" ]
  then
    lastFive=`echo $i | cut -c7-12` 
  fi

# with last five character, can now get into folder

  cd img-$lastFive  
  ../ISISp.sh $i $lastFive
  cd ..

done

# 20 Nov 2018 - John Weirich
# Wrapper for t.mergePhase to run multiple files
# Usage
#       sh wrapperMergePhase.sh <imageList>

file=$1
list=`cat $file`

cd /Users/JW/LDAP16/IMG_RG2

for i in $list
do

# need to determine the last five characters since
# that is how the directories are set up
  strLength=`echo $i | wc | cut -c23-24`
  if [ "$strLength" != "13" ]
  then
    if [ "$strLength" != "14" ]
    then
      echo "string length not supported"
      exit
    fi
  fi

  if [ "$strLength" == "13" ]
  then
    lastFive=`echo $i | cut -c6-11`
    echo $lastFive
  fi
  if [ "$strLength" == "14" ]
  then
    lastFive=`echo $i | cut -c7-12` 
    echo $lastFive
  fi

#exit
# with last five character, can now get into folder

echo "$i.IMG" > emmTmp
echo "/Users/JW/LDAP16/CubesReinerGamma2/img-$lastFive/phoP-$lastFive.img" >> emmTmp
~/Dropbox/Ingenii/src/t.mergePhase < emmTmp

\mv -f MP* /Users/JW/LDAP16/CubesReinerGamma2/working/NEW_IMAGES/

done

rm emmTmp

ISIStoPhase (last edited 2019-08-07 10:43:55 by JohnWeirich)