To all:

I did some more work on the bash script file:

You will need to determine your build directory and root directory for this script and NOT use the values herein.

The input from the command line is %bash make-GOES-fulldisk-vid.sh parm1 parm2

If you don't enter parm1 or parm2 the default is GOES16 for 576 frames (2 days)

If you enter parm1 (which is the satellite) it can be 16, or 18, or 19 (when it becomes fully released by NASA)

If you enter some other value for parm1, it assumes GOES16 and frame count = parm1

If you enter in parm1 and parm2, this specifies the satellite and frame count

If you enter in parm1 = satellite and parm2 = all, then ALL possible jpgs are yanked from the NASA website = 2869 in all

Please be aware that the all option will take over 2 hours to run.

The program is smart enough to grab all possible jpgs, when selecting a large number of frames, since new frames arrive after the start of the program. I found 3 passes are sufficient.

I found that the 5424x5424 pixels size and 10848x10848 pixels size for the jpegs are too big to assemble into a full video and keep it a reasonable size.

The standard frame default is 1808x1808 pixels for the fulldisk videos.

You will need "identify", "wget" and "ffmpeg" commands installed and operational on your linux system as prerequisites, the other commands are usually standard on any linux.

Having said all these caveats, here is the bash script file

--------------- make-GOES-fulldisk-vid.sh -------------------------

tag=`date +"%Y-%m-%d %H:%M:%S.%N" | md5sum | cut -c1-32`
maxframes=2869

strt=`date +"%s"`

root="/home/owner/Desktop"
bld=$root/tmp
echo "Build Directory: $bld"

pre=$1

if [ -z $pre ] ; then
  goes=16
  frames=576
fi

if [ -n "$pre" ] ; then

  if [ "$pre" = "all" ] ; then
    goes=16
    frames=$maxframes
    pre=16
  fi

  goes=`echo $pre | tr -d "[a-z][A-Z]"`

  if [ $goes = "16" ] ; then
    if [ -z $frames ] ; then
      frames=$2
    fi
    if [ -z $frames ] ; then
      echo "Default: Setting frames = 576 or 48 hr or 2 days"
      frames=576
    fi
  fi

  if [ $goes = "18" ] ; then
    if [ -z $frames ] ; then
      frames=$2
    fi
    if [ -z $frames ] ; then
      echo "Default: Setting frames = 576 or 48 hr or 2 days"
      frames=576
    fi
  fi

  if [ $goes = "19" ] ; then
    if [ -z $frames ] ; then
      frames=$2
    fi
    if [ -z $frames ] ; then
      echo "Default: Setting frames = 576 or 48 hr or 2 days"
      frames=576
    fi
  fi

  if [ $goes != "16" ] ; then
    if [ $goes != "18" ] ; then
      if [ $goes != "19" ] ; then
         frames=$goes
         goes=16
      fi
    fi
  fi

  if [ $frames = "all" ] ; then
    frames=$maxframes
  fi

  if [ $frames -gt $maxframes ] ; then
    frames=$maxframes
  fi

fi

echo "GOES satellite = GOES$goes frames:$frames"

elap=`expr $frames \* 300`
days=`expr $elap / 86400`
k=`expr $days \* 86400`
elap=`expr $elap - $k`
str=`date -d@$elap -u +%H:%M:%S | sed "s/^/$days days /" | sed "s/:/ hrs /" | sed "s/:/ mins /" | sed "s/$/ secs/" | sed "s/^/Elapsed Time: /"`
echo "Selected $frames frames to display or $str"

if [ ! -d $bld ] ; then
  mkdir $bld
fi

## Cleanup temporary processing folder
cd $bld
ls * 2>/dev/null | sed "s/^/rm /" > tmp000.$tag 2>/dev/null
bash tmp000.$tag 2>/dev/null

## get the index.html.tmp file list
wget -A jpg https://cdn.star.nesdis.noaa.gov/GOES$goes/GLM/FD/EXTENT3/
fld="https://cdn.star.nesdis.noaa.gov/GOES$goes/GLM/FD/EXTENT3/";
sleep 2
if [ ! -e index.html.tmp ] ; then
  echo "index.html.tmp file does NOT exit, cannot continue!"
  exit
fi

## sizes are 1808, 5424 and 10848

pix=1808
iv=0
echo "Grabbing $pix x $pix jpgs"
sleep 2
wget -A jpg $fld
mv index.html.tmp index.html.tmp.$iv
cat index.html.tmp.$iv | grep $pix | cut -f2 -d"\"" | grep -v ^$pix | grep $pix > tmp000.$tag cat tmp000.$tag | tail -$frames | sed "s/^/wget -A jpg https:\/\/cdn.star.nesdis.noaa.gov\/GOES$goes\/GLM\/FD\/EXTENT3\//" > tmp001.$tag
bash tmp001.$tag
szz=`cat tmp001.$tag | wc -l`
echo "Grabbed $szz jpgs"

echo "checking for new jpgs"
wget -A jpg $fld
iv=`expr $iv + 1`
mv index.html.tmp index.html.tmp.$iv
cat index.html.tmp.$iv | grep $pix | cut -f2 -d"\"" | grep -v ^$pix | grep $pix > tmp002.$tag
cat tmp000.$tag tmp002.$tag | sort -u > tmp001.$tag
cat tmp000.$tag tmp001.$tag | sort | uniq -c | grep -v "   2 " | sed "s/      1 //" > tmp002.$tag

## update tmp.000 index
cat tmp000.$tag tmp002.$tag > tmp001.$tag
mv tmp001.$tag tmp000.$tag

cat tmp002.$tag | sed "s/^/wget -A jpg https:\/\/cdn.star.nesdis.noaa.gov\/GOES$goes\/GLM\/FD\/EXTENT3\//" > tmp001.$tag
bash tmp001.$tag
szz=`cat tmp001.$tag | wc -l`
echo "Grabbed $szz new jpgs"

echo "checking for newer jpgs"
wget -A jpg $fld
iv=`expr $iv + 1`
mv index.html.tmp index.html.tmp.$iv
cat index.html.tmp.$iv | grep $pix | cut -f2 -d"\"" | grep -v ^$pix | grep $pix > tmp002.$tag
cat tmp000.$tag tmp002.$tag | sort -u > tmp001.$tag
cat tmp000.$tag tmp001.$tag | sort | uniq -c | grep -v "   2 " | sed "s/      1 //" > tmp002.$tag

## update tmp.000 index
cat tmp000.$tag tmp002.$tag > tmp001.$tag
mv tmp001.$tag tmp000.$tag

cat tmp002.$tag | sed "s/^/wget -A jpg https:\/\/cdn.star.nesdis.noaa.gov\/GOES$goes\/GLM\/FD\/EXTENT3\//" > tmp001.$tag
bash tmp001.$tag
szz=`cat tmp001.$tag | wc -l`
echo "Grabbed $szz newer jpgs"
rm tmp001.$tag

## create mp4 file
ls *.jpg > tmp002.$tag
szz=`cat tmp002.$tag | wc -l`
nsz=`ls *jpg | wc -l`
echo "Found: $nsz jpgs"
fl=`ls *jpg | head -1`
lbl=`identify $fl | cut -c1-33 | sed "s/$/\.mp4/" `
sz=`cat tmp002.$tag | wc -l`
sz=`expr $sz + 10000`
seq 10001 $sz | sed "s/$/\.jpg/" | sed "s/^1//" > tmp003.$tag
paste tmp002.$tag tmp003.$tag | sed "s/^/mv /" | tr "\t" " " > tmp004.$tag
bash tmp004.$tag

ffmpeg -framerate 10 -i %4d.jpg -c:v libx264 -r 5 $lbl > /dev/null 2>/dev/null
cat tmp002.$tag | sed "s/^/rm /" > tmp005.$tag
bash tmp005.$tag 2>/dev/null

## cleanup and post stats and mp4 file name and processing time
frames=`ls *jpg | wc -l`
elap=`expr $frames \* 300`
days=`expr $elap / 86400`
k=`expr $days \* 86400`
elap=`expr $elap - $k`
str=`date -d@$elap -u +%H:%M:%S | sed "s/^/$days days /" | sed "s/:/ hrs /" | sed "s/:/ mins /" | sed "s/$/ secs/" | sed "s/^/Elapsed Time: /"`
echo "Actual $frames frames built for $str"
rm *.jpg
rm index.html.tmp*
rm tmp*.$tag
echo "Final video: $lbl"
stp=`date +"%s"`
elap=`echo "$stp - $strt" | gp -q`
date -d@$elap -u +%H:%M:%S | tr ":" "z" | sed "s/^/hr:/" | sed "s/z/ min:/" | sed "s/z/ secs:/" | sed "s/^/Processing time: /"
mv $bld/*mp4 $root
nm=`ls $root/*mp4`
echo "Video: $lbl"
exit
-------------- end bash script ----------------


Reply via email to