Programs which perform the generation of GMT batch scripts and the creation of output files using NADCON5 Core Library and helpers. More...

## Directories

directory src
Folder containing the NADCON5 Build Programs and subfolders Code/Subs and Code/BinSource.

## Programs, Functions, and Subroutines

program checkgrid
Part of the NADCON5 build process, generates gmtbat04 More...

program makeplotfiles01
Part of the NADCON5 process, generates gmtbat01. More...

program makeplotfiles02
Part of the NADCON5 process, generates gmtbat03 More...

program makeplotfiles03
Part of the NADCON5 process, generates gmtbat06 More...

program makework
Program to create a work file which will serve as the primary information needed to analyze and create NADCON v5.0 grids. More...

program mymedian5
Program to filter Map Data for GMT Plotting. More...

program myrms
Part of the NADCON5 build process, generates gmtbat05 More...

## Detailed Description

Programs which perform the generation of GMT batch scripts and the creation of output files using NADCON5 Core Library and helpers.

The elements described here are the "doers", programs that construct the output using elements of NADCON5 Core Library

## Function Documentation

 program checkgrid ( )

Part of the NADCON5 build process, generates gmtbat04

Creates a batch file called

  gmtbat04.(olddtm).(newdtm).(region).(igridsec)


This Program:

1) Compare grids of dlat, dlon and deht to vectors of dlat, dlon and deht. 2) Spit out interpolated (from grid) vectors 3) Spit out differential (interpolated minus original) vectors. 4) Create a GMT batch file to plot said vectors.

The input vectors:

Represent *all* (outlier removed)
vectors of dlat/dlon/deht for the
olddatum/newdatum/region combination


However, for the sake of understanding, the vectors will be read in from their "thinned" and "dropped" files, so that we can generate statistics of:

thinned-versus-gridded dropped-versus-gridded all-versus-gridded

This is important, since ONLY the thinned vectors went into the grid and it seems that their statistics should be better against the grid than the dropped vectors. Additionally, one might argue that the only independent check on the grid is the dropped agreement. We'll see.

The input grids:

dlat/dlon/deht grids based on thinning
all of the vectors (see above) using
a median thinning at some block spacing
in arcseconds, and gridding to that same
block spacing.


### Program arguments

Arguments are newline terminated and read from standard input

They are enumerated here

Parameters
 oldtm Source Datum newdtm Target Datum,region region Conversion Region agridsec Grid Spacing in arcsec

Example:

olddatum = 'ussd'
region = 'conus'
agridsec = '900'


## Changelog

### 2016 08 26:

Changed "getmapbounds" to bring in a better way of computing the reference vector location and added a new variable for its label

Also changing the call to "getmapbounds" to give it "olddatum" and "newdatum" to aide in filtering out things like the Saint regions in Alaska for unsupported transformations.

### 2016 07 29:

Scrapped personal placement of vectors and just let them sit outside/below the map

### 2016 07 21:

Added code to allow for optional placement of reference vectors, coming from "map.parameters" as read in subroutine "getmapbounds"

### 2015 10 08:

Added HOR output in M and S for Lat/Lon to both "gi" and "dd" vector output.

Combined: v(m/s)(a/t/d)(gi/dd)lat... v(m/s)(a/t/d)(gi/dd)lon... into : v(m/s)(a/t/d)(gi/dd)hor...

### 2015 9 10:

Initial Release For use in creating NADCON5 Built by Dru Smith

Definition at line 100 of file checkgrid.f.

References bicubic(), bilin(), biquad(), bwplotvc(), getgridbounds(), getmapbounds(), nlines(), and onzd2().

Here is the call graph for this function:

 program makeplotfiles01 ( )

Part of the NADCON5 process, generates gmtbat01.

Program to take a "work" file and create a variety of GMT-ready data files of the following

1. Coverage in latitude
2. Coverage in longitude
3. Coverage in ellipsoid height
4. Vectors in latitude
5. Vectors in longitude
6. Vectors in ellipdoid height
7. Vectors in horizontal (properly azimuthed)

It furthermore will create batch file to run the GMT scripts:

 gmtbat01.(olddtm).(newdtm).(region).(mapflag)


### Program arguments

Arguments are newline terminated and read from standard input

They are enumerated here

Parameters
 oldtm Source Datum newdtm Target Datum,region region Conversion Region mapflag Map Detail Level

Example:

olddatum = 'ussd'
region = 'conus'
mapflag = 0


## Changelog

### 2016 08 26

Added new code to do reference vectors consistently See DRU-12, p. 56-57 Also changing the call to "getmapbounds" to give it "olddatum" and "newdatum" to aide in filtering out things like the Saint regions in Alaska for unsupported transformations.

### 2016 07 29:

Scrapped the code for personalized reference vector location. Just put all ref vectors outside/below plot.

### 2016 07 21:

Added code to allow for optional placement of reference vectors, coming from "map.parameters" as read in subroutine "getmapbounds"

Definition at line 58 of file makeplotfiles01.f.

References bwplotcv(), bwplotvc(), getmapbounds(), and onzd2().

Here is the call graph for this function:

 program makeplotfiles02 ( )

Part of the NADCON5 process, generates gmtbat03

Built upon the skeleton of "makeplotem.f" for GEOCON v2.0 But built specifically for NADCON v5.0. So different in file names and expanded plot creation that it was given the new name "makeplotfiles02.f" to align with another NADCON5 program "makeplotfiles01.f"

Creates a batch file called

  gmtbat03.(olddtm).(newdtm).(region).(igridsec)


That batch file will create JPGs of:

1. Color Plots of the dlat/dlon/deht grids at T=0.4
2. Color Plots of the "method noise" grids (the "d3" grids, see DRU-11, p. 150) with thinned coverage overlaid
3. B/W plots of thinned vectors that went into the T=0.4 transformation grid
4. B/W plots of dropped vectors that did not go into the T=0.4 transformation grid
5. B/W plots of thinned coverage of points that went into the T=0.4 transformation grid
6. B/W plots of dropped coverage of points that did not go into the T=0.4 transformation grid

### Program arguments

Arguments are newline terminated and read from standard input

They are enumerated here

Parameters
 oldtm Source Datum newdtm Target Datum,region region Conversion Region agridsec Grid Spacing in arcsec

Example:

olddatum = 'ussd'
region = 'conus'
agridsec = '900'


## Changelog

### 2016 08 26

Added new code to do reference vectors consistently See DRU-12, p. 56-57 Also fixed a typo in reference vector length for vmtcdeht plots Also changing the call to getmapbounds to give it olddatum and newdatum to aide in filtering out things like the Saint regions in Alaska for unsupported transformations.

### 2016 07 29:

Scrapped code about personalized reference vectors. Just put all reference vectors outside/below plot Also moved gridstats and vecstats out into the /Subs directory to be used by other programs (like makeplotfiles03.f)

### 2016 07 28:

Changed code to build the color palette of the d3 grids around the median, and not ave or std. See DRU-12, p. 48

### 2016 07 21:

Added code to allow for optional placement of reference vectors, coming from map.parameters as read in subroutine getmapbounds

### 2016 01 21:

Updated to get the CPT values fixed in d3 grids, so that (cpthi - cptlo) is exactly divisible by cptin at (2 x csm)

### 2015 10 27:

Updated to work with the new naming scheme (see DRU-11, p. 150)

### 2015 10 05:

Updated to work with the new naming scheme (see DRU-11, p. 139)

Definition at line 78 of file makeplotfiles02.f.

References bwplotcv(), bwplotvc(), coplot(), coplotwcv(), cpt(), cpt2(), getmapbounds(), gridstats(), onzd2(), and vecstats().

Here is the call graph for this function:

 program makeplotfiles03 ( )

Part of the NADCON5 process, generates gmtbat06

Creates a batch file called

  gmtbat06.(olddtm).(newdtm).(region).(igridsec).(mapflag)


That batch file will create JPGs of:

1. Color Plots of the rddlat/rddlon/rddeht grids
2. B/W plots of coverage of RMS'd differential vectors that went into the grid
3. B/W plots of RMS'd differential vectors that went into the grid

### Program arguments

Arguments are newline terminated and read from standard input

They are enumerated here

Parameters
 oldtm Source Datum newdtm Target Datum,region region Conversion Region agridsec Grid Spacing in arcsec mapflag Map Generation Level

Example:

olddatum = 'ussd'
region = 'conus'
agridsec = '900'
mapflag = '0'


## Changelog

### 2016 10 19:

FIX for the HARN/FBN transformation. As it stood, the "gridstats" was returning "0.0" as the median of the post-masked "ete" grid (which is true, but unfortunate.) I've changed the call to "gridstats" to send it the "PREMASKED" version of the "ete" grid, so the median won't be zero.

### 2016 08 26

Added new code to do reference vectors consistently See DRU-12, p. 56-57

Fixed an error where "lorvogehtm" was declared real*8 but past 72 column, so defaulting to integer*4 and coming out as "0.000" on plots

Also changing the call to "getmapbounds" to give it "olddatum" and "newdatum" to aide in filtering out things like the Saint regions in Alaska for unsupported transformations.

### 2016 08 02:

Changed the color palette for "09" grids from 2xMedian to 3xMedian

### 2016 07 29:

Dropped code about personalized reference vectors and just let them be below/outside map

### 2016 08 01:

Moved "gridstats" to subroutines Also, completely removed the in-program computations of the color palette, and instead relied on "cpt" and "cpt2" as per "makeplotfiles02"

### 2016 07 21:

Added code to allow for optional placement of reference vectors, coming from map.parameters as read in subroutine getmapbounds

### 2016 01 21:

Updated to fix the CPT for the "09" (data noise) grids so that (cpthi - cptin) is exactly divisible by cptin

### 2015 11 09:

Updated to adopt new naming scheme (yes, again) (See DRU-11, p. 150), as well as creating plots of the total error grid.

### 2015 10 07:

Latest Version which had new naming scheme and dual-computations of arcseconds and meters for lat/lon See DRU-11, pl. 139.

Definition at line 88 of file makeplotfiles03.f.

References bwplotcv(), bwplotvc(), coplot(), cpt2(), getmapbounds(), gridstats(), and onzd2().

Here is the call graph for this function:

 program makework ( )

Program to create a work file which will serve as the primary information needed to analyze and create NADCON v5.0 grids.

This program is based on previous programs that were created by Dru Smith during the GEOCON v2.0 process. It has been modified specifically to be a tool for NADCON v5.0.

Rather than have multiple programs (1, 2, 3, 4 as was the case for GEOCON v2.0), It was decided make ONE working "makework.f" program (this one) and have it feed off of an input file which can be modified.

The input file will reflect all that is necessary to create a work file.

### Program arguments

Arguments are newline terminated and read from standard input

They are enumerated here

Parameters
 oldtm Source Datum newdtm Target Datum,region region Conversion Region

### Program Inputs:

• A control file in directory Control/, the name is generated from input arguments

Known control file names are:

cfname = control.ussd.nad27.conus

• A manual edits file, called workedits in directory Work/

## By way of example...

If the input file controlling the creation of the work file is:

Control/control.ussd.nad27.conus


then the output data file is:

Work/work.ussd.nad27.conus


The work file has the following format:

Cols  Format Description
1-  6   a6    PID
7   1x    - blank -
8-  9   a2    State
10   a1    Reject code for missing latitude pair (blank for good)
11   a1    Reject code for missing longitude pair (blank for good)
12   a1    Reject code for missing ellip ht pair (blank for good)
13   1x    - blank -
14- 27 f14.10  Latitude (Old Datum), decimal degrees (-90 to +90)
28   1x    - blank -
29- 42 f14.10  Lonitude (Old Datum), decimal degrees (0 to 360)
43   1x    - blank -
44- 51   f8.3  Ellipsoid Height (Old datum), meters
52   1x    - blank -
53- 61   f9.5  Delta Lat (New Datum minus Old Datum), arcseconds
62   1x    - blank -
63- 71   f9.5  Delta Lon (New Datum minus Old Datum), arcseconds
72   1x    - blank -
73- 81   f9.3  Delta Ell Ht (New Datum minus Old Datum), meters
82   1x    - blank -
83- 91   f9.3  Delta Horizontal (absolute value), arcseconds
92   1x    - blank -
93-101   f9.5  Azimuth of Delta Horizontal (0-360), degrees
102   1x    - blank -
103-111   f9.3  Delta Lat (New Datum minus Old Datum), meters
112   1x    - blank -
113-121   f9.3  Delta Lon (New Datum minus Old Datum), meters
122   1x    - blank -
123-131   f9.3  Delta Horizontal (absolute value), meters
132   1x    - blank -
133-142   a10   Old Datum Name
143   1x    - blank -
144-153   a10   New Datum Name
format(a6,1x,a2,a1,a1,a1,1x,f14.10,1x,f14.10,1x,f8.3,1x,
*f9.5,1x,f9.5,1x,f9.3,1x,f9.3,1x,f9.5,1x,f9.3,1x,f9.3,1x,f9.3,
1x,a10,1x,a10)


This differs from Dennis's GEOCON v1.0 in that:

• 3 reject codes
• 10 decimal places in latitude (See DRU-10, p. 123)
• 10 decimal places in longitude (See DRU-10, p. 123)
• Lat, Lon and Horizontal in both arcseconds and meters each
• Azimuth of Horizontal
• Identification of which datums are transformed

## References

See:

• DRU-11, p. 124

### GEOCON v2.0:

See:

• DRU-10, p. 143
• DRU-11, p. 10
• DRU-11, p. 26
• DRU-11, p. 56

## Changelog

### 2017 11 19 (NG)

Formated Comments to be compatible with Doxygen Due to deprecation of various arguments for GMT tools, invocation of xyz2grd and grd2xyz have arguments options changed in generated files

• -bos -> -bo3f with equivalent meaning of a 3 column single precision output
• -bis -> -bi3f with equivalent meaning of a 3 column single precision input

### 2016 09 14:

Due to some complications in mymedian5.f which happen if data is in the work file that is not to be sorted and used, I've decided to put the out of grid point removal code here, so that such points will go into the work file but will all get a 111 set of reject codes so they don't go forward in the processing.

### 2016 09 13:

Fixed a bug that sends an incoming 0 reject flag as a zero. All later programs expect a BLANK for a "good" reject code. The incoming 0 is from the workedits file and is fine to come in, but must go OUT as a BLANK.

Also, put in code to correct situations where an entry is in workedits, but the PID for that entry isn't actually in the incoming data. This relies on a new vector EditTracker

### 2016 02 26:

Change (see: DRU-12, p. 18) to reflect the decision that "manual edits" should ONLY edit data OUT and not add data back in.

### 2016 01 07:

Changed to split "Relevant Edits" into three counts: lat, lon and eht

Definition at line 150 of file makework.f.

References getgridbounds().

Here is the call graph for this function:

 program mymedian5 ( )

Program to filter Map Data for GMT Plotting.

1. Run a customized block-median thinning algorithm on coordinate differences (horizontal and ellipsoid height)
2. Save the thinned data to GMT-ready plottable files
3. Save the removed data to GMT-ready plottable files
4. Create a GMT batch file (gmtbat02) to grid the thinned data at T=0.4 (which becomes the final transformation grid) and also at T=1.0 and T=0.0, (whose difference becomes the bases for the "method noise" grid)
5. If, and only if, we are doing the combination of HARN/FBN/CONUS, insert commands into gmtbat02 to apply a mask to the "04.b" grids (See DRU-12, p. 36-37) See DRU-11, p. 127

unlike mymedian.f, this program is set up to filter/process all data at once in one run. Also, significant philosophical changes occurred, including:

1. Median filter on absolute horizontal length, and then, when we have our "kept" points, we use the lat and lon of those kept points to grid lat and lon separately. (mymedian.f actually sorted lat medians and lon medians separately, raising the very real possibility that separate points would go into each grid.)
2. Nothing RANDOM! No coin flipping, etc. It was viewed, for NADCON 5.0, as scientifically improper for the final grids to be reliant upon a filtering mechanism that could be different each time it was run.

### Program arguments

Arguments are newline terminated and read from standard input

They are enumerated here

Parameters
 oldtm Source Datum newdtm Target Datum,region region Conversion Region agridsec Grid Spacing in Arc Seconds

## Changelog

### 2016 09 14

Bug found when running Hawaii with points outside grid – some mixup between "ikt" and "ipid". Changed this program as follows: It now REQUIRES that the incoming data has NO points outside the grid boundary. This has been forced by giving such points a "444" reject code in "makework" when creating the work file. By going through "makeplotfiles01" with a "444" reject, those points won't even make it into the "all" file, which is our input for median filtering here...

### 2016 06 29

Updated to insert masking commands for the "...04.b" (transformation grid) into gmtbat02 when working ONLY in the HARN/FBN/CONUS combination.

### 2015 10 27

For use in creating NADCON5 Built by Dru Smith Built from scratch, scrapping all previous "mymedian" programs used in making GEOCON

Definition at line 71 of file mymedian5.f.

References getgridbounds(), getmedian(), and indexxi().

Here is the call graph for this function:

 program myrms ( )

Part of the NADCON5 build process, generates gmtbat05

Creates a batch file called

  gmtbat05.(olddtm).(newdtm).(region).(igridsec)


Program to

1. Run a customized RMS-computing algorithm on vector differences (gridded minus true)
2. Save the RMS data to GMT-ready plottable files
3. Create a GMT batch file to plot both the thinned data and removed data in both coverage and vectors

Unlike "mymedian5.f", this program is set up to compute the RMS of vector differences in a cell-by-cell basis (aka NOT a median filter at all, but a true RMS representation of of disagreements)

A "value" is the differential vector of:

interpolated-from-grid minus true


For any cell with at least ONE point with a value, the following is done:

1. Compute the average latitude of all points in the cell
2. Compute the average longitude of all points in the cell
3. Compute the RMS of all values in the cell

The output vector will then reflect these three values.

For latitude and ellipsoid height, the azimuth of the vector will ALWAYS be 0.0 (pointing up) while for longitude it will always be 90.0 (pointing right). However, these are mere conventions as they are not directional vectors anyway, but rather quanta which will be gridded and it is the grid which is of utmost importance.

No PIDS will be in the output files, as the output RMS vectors are not reflective of any one point, but rather a cell-wide conglomeration of information.

See DRU-11, p. 130

### Program arguments

Arguments are newline terminated and read from standard input

They are enumerated here

Parameters
 oldtm Source Datum newdtm Target Datum,region region Conversion Region agridsec Grid Spacing in arcsec

Example:

olddatum = 'ussd'
region = 'conus'
agridsec = '900'


## Changelog

### 2016 01 21:

Updated to RETURN to an old way of registering RMS vectors at AVE lat/lon rather than center of cell.

### 2015 10 28

Updated to work with new naming scheme (see DRU-11, p. 150) and to adopt the central lat/lon for the RMS vectors, rather than ave lat/ave lon (see DRU-11, p.145), and to also set up the gridding of RMS vectors at the T=0.9 level (see DRU-11, p. 148)

Also added "donzd" functionality to help control the magnitude of the Length of Reference Vector on Ground variables.

Also, added a section at the end to create the TOTAL error grids. by RMS-combining the "method noise grid" (the "d3" grid) with the "data noise grid" (the "rdd...09" grid) into one single "transformation error grid"

### 2016 08 25:

For reasons that are difficult to describe, "donzd" is now "onzd2.f" in /home/dru/Subs. Change and recompile...

Updated

### 2015 09 16:

Initial Release, For use in creating NADCON5 Built by Dru Smith

Definition at line 101 of file myrms.f.

References getgridbounds(), getrms(), indexxi(), and onzd2().

Here is the call graph for this function: