Summary description for UnitTestGamma. More...
Public Member Functions | |
| void | GravityEarthLoadModelFile () |
| Tests the coefficient loader for the earths gravity model. | |
| void | GravityEarthLoadGridFile () |
| Tests the grid loader for the earths gravity model. | |
| void | GravityEarthCalculateGrid () |
| Tests the grid-based interpolation estimator for the earths gravity. | |
| void | GravityEarthCalculateModelA () |
| Tests the model calculator for the earths gravity. (uses eigen5c.gcf). | |
| void | GravityEarthCalculateModelB () |
| Tests the model calculator for the earths gravity. (uses ggm03s.gcf order 120, compares to egm2008). | |
Properties | |
| TestContext | TestContext [get, set] |
| Gets or sets the test context which provides information about and functionality for the current test run. /summary>. | |
Summary description for UnitTestGamma.
Definition at line 13 of file UnitTestGravityEarth.cs.
| void Tests.UnitTestGravityEarth.GravityEarthCalculateGrid | ( | ) |
Tests the grid-based interpolation estimator for the earths gravity.
Definition at line 68 of file UnitTestGravityEarth.cs.
00069 { 00070 GravityEarthGfcGrid gravityEarth = new GravityEarthGfcGrid(); 00071 gravityEarth.LoadGravityMap(@"eigen5c.gdf"); 00072 00073 // Reference: 00074 // ICGEM calculation service 00075 // model: functional: gravity 00076 string[] testdata = { 00077 00078 // model: eigen5c (expect minimal difference) 00079 "126.0000 37.0000 979914.448336", 00080 "126.2500 37.0000 979922.352799", 00081 "126.5000 37.0000 979924.633472", 00082 "126.7500 37.0000 979922.081383", 00083 "127.0000 37.0000 979916.785445", 00084 "126.0000 36.7500 979882.959664", 00085 "126.2500 36.7500 979888.765359", 00086 "126.5000 36.7500 979897.746912", 00087 "126.7500 36.7500 979895.879925", 00088 "127.0000 36.7500 979883.720262", 00089 "126.0000 36.5000 979863.306337", 00090 "126.2500 36.5000 979876.866452", 00091 "126.5000 36.5000 979877.498516", 00092 "126.7500 36.5000 979853.527464", 00093 "127.0000 36.5000 979841.388265", 00094 "126.0000 36.2500 979849.782964", 00095 "126.2500 36.2500 979862.262440", 00096 "126.5000 36.2500 979867.176353", 00097 "126.7500 36.2500 979823.843720", 00098 "127.0000 36.2500 979841.700404", 00099 "126.0000 36.0000 979834.101367", 00100 "126.2500 36.0000 979840.798833", 00101 "126.5000 36.0000 979842.036805", 00102 "126.7500 36.0000 979833.011654", 00103 "127.0000 36.0000 979829.875387", 00104 00105 // model: egm2008 (expect some difference) 00106 "46.0000 47.0000 980784.237968", 00107 "46.2500 47.0000 980793.748374", 00108 "46.5000 47.0000 980777.584929", 00109 "46.7500 47.0000 980780.749349", 00110 "47.0000 47.0000 980790.402344", 00111 "46.0000 46.7500 980763.400078", 00112 "46.2500 46.7500 980774.219026", 00113 "46.5000 46.7500 980777.852799", 00114 "46.7500 46.7500 980776.626910", 00115 "47.0000 46.7500 980785.249340", 00116 "46.0000 46.5000 980748.768039", 00117 "46.2500 46.5000 980750.621451", 00118 "46.5000 46.5000 980755.220104", 00119 "46.7500 46.5000 980760.313200", 00120 "47.0000 46.5000 980772.486144", 00121 "46.0000 46.2500 980733.156652", 00122 "46.2500 46.2500 980741.272033", 00123 "46.5000 46.2500 980737.550959", 00124 "46.7500 46.2500 980733.202427", 00125 "47.0000 46.2500 980739.222344", 00126 "46.0000 46.0000 980708.255067", 00127 "46.2500 46.0000 980709.374456", 00128 "46.5000 46.0000 980716.814933", 00129 "46.7500 46.0000 980718.081268", 00130 "47.0000 46.0000 980720.099740" 00131 }; 00132 00133 Scanf scanf = new Scanf(); 00134 object[] t; 00135 for (int i = 0; i < testdata.Length; i++) 00136 { 00137 t = scanf.Scan(testdata[i], "%lf %lf %lf"); 00138 double lon = (double)t[0]; 00139 double lat = (double)t[1]; 00140 double expected = (double)t[2]*1e-5; 00141 double value = gravityEarth.Calculate(lat, lon, 0.0); 00142 double error = Math.Abs(value - expected); 00143 Console.WriteLine( 00144 "gravityEarth.Calculate({0},{1},0.0): expected {2} got {3} error {4}", 00145 lat, 00146 lon, 00147 expected, 00148 value, 00149 error); 00150 Assert.IsTrue(error <= 5e-3); 00151 } 00152 }
| void Tests.UnitTestGravityEarth.GravityEarthCalculateModelA | ( | ) |
Tests the model calculator for the earths gravity. (uses eigen5c.gcf).
Definition at line 159 of file UnitTestGravityEarth.cs.
00160 { 00161 Console.WriteLine("Model: eigen5c.gfc"); 00162 00163 GravityEarthGfcModel gravityEarth = new GravityEarthGfcModel(); 00164 gravityEarth.LoadGfcModel(@"eigen5c.gfc"); 00165 00166 // Use full order 00167 gravityEarth.CalcOrder = gravityEarth.ModelOrder; 00168 00169 // Reference: 00170 // ICGEM calculation service 00171 // model: functional: gravity 00172 string[] testdata = { 00173 00174 // model: eigen5c 00175 "126.0000 37.0000 979914.448336", 00176 "126.2500 37.0000 979922.352799", 00177 "126.5000 37.0000 979924.633472", 00178 "126.7500 37.0000 979922.081383", 00179 "127.0000 37.0000 979916.785445", 00180 "126.0000 36.7500 979882.959664", 00181 "126.2500 36.7500 979888.765359", 00182 "126.5000 36.7500 979897.746912", 00183 "126.7500 36.7500 979895.879925", 00184 "127.0000 36.7500 979883.720262", 00185 "126.0000 36.5000 979863.306337", 00186 "126.2500 36.5000 979876.866452", 00187 "126.5000 36.5000 979877.498516", 00188 "126.7500 36.5000 979853.527464", 00189 "127.0000 36.5000 979841.388265", 00190 "126.0000 36.2500 979849.782964", 00191 "126.2500 36.2500 979862.262440", 00192 "126.5000 36.2500 979867.176353", 00193 "126.7500 36.2500 979823.843720", 00194 "127.0000 36.2500 979841.700404", 00195 "126.0000 36.0000 979834.101367", 00196 "126.2500 36.0000 979840.798833", 00197 "126.5000 36.0000 979842.036805", 00198 "126.7500 36.0000 979833.011654", 00199 "127.0000 36.0000 979829.875387" 00200 }; 00201 00202 Scanf scanf = new Scanf(); 00203 object[] t; 00204 for (int i = 0; i < testdata.Length; i++) 00205 { 00206 t = scanf.Scan(testdata[i], "%lf %lf %lf"); 00207 double lon = (double)t[0]; 00208 double lat = (double)t[1]; 00209 double expected = (double)t[2] * 1e-5; 00210 double value = gravityEarth.Calculate(lat, lon, 0.0); 00211 double error = Math.Abs(value - expected); 00212 Console.WriteLine( 00213 "gravityEarth.Calculate({0},{1},0.0): expected {2} got {3} error {4}", 00214 lat, 00215 lon, 00216 expected, 00217 value, 00218 error); 00219 // Model calc does not work yet 00220 // Assert.IsTrue(error <= 5e-3); 00221 } 00222 }
| void Tests.UnitTestGravityEarth.GravityEarthCalculateModelB | ( | ) |
Tests the model calculator for the earths gravity. (uses ggm03s.gcf order 120, compares to egm2008).
Definition at line 229 of file UnitTestGravityEarth.cs.
00230 { 00231 Console.WriteLine("Model: ggm03s.gfc"); 00232 00233 GravityEarthGfcModel gravityEarth = new GravityEarthGfcModel(); 00234 gravityEarth.LoadGfcModel(@"ggm03s.gfc"); 00235 00236 // Need to limit order for stability 00237 // Reference: model text, F. Barthelmes private comm. 00238 gravityEarth.CalcOrder = 120; 00239 00240 // Reference: 00241 // ICGEM calculation service 00242 // model: functional: gravity 00243 string[] testdata = { 00244 00245 // model: egm2008 00246 "46.0000 47.0000 980784.237968", 00247 "46.2500 47.0000 980793.748374", 00248 "46.5000 47.0000 980777.584929", 00249 "46.7500 47.0000 980780.749349", 00250 "47.0000 47.0000 980790.402344", 00251 "46.0000 46.7500 980763.400078", 00252 "46.2500 46.7500 980774.219026", 00253 "46.5000 46.7500 980777.852799", 00254 "46.7500 46.7500 980776.626910", 00255 "47.0000 46.7500 980785.249340", 00256 "46.0000 46.5000 980748.768039", 00257 "46.2500 46.5000 980750.621451", 00258 "46.5000 46.5000 980755.220104", 00259 "46.7500 46.5000 980760.313200", 00260 "47.0000 46.5000 980772.486144", 00261 "46.0000 46.2500 980733.156652", 00262 "46.2500 46.2500 980741.272033", 00263 "46.5000 46.2500 980737.550959", 00264 "46.7500 46.2500 980733.202427", 00265 "47.0000 46.2500 980739.222344", 00266 "46.0000 46.0000 980708.255067", 00267 "46.2500 46.0000 980709.374456", 00268 "46.5000 46.0000 980716.814933", 00269 "46.7500 46.0000 980718.081268", 00270 "47.0000 46.0000 980720.099740" 00271 }; 00272 00273 Scanf scanf = new Scanf(); 00274 object[] t; 00275 for (int i = 0; i < testdata.Length; i++) 00276 { 00277 t = scanf.Scan(testdata[i], "%lf %lf %lf"); 00278 double lon = (double)t[0]; 00279 double lat = (double)t[1]; 00280 double expected = (double)t[2] * 1e-5; 00281 double value = gravityEarth.Calculate(lat, lon, 0.0); 00282 double error = Math.Abs(value - expected); 00283 Console.WriteLine( 00284 "gravityEarth.Calculate({0},{1},0.0): expected {2} got {3} error {4}", 00285 lat, 00286 lon, 00287 expected, 00288 value, 00289 error); 00290 // Model calc does not work yet. 00291 // Assert.IsTrue(error <= 5e-3); 00292 } 00293 }
| void Tests.UnitTestGravityEarth.GravityEarthLoadGridFile | ( | ) |
Tests the grid loader for the earths gravity model.
Definition at line 57 of file UnitTestGravityEarth.cs.
| void Tests.UnitTestGravityEarth.GravityEarthLoadModelFile | ( | ) |
Tests the coefficient loader for the earths gravity model.
Definition at line 41 of file UnitTestGravityEarth.cs.
00042 { 00043 GravityEarthGfcModel gravityEarth = new GravityEarthGfcModel(); 00044 gravityEarth.LoadGfcModel(@"ggm03s.gfc"); 00045 Assert.AreEqual(gravityEarth.ModelOrder, 180); 00046 Assert.AreEqual(gravityEarth.CalcOrder, 180); 00047 00048 gravityEarth.LoadGfcModel(@"eigen5c.gfc"); 00049 Assert.AreEqual(gravityEarth.ModelOrder, 360); 00050 Assert.AreEqual(gravityEarth.CalcOrder, 360); 00051 }
1.6.2