#! /bin/csh # Batch file "undoit2.bat" # - Cannibalized from NADCON5 for use by VERTCON3 # # - Deletes all files created from "doit2.bat" # # Takes in 4 arguments: # Argument 1 = lower case, old datum name (character*10) # Argument 2 = lower case, new datum name (character*10) # Argument 3 = lower case, region (character*10) # Argument 4 = number, filter (integer ) # Special note for the filter: This batch file expects a number # from 0 through 999 for the filter. Numbers below 0 or above # 1000 will cause it to fail. Furthermore, this batch file # will pad leading zeros onto the number, so that files # with the filter in its name will always have 3 digits # for that filter. That is, a filter of "1" becomes "001" # in all subsequent file names, "99" becomes "099", etc. # Do NOT pad the filter number yourself! # # Example of how to execute this batch file: # %undoit2.bat ngvd29 navd88 conus 0 # The only allowable combinations are: # The only allowable combinations are: # For CONUS: # ngvd29 navd 88 conus # # For ALASKA: # ngvd29 navd 88 alaska # # For HAWAII: # No combinations exist # For PR: # lt prvd02 pr # # For VI: # lt vivd09 vi # # For GUAM: # lt guvd63 guam # # guvd63 guvd04 guam # # For CNMI: # lt nmvd03 cnmi # # For AS: # lt asvd02 as # date echo 'undoit2.bat -- BEGIN' echo 'undoit2.bat: Number of Arguments Received = '$#argv echo 'undoit2.bat: Old Datum = '$argv[1] echo 'undoit2.bat: New Datum = '$argv[2] echo 'undoit2.bat: Region = '$argv[3] echo 'undoit.bat: Filter = '$argv[4] # Below is the "pad with leading zeros" code for the filter: set var0 = "0" set var00 = "00" if ($argv[4] < 0) then echo $argv[4] 'is negative. Fail!' exit else if ($argv[4] < 10) then set argv[4] = "$var00$argv[4]" # echo "$argv[4]" else if ($argv[4] < 100) then set argv[4] = "$var0$argv[4]" # echo "$argv[4]" else if ($argv[4] < 1000) then set argv[4] = "$argv[4]" # echo "$argv[4]" else if ($argv[4] > 999) then echo $argv[4] 'is over 999. Fail!' exit endif # -------------------------------------- # - DELETE the first GMT batch file # -------------------------------------- echo 'undoit2.bat: Removing first GMT batch file' rm -f gmtbat01.$argv[1].$argv[2].$argv[3].$argv[4].* # -------------------------------------- # - DELETE the coverage and vector files # -------------------------------------- echo 'undoit2.bat: Removing coverage files' rm -f cvacdoht.$argv[1].$argv[2].$argv[3].$argv[4] echo 'undoit2.bat: Removing vector files, meters' rm -f vmacdoht.$argv[1].$argv[2].$argv[3].$argv[4] rm -f vmav2oht.$argv[1].$argv[2].$argv[3].$argv[4] rm -f vmarzoht.$argv[1].$argv[2].$argv[3].$argv[4] # -------------------------------------- # - DELETE the Coverage and Vectors plots # - The "*" below allows for multiple # - plots (nplots>1) in any of the # - "bound(region).f" subroutines. # -------------------------------------- echo 'undoit2.bat: Removing Coverage JPGs' rm -f cvacdoht.$argv[1].$argv[2].$argv[3].$argv[4].*.jpg echo 'undoit2.bat: Removing Vector JPGs, meters' rm -f vmacdoht.$argv[1].$argv[2].$argv[3].$argv[4].*.jpg rm -f vmav2oht.$argv[1].$argv[2].$argv[3].$argv[4].*.jpg rm -f vmarzoht.$argv[1].$argv[2].$argv[3].$argv[4].*.jpg # # -------------------------------------- # echo 'undoit2.bat -- END' date