#! /bin/csh # Batch file "doit3.bat" # - Cannibalized from NADCON5 for use in VERTCON3 # 2018 05 08 # - Upped this to 7 arguments, where we need two arguments to # describe the thinning/gridding of RZ (for 29/88/conus) and a # separate one to describe the gridding of CD to restore to. # These two values MUST be IDENTICAL for all other od/nd/rg combos # - Third of many which are used to process, # - analyze, and ultimately create, all of # - the files for NADCON v5.0 # - Requires that "doit2.bat" has been run. # - What this batch file does: # 1) Reads the coverage and vectors files capable of GMT plotting # 2) Thins the data using a block-median filter # 3) Creates new coverage/vector files for the thinned data # 4) Creates new coverage/vector files for the dropped data # 5) Creates a GMT batch file (gmtbat02) to grid everything # 6) Runs gmtbat02 to rids the thinned data using tensions 0.0, 0.4 and 1.0, # and creates a "d3" grid representing the tension-based error # 7) Creates a GMT batch file (gmtbat03) to plot files mentioned in #3 and #4 and #6 # 8) Runs gmtbat03 to create JPGs of coverage, vectors and color plots of grids # # Takes in 7 arguments: # Argument 1 = lower case, old datum name # Argument 2 = lower case, new datum name # Argument 3 = lower case, region # Argument 4 = filter on which heights to allow # Argument 5 = thinning/grid spacing, arcseconds (integer - show 5 digits) of RZ data # Argument 6 = thinning/grid spacing, arcseconds (integer - show 5 digits) of CD data # Argument 7 = map resolution flag (integer, 0, 1 or 2) # # Note, for all od/nd/rg combos BESIDES 29/88/conus, arguments 5 and 6 MUST be identical # # 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: # %doit3.bat ngvd29 navd88 conus 0 900 0 # # Any integer arcseconds are allowed, provided # they lie between 00001 and 99999 # # The map resolution flag (argument 7) can be 0, 1 or 2. It is set to # "0" in the examples below, but any of these combinations # would be valid if the "0" were replaced with a "1" or a "2" # Note also that a map resolution flag of "2" is treated as # a "1" for all regions except "conus". # The map resolution flags are: # 0 = 1 map for the whole region # 1 = Map 0 plus zoomed in maps for specific sub-regions # 2 = Map 0 and Maps 1 PLUS hyper-zoomed maps # (one for each state, in CONUS only, otherwise treated as a "1") # # The only allowable combinations of old datum/new datum/region are: # For CONUS: # ngvd29 navd88 conus # For ALASKA: # ngvd29 navd88 alaska # For HAWAII: # None exist yet # 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 'doit3.bat -- BEGIN' echo 'doit3.bat: Number of Arguments Received = '$#argv echo 'doit3.bat: Old Datum = '$argv[1] echo 'doit3.bat: New Datum = '$argv[2] echo 'doit3.bat: Region = '$argv[3] echo 'doit3.bat: Filter = '$argv[4] echo 'doit3.bat: Grid Spacing, RZ, arcseconds = '$argv[5] echo 'doit3.bat: Grid Spacing, CD, arcseconds = '$argv[6] echo 'doit3.bat: Map Resolution Flag = '$argv[7] # 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 # Below is the "Grid spacings must be IDENTICAL" for non 29/88/conus runs code: if ($argv[1] != "ngvd29" && $argv[2] != "navd88" && $argv[3] != "conus") then if ($argv[5] != $argv[6]) then echo doit3.bat FAIL 001 exit endif endif # -------------------------------------- # - RUN "mymedian5.f" # - Thins the coverage and vector data using a # - block median filter on a certain grid size # - # - Note that this FORTRAN program # - creates both the GMT-ready data # - files to show both coverage and # - vectors of thinned and dropped data # - as well as the actual # - GMT-based batch files which will # - use those files and create plots. # -------------------------------------- echo 'doit3.bat -- Running mymedian5 (thinning vectors and creating gmtbat02)' mymedian5 << ! $argv[1] $argv[2] $argv[3] $argv[4] $argv[5] $argv[6] ! # # ------------------------------------- # - RUN gmtbat02.(olddtm).(newdtm).(region).(gridspacing) # - Note, this batch file was created # - during the running of "mymedian5.f" # - above. Note also, no dependence upon "mapflag" # # - New part of this batch file, as of # - 2015/10/27; # - Subtract the T=0.0 transformation grid # - from the T=1.0 transformation grid. # - Then take the absolute value of that # - difference, and finally scale that # - grid by 1/1.6929. Do this for # - all 5 possible transformation grids # ------------------------------------- echo 'doit3.bat -- Running the GMT batch file to grid thinned vectors' chmod 777 gmtbat02.$argv[1].$argv[2].$argv[3].$argv[4].$argv[5].$argv[6] ./gmtbat02.$argv[1].$argv[2].$argv[3].$argv[4].$argv[5].$argv[6] # ------------------------------------- # - RUN "makeplotfiles02.f" # - This program will create a 3rd GMT batch # - file which will do the following: # - 1)Color Plots of the dlat/dlon/deht grids # - 2)B/W plots of thinned vectors that went into the grid # - 3)B/W plots of dropped vectors that did not go into the grid # - 4)B/W plots of thinned coverage of points that went into the grid # - 5)B/W plots of dropped coverage of points that did not go into the grid # ------------------------------------- echo 'doit3.bat -- Running makeplotfiles02 (creating gmtbat03)' makeplotfiles02 << ! $argv[1] $argv[2] $argv[3] $argv[4] $argv[5] $argv[6] $argv[7] ! # ------------------------------------- # - RUN gmtbat03.(olddtm).(newdtm).(region).(gridspacing).(mapflag) # - Note, this batch file was created # - during the running of "makeplotfiles02.f" # - above. It depends upon "mapflag" as its GMT calls # - actual make our maps. # ------------------------------------- echo 'doit3.bat -- Running the GMT batch file to plot things' chmod 777 gmtbat03.$argv[1].$argv[2].$argv[3].$argv[4].$argv[5].$argv[6].$argv[7] ./gmtbat03.$argv[1].$argv[2].$argv[3].$argv[4].$argv[5].$argv[6].$argv[7] echo 'doit3.bat -- END' date