Changeset 5969
- Timestamp:
- Jan 12, 2006, 10:40:13 AM (20 years ago)
- Location:
- trunk/psLib
- Files:
-
- 4 edited
-
psTableParse.c (modified) (5 diffs)
-
share/pslib/iers_corr.dat (modified) (56 diffs)
-
src/astro/psEarthOrientation.c (modified) (21 diffs)
-
test/astro/tst_psEarthOrientation.c (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/psTableParse.c
r5892 r5969 1 1 /** @file psTableParse.c 2 2 * 3 * @brief Parses input data tables and outputs .datfiles for specified format3 * @brief Parses input data tables (finals2000A.data) and outputs files for specified format 4 4 * 5 5 * @ingroup psTableParse … … 7 7 * @author Dave Robbins, MHPCC 8 8 * 9 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-01- 04 22:59:31$9 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-01-12 20:40:12 $ 11 11 * 12 12 * Copyright 2005 Maui High Performance Computing Center, University of Hawaii … … 19 19 #include <math.h> 20 20 21 static FILE *output = NULL; 22 static FILE *input = NULL; 23 24 static void printHeader(char *filename); 25 21 26 int main(int argc, char *argv[]) 22 27 { … … 26 31 } 27 32 if (!strncmp(argv[1], "-h", 2) ) { 28 printf("\n Usage: psTableParse inputTable.data outputTable.dat columnNumbers.\n");33 printf("\n Usage: psTableParse inputTable.data outputTable.dat <Sections>.\n"); 29 34 printf(" i.e. psTableParse finals.data finals.dat 1 3 4 8\n"); 35 printf("\n Sections:\n 1)MJD Date 2)X (Bull A) 3)Y (Bull A)"); 36 printf("\n 4)X (Bull B) 5)Y (Bull B) 6)dX (Bull A)"); 37 printf("\n 7)dY (Bull A) 8)dX (Bull B) 9)dY (Bull B)"); 38 printf("\n 10)UT1-UTC (Bull A) 11)UT1-UTC (Bull B)\n"); 30 39 return 0; 31 40 } 32 33 FILE *output;34 FILE *input;35 41 input = fopen(argv[1], "r"); 36 42 output = fopen(argv[2], "w"); 37 // char data;38 43 char data2[200]; 44 printHeader(argv[1]); 45 fprintf(output, "# "); 46 for (int i = 3; i < argc; i++) { 47 if(!strncmp(argv[i], "1", 2)) { 48 fprintf(output, "MJD "); 49 } 50 if(!strncmp(argv[i], "2", 2)) { 51 fprintf(output, " X (A) "); 52 } 53 if(!strncmp(argv[i], "3", 2)) { 54 fprintf(output, " Y (A) "); 55 } 56 if(!strncmp(argv[i], "4", 2)) { 57 fprintf(output, " X (B) "); 58 } 59 if(!strncmp(argv[i], "5", 2)) { 60 fprintf(output, " Y (B) "); 61 } 62 if(!strncmp(argv[i], "6", 2)) { 63 fprintf(output, " dX (A) "); 64 } 65 if(!strncmp(argv[i], "7", 2)) { 66 fprintf(output, " dY (A) "); 67 } 68 if(!strncmp(argv[i], "8", 2)) { 69 fprintf(output, " dX (B) "); 70 } 71 if(!strncmp(argv[i], "9", 2)) { 72 fprintf(output, " dY (B) "); 73 } 74 if(!strncmp(argv[i], "10", 2)) { 75 fprintf(output, "UT1-UTC (A) "); 76 } 77 if(!strncmp(argv[i], "11", 2)) { 78 fprintf(output, "UT1-UTC (B) "); 79 } 80 } 81 fprintf(output, "\n#\n#\n"); 39 82 int i; 40 83 while ( fscanf(input, "%188c", data2) != EOF) { 41 for (i = 7; i <= 14; i++) { 42 fprintf(output, "%c", data2[i]); 43 } 44 fprintf(output, " "); 45 for (i = 97; i <= 105; i++) { 46 if (data2[102] == ' ') { 47 fprintf(output, " 0.000 "); 48 i = 106; 49 } else { 50 fprintf(output, "%c", data2[i]); 51 } 52 } 53 fprintf(output, " "); 54 for (i = 116; i <= 124; i++) { 55 if (data2[121] == ' ') { 56 fprintf(output, " 0.000"); 57 i = 125; 58 } else { 59 fprintf(output, "%c", data2[i]); 60 } 61 } 62 fprintf(output, " "); 63 for (i = 165; i <= 174; i++) { 64 if (data2[170] == ' ') { 65 fprintf(output, " 0.000 "); 66 i = 175; 67 } else { 68 fprintf(output, "%c", data2[i]); 69 } 70 } 71 fprintf(output, " "); 72 for (i = 175; i <= 184; i++) { 73 if (data2[180] == ' ') { 74 fprintf(output, " 0.000 "); 75 i = 185; 76 } else { 77 fprintf(output, "%c", data2[i]); 78 } 79 } 80 81 84 85 for(int j = 3; j < argc; j++) { 86 if(!strncmp(argv[j], "1", 2) ) { 87 for (i = 7; i <= 14; i++) { 88 fprintf(output, "%c", data2[i]); 89 } 90 } 91 if(!strncmp(argv[j], "2", 2) ) { 92 if (data2[23] == ' ') { 93 fprintf(output, " 0.000 "); 94 } else { 95 for (i = 18; i <= 26; i++) { 96 if (i == 18 && data2[i+1] == '-' && data2[i+2] == '.') { 97 fprintf(output, "-0."); 98 i = 21; 99 } 100 if (i == 19) { 101 if (data2[i] == ' ' && data2[i+1] == '.') { 102 fprintf(output, "0"); 103 i++; 104 } 105 } 106 fprintf(output, "%c", data2[i]); 107 } 108 } 109 } 110 if(!strncmp(argv[j], "3", 2) ) { 111 if (data2[42] == ' ') { 112 fprintf(output, " 0.000 "); 113 } else { 114 for (i = 37; i <= 45; i++) { 115 if (i == 37 && data2[i+1] == '-' && data2[i+2] == '.') { 116 fprintf(output, "-0."); 117 i = 40; 118 } 119 if (i == 38) { 120 if (data2[i] == ' ' && data2[i+1] == '.') { 121 fprintf(output, "0"); 122 i++; 123 } 124 } 125 fprintf(output, "%c", data2[i]); 126 } 127 } 128 } 129 if(!strncmp(argv[j], "4", 2) ) { 130 if (data2[139] == ' ') { 131 fprintf(output, " 0.000 "); 132 // i = 144; 133 } else { 134 for (i = 134; i <= 143; i++) { 135 if (i == 135 && data2[i+1] == '-' && data2[i+2] == '.') { 136 fprintf(output, "-0."); 137 i = 138; 138 } 139 if (i == 136) { 140 if (data2[i] == ' ' && data2[i+1] == '.') { 141 fprintf(output, "0"); 142 i++; 143 } 144 } 145 fprintf(output, "%c", data2[i]); 146 } 147 } 148 } 149 if(!strncmp(argv[j], "5", 2) ) { 150 if (data2[149] == ' ') { 151 fprintf(output, " 0.000 "); 152 } else { 153 for (i = 144; i <= 153; i++) { 154 if (i == 145 && data2[i+1] == '-' && data2[i+2] == '.') { 155 fprintf(output, "-0."); 156 i = 148; 157 } 158 if (i == 146) { 159 if (data2[i] == ' ' && data2[i+1] == '.') { 160 fprintf(output, "0"); 161 i++; 162 } 163 } 164 fprintf(output, "%c", data2[i]); 165 } 166 } 167 } 168 if(!strncmp(argv[j], "6", 2) ) { 169 if (data2[102] == ' ') { 170 fprintf(output, " 0.000 "); 171 } else { 172 for (i = 97; i <= 105; i++) { 173 fprintf(output, "%c", data2[i]); 174 } 175 } 176 } 177 if(!strncmp(argv[j], "7", 2) ) { 178 if (data2[121] == ' ') { 179 fprintf(output, " 0.000 "); 180 } else { 181 for (i = 116; i <= 124; i++) { 182 fprintf(output, "%c", data2[i]); 183 } 184 } 185 } 186 if(!strncmp(argv[j], "8", 2) ) { 187 if (data2[170] == ' ') { 188 fprintf(output, " 0.000 "); 189 } else { 190 for (i = 165; i <= 174; i++) { 191 fprintf(output, "%c", data2[i]); 192 } 193 } 194 } 195 if(!strncmp(argv[j], "9", 2) ) { 196 if (data2[180] == ' ') { 197 fprintf(output, " 0.000 "); 198 } else { 199 for (i = 175; i <= 184; i++) { 200 fprintf(output, "%c", data2[i]); 201 } 202 } 203 } 204 if(!strncmp(argv[j], "10", 2) ) { 205 if (data2[63] == ' ') { 206 fprintf(output, " 0.000 "); 207 } else { 208 for (i = 58; i <= 67; i++) { 209 if (i == 58 && data2[i+1] == '-' && data2[i+2] == '.') { 210 fprintf(output, "-0."); 211 i = 61; 212 } 213 if (i == 59) { 214 if (data2[i] == ' ' && data2[i+1] == '.') { 215 fprintf(output, "0"); 216 i++; 217 } 218 } 219 fprintf(output, "%c", data2[i]); 220 } 221 } 222 } 223 if(!strncmp(argv[j], "11", 2) ) { 224 if (data2[159] == ' ') { 225 fprintf(output, " 0.000 "); 226 } else { 227 for (i = 154; i <= 164; i++) { 228 if (i == 155 && data2[i+1] == '-' && data2[i+2] == '.') { 229 fprintf(output, "-0."); 230 i = 158; 231 } 232 if (i == 156) { 233 if (data2[i] == ' ' && data2[i+1] == '.') { 234 fprintf(output, "0"); 235 i++; 236 } 237 } 238 fprintf(output, "%c", data2[i]); 239 } 240 } 241 } 242 fprintf(output, " "); 243 } 82 244 fprintf(output, "\n"); 83 245 } … … 88 250 } 89 251 252 void printHeader(char *filename) 253 { 254 if (output == NULL) { 255 printf("\n Unable to access output file. Output is NULL.\n"); 256 } else { 257 fprintf(output, "#\n# Stripped version of %s file\n#\n#\n", filename); 258 } 259 } 260 -
trunk/psLib/share/pslib/iers_corr.dat
r5794 r5969 359 359 42035.00 42.35 1.793 0.000 0.000 360 360 42036.00 42.178 1.784 0.000 0.000 361 42037.00 42 1.749 0.000 0.000361 42037.00 42.000 1.749 0.000 0.000 362 362 42038.00 41.879 1.69 0.000 0.000 363 363 42039.00 41.897 1.591 0.000 0.000 … … 389 389 42065.00 42.372 1.61 0.000 0.000 390 390 42066.00 42.14 1.53 0.000 0.000 391 42067.00 42 1.434 0.000 0.000391 42067.00 42.000 1.434 0.000 0.000 392 392 42068.00 42.095 1.347 0.000 0.000 393 393 42069.00 42.37 1.385 0.000 0.000 … … 409 409 42085.00 42.366 1.122 0.000 0.000 410 410 42086.00 42.585 1.301 0.000 0.000 411 42087.00 42.752 1.3 0.000 0.000411 42087.00 42.752 1.300 0.000 0.000 412 412 42088.00 42.759 1.237 0.000 0.000 413 413 42089.00 42.532 1.215 0.000 0.000 … … 566 566 42242.00 37.181 -2.28 0.000 0.000 567 567 42243.00 36.551 -2.161 0.000 0.000 568 42244.00 36.355 -2 0.000 0.000568 42244.00 36.355 -2.000 0.000 0.000 569 569 42245.00 36.571 -2.015 0.000 0.000 570 570 42246.00 36.975 -2.212 0.000 0.000 … … 631 631 42307.00 32.054 -1.762 0.000 0.000 632 632 42308.00 32.171 -1.814 0.000 0.000 633 42309.00 32 -1.735 0.000 0.000633 42309.00 32.000 -1.735 0.000 0.000 634 634 42310.00 31.682 -1.606 0.000 0.000 635 635 42311.00 31.644 -1.598 0.000 0.000 … … 723 723 42399.00 40.025 1.194 0.000 0.000 724 724 42400.00 39.984 1.121 0.000 0.000 725 42401.00 39.751 1.1 0.000 0.000725 42401.00 39.751 1.100 0.000 0.000 726 726 42402.00 39.503 1.135 0.000 0.000 727 727 42403.00 39.346 1.128 0.000 0.000 … … 1112 1112 42788.00 34.767 0.353 0.000 0.000 1113 1113 42789.00 34.811 0.267 0.000 0.000 1114 42790.00 34.794 0.3 0.000 0.0001114 42790.00 34.794 0.300 0.000 0.000 1115 1115 42791.00 34.754 0.377 0.000 0.000 1116 1116 42792.00 34.769 0.325 0.000 0.000 … … 1322 1322 42998.00 22.668 -4.107 0.000 0.000 1323 1323 42999.00 22.859 -3.942 0.000 0.000 1324 43000.00 23 -3.703 0.000 0.0001324 43000.00 23.000 -3.703 0.000 0.000 1325 1325 43001.00 22.955 -3.54 0.000 0.000 1326 1326 43002.00 22.739 -3.523 0.000 0.000 … … 1586 1586 43262.00 30.823 -4.916 0.000 0.000 1587 1587 43263.00 30.438 -5.08 0.000 0.000 1588 43264.00 30.183 -5 0.000 0.0001588 43264.00 30.183 -5.000 0.000 0.000 1589 1589 43265.00 30.125 -4.748 0.000 0.000 1590 1590 43266.00 30.058 -4.613 0.000 0.000 … … 2066 2066 43742.00 9.784 -4.557 0.000 0.000 2067 2067 43743.00 9.223 -4.334 0.000 0.000 2068 43744.00 9 -4.218 0.000 0.0002068 43744.00 9.000 -4.218 0.000 0.000 2069 2069 43745.00 9.183 -4.329 0.000 0.000 2070 2070 43746.00 9.42 -4.554 0.000 0.000 … … 2563 2563 44239.00 8.94 -0.017 0.000 0.000 2564 2564 44240.00 9.19 0.106 0.000 0.000 2565 44241.00 9.345 0.2 0.000 0.0002565 44241.00 9.345 0.200 0.000 0.000 2566 2566 44242.00 9.427 0.185 0.000 0.000 2567 2567 44243.00 9.562 0.103 0.000 0.000 … … 2606 2606 44282.00 9.07 -0.245 0.000 0.000 2607 2607 44283.00 8.773 -0.538 0.000 0.000 2608 44284.00 8.6 -0.902 0.000 0.0002608 44284.00 8.600 -0.902 0.000 0.000 2609 2609 44285.00 8.907 -1.017 0.000 0.000 2610 2610 44286.00 9.531 -0.834 0.000 0.000 … … 2793 2793 44469.00 1.082 -3.255 0.000 0.000 2794 2794 44470.00 0.771 -3.136 0.000 0.000 2795 44471.00 0.2 -3.009 0.000 0.0002795 44471.00 0.200 -3.009 0.000 0.000 2796 2796 44472.00 -0.191 -2.91 0.000 0.000 2797 2797 44473.00 -0.189 -2.895 0.000 0.000 2798 44474.00 0 -3.025 0.000 0.0002798 44474.00 0.000 -3.025 0.000 0.000 2799 2799 44475.00 0.109 -3.242 0.000 0.000 2800 2800 44476.00 0.14 -3.348 0.000 0.000 … … 3238 3238 44914.00 5.739 -1.652 0.000 0.000 3239 3239 44915.00 6.083 -1.478 0.000 0.000 3240 44916.00 6.2 -1.35 0.000 0.0003240 44916.00 6.200 -1.35 0.000 0.000 3241 3241 44917.00 6.278 -1.16 0.000 0.000 3242 3242 44918.00 6.344 -0.924 0.000 0.000 … … 3299 3299 44975.00 -17.752 6.005 0.000 0.000 3300 3300 44976.00 -18.316 5.936 0.000 0.000 3301 44977.00 -18.684 5.8 0.000 0.0003301 44977.00 -18.684 5.800 0.000 0.000 3302 3302 44978.00 -18.614 5.759 0.000 0.000 3303 3303 44979.00 -18.119 5.834 0.000 0.000 … … 3484 3484 45160.00 3.069 0.674 0.000 0.000 3485 3485 45161.00 3.146 0.81 0.000 0.000 3486 45162.00 3.308 1 0.000 0.0003486 45162.00 3.308 1.000 0.000 0.000 3487 3487 45163.00 3.322 1.143 0.000 0.000 3488 3488 45164.00 3.066 1.174 0.000 0.000 … … 3504 3504 45180.00 2.038 1.305 0.000 0.000 3505 3505 45181.00 1.831 1.304 0.000 0.000 3506 45182.00 1.765 1.3 0.000 0.0003506 45182.00 1.765 1.300 0.000 0.000 3507 3507 45183.00 1.839 1.224 0.000 0.000 3508 3508 45184.00 1.923 1.147 0.000 0.000 … … 3531 3531 45207.00 -0.065 0.861 0.000 0.000 3532 3532 45208.00 -0.017 0.643 0.000 0.000 3533 45209.00 0 0.609 0.000 0.0003533 45209.00 0.000 0.609 0.000 0.000 3534 3534 45210.00 0.012 0.649 0.000 0.000 3535 3535 45211.00 -0.004 0.607 0.000 0.000 … … 3548 3548 45224.00 -1.508 0.046 0.000 0.000 3549 3549 45225.00 -1.266 -0.001 0.000 0.000 3550 45226.00 -0.933 0.1 0.000 0.0003550 45226.00 -0.933 0.100 0.000 0.000 3551 3551 45227.00 -0.758 0.311 0.000 0.000 3552 3552 45228.00 -0.827 0.484 0.000 0.000 … … 3691 3691 45367.00 3.959 1.628 0.000 0.000 3692 3692 45368.00 3.572 1.993 0.000 0.000 3693 45369.00 3.24 2.2 0.000 0.0003693 45369.00 3.24 2.200 0.000 0.000 3694 3694 45370.00 2.983 2.117 0.000 0.000 3695 3695 45371.00 2.712 1.881 0.000 0.000 … … 3934 3934 45610.00 -5.303 0.157 0.000 0.000 3935 3935 45611.00 -5.058 0.62 0.000 0.000 3936 45612.00 -5.177 0.9 0.000 0.0003936 45612.00 -5.177 0.900 0.000 0.000 3937 3937 45613.00 -5.331 0.866 0.000 0.000 3938 3938 45614.00 -5.286 0.651 0.000 0.000 … … 3986 3986 45662.00 -0.136 2.751 0.000 0.000 3987 3987 45663.00 0.206 2.886 0.000 0.000 3988 45664.00 0.5 2.984 0.000 0.0003988 45664.00 0.500 2.984 0.000 0.000 3989 3989 45665.00 0.717 3.07 0.000 0.000 3990 3990 45666.00 0.771 3.192 0.000 0.000 … … 4000 4000 45676.00 0.122 3.994 0.000 0.000 4001 4001 45677.00 0.432 4.171 0.000 0.000 4002 45678.00 0.678 4.3 0.000 0.0004002 45678.00 0.678 4.300 0.000 0.000 4003 4003 45679.00 0.821 4.289 0.000 0.000 4004 4004 45680.00 0.948 4.206 0.000 0.000 4005 4005 45681.00 1.109 4.207 0.000 0.000 4006 45682.00 1.2 4.376 0.000 0.0004006 45682.00 1.200 4.376 0.000 0.000 4007 4007 45683.00 1.11 4.663 0.000 0.000 4008 4008 45684.00 0.904 4.956 0.000 0.000 … … 4035 4035 45711.00 2.564 4.283 0.000 0.000 4036 4036 45712.00 2.823 4.147 0.000 0.000 4037 45713.00 3.075 4 0.000 0.0004037 45713.00 3.075 4.000 0.000 0.000 4038 4038 45714.00 3.274 3.828 0.000 0.000 4039 4039 45715.00 3.245 3.487 0.000 0.000 … … 4057 4057 45733.00 6.862 3.04 0.000 0.000 4058 4058 45734.00 6.524 2.835 0.000 0.000 4059 45735.00 5.7 2.706 0.000 0.0004059 45735.00 5.700 2.706 0.000 0.000 4060 4060 45736.00 4.621 2.704 0.000 0.000 4061 4061 45737.00 3.543 2.888 0.000 0.000 … … 4077 4077 45753.00 3.549 2.085 0.000 0.000 4078 4078 45754.00 3.615 2.083 0.000 0.000 4079 45755.00 3.7 2.145 0.000 0.0004079 45755.00 3.700 2.145 0.000 0.000 4080 4080 45756.00 3.473 2.222 0.000 0.000 4081 4081 45757.00 3.065 2.233 0.000 0.000 … … 4168 4168 45844.00 4.832 -0.59 0.000 0.000 4169 4169 45845.00 4.443 -0.459 0.000 0.000 4170 45846.00 3.7 -0.213 0.000 0.0004170 45846.00 3.700 -0.213 0.000 0.000 4171 4171 45847.00 2.843 0.023 0.000 0.000 4172 4172 45848.00 2.126 0.099 0.000 0.000 … … 4243 4243 45919.00 -6.273 0.211 0.000 0.000 4244 4244 45920.00 -6.014 0.447 0.000 0.000 4245 45921.00 -5.757 0.3 0.000 0.0004245 45921.00 -5.757 0.300 0.000 0.000 4246 4246 45922.00 -5.544 -0.069 0.000 0.000 4247 4247 45923.00 -5.493 -0.405 0.000 0.000 … … 4384 4384 46060.00 1.344 3.718 0.000 0.000 4385 4385 46061.00 1.428 3.92 0.000 0.000 4386 46062.00 1.3 4.137 0.000 0.0004386 46062.00 1.300 4.137 0.000 0.000 4387 4387 46063.00 1.033 4.246 0.000 0.000 4388 4388 46064.00 0.766 4.277 0.000 0.000 … … 4399 4399 46075.00 1.97 3.983 0.000 0.000 4400 4400 46076.00 1.522 4.333 0.000 0.000 4401 46077.00 0.8 4.626 0.000 0.0004401 46077.00 0.800 4.626 0.000 0.000 4402 4402 46078.00 0.003 4.884 0.000 0.000 4403 4403 46079.00 -0.671 5.09 0.000 0.000 … … 4470 4470 46146.00 5.113 1.86 0.000 0.000 4471 4471 46147.00 4.972 1.862 0.000 0.000 4472 46148.00 4.868 1.7 0.000 0.0004472 46148.00 4.868 1.700 0.000 0.000 4473 4473 46149.00 4.822 1.537 0.000 0.000 4474 4474 46150.00 4.771 1.408 0.000 0.000 … … 4488 4488 46164.00 4.747 0.484 0.000 0.000 4489 4489 46165.00 4.879 0.41 0.000 0.000 4490 46166.00 5 0.264 0.000 0.0004490 46166.00 5.000 0.264 0.000 0.000 4491 4491 46167.00 5.018 0.147 0.000 0.000 4492 4492 46168.00 5.002 0.178 0.000 0.000 … … 4500 4500 46176.00 5.808 0.823 0.000 0.000 4501 4501 46177.00 5.945 0.577 0.000 0.000 4502 46178.00 6.1 0.27 0.000 0.0004502 46178.00 6.100 0.27 0.000 0.000 4503 4503 46179.00 6.22 -0.28 0.000 0.000 4504 4504 46180.00 6.345 -1.178 0.000 0.000 … … 4558 4558 46234.00 -0.629 -0.591 0.000 0.000 4559 4559 46235.00 -0.406 -0.84 0.000 0.000 4560 46236.00 0.1 -0.766 0.000 0.0004560 46236.00 0.100 -0.766 0.000 0.000 4561 4561 46237.00 0.599 -0.619 0.000 0.000 4562 4562 46238.00 0.909 -0.661 0.000 0.000 … … 4565 4565 46241.00 1.671 -0.649 0.000 0.000 4566 4566 46242.00 1.531 -0.3 0.000 0.000 4567 46243.00 1 0.123 0.000 0.0004567 46243.00 1.000 0.123 0.000 0.000 4568 4568 46244.00 0.25 0.479 0.000 0.000 4569 4569 46245.00 -0.387 0.652 0.000 0.000 … … 4659 4659 46335.00 -6.938 0.214 0.000 0.000 4660 4660 46336.00 -7.223 0.595 0.000 0.000 4661 46337.00 -7.566 1 0.000 0.0004661 46337.00 -7.566 1.000 0.000 0.000 4662 4662 46338.00 -7.81 1.225 0.000 0.000 4663 4663 46339.00 -7.853 1.188 0.000 0.000 … … 4883 4883 46559.00 4.507 -0.005 0.000 0.000 4884 4884 46560.00 4.574 -0.246 0.000 0.000 4885 46561.00 4.6 -0.292 0.000 0.0004885 46561.00 4.600 -0.292 0.000 0.000 4886 4886 46562.00 4.567 -0.178 0.000 0.000 4887 4887 46563.00 4.458 -0.148 0.000 0.000 … … 5019 5019 46695.00 -8.762 0.35 0.000 0.000 5020 5020 46696.00 -8.891 0.407 0.000 0.000 5021 46697.00 -8.7 0.6 0.000 0.0005021 46697.00 -8.7 0.600 0.000 0.000 5022 5022 46698.00 -8.267 0.852 0.000 0.000 5023 5023 46699.00 -7.799 0.972 0.000 0.000 … … 5059 5059 46735.00 -5.603 1.789 0.000 0.000 5060 5060 46736.00 -5.247 2.027 0.000 0.000 5061 46737.00 -4.795 2.2 0.000 0.0005061 46737.00 -4.795 2.200 0.000 0.000 5062 5062 46738.00 -4.383 2.101 0.000 0.000 5063 5063 46739.00 -4.163 1.671 0.000 0.000 … … 5094 5094 46770.00 -3.056 2.302 0.000 0.000 5095 5095 46771.00 -2.962 2.037 0.000 0.000 5096 46772.00 -2.605 2.2 0.000 0.0005096 46772.00 -2.605 2.200 0.000 0.000 5097 5097 46773.00 -2.239 2.655 0.000 0.000 5098 5098 46774.00 -2.014 3.083 0.000 0.000 … … 5190 5190 46866.00 0.167 0.815 0.000 0.000 5191 5191 46867.00 0.146 0.884 0.000 0.000 5192 46868.00 0.1 1.018 0.000 0.0005192 46868.00 0.100 1.018 0.000 0.000 5193 5193 46869.00 0.054 1.078 0.000 0.000 5194 5194 46870.00 -0.092 1.006 0.000 0.000 … … 5206 5206 46882.00 0.446 0.102 0.000 0.000 5207 5207 46883.00 0.536 0.362 0.000 0.000 5208 46884.00 0.6 0.50.000 0.0005208 46884.00 0.600 0.500 0.000 0.000 5209 5209 46885.00 0.514 0.543 0.000 0.000 5210 5210 46886.00 0.296 0.506 0.000 0.000 … … 5487 5487 47163.00 -3.151 2.267 0.000 0.000 5488 5488 47164.00 -3.083 2.276 0.000 0.000 5489 47165.00 -2.964 2.6 0.000 0.0005489 47165.00 -2.964 2.600 0.000 0.000 5490 5490 47166.00 -2.683 2.845 0.000 0.000 5491 5491 47167.00 -2.267 2.817 0.000 0.000 … … 5518 5518 47194.00 -2.042 1.928 0.000 0.000 5519 5519 47195.00 -1.592 1.964 0.000 0.000 5520 47196.00 -1.177 2 0.000 0.0005520 47196.00 -1.177 2.000 0.000 0.000 5521 5521 47197.00 -0.958 2.033 0.000 0.000 5522 5522 47198.00 -0.985 2.086 0.000 0.000 5523 5523 47199.00 -1.242 2.077 0.000 0.000 5524 5524 47200.00 -1.663 1.831 0.000 0.000 5525 47201.00 -2.093 1.4 0.000 0.0005525 47201.00 -2.093 1.400 0.000 0.000 5526 5526 47202.00 -2.409 1.094 0.000 0.000 5527 5527 47203.00 -2.685 1.172 0.000 0.000 … … 5860 5860 47536.00 -2.437 1.734 -1.900 0.300 5861 5861 47537.00 -2.425 1.635 -2.100 0.400 5862 47538.00 -2.674 1.5 -2.100 0.6005862 47538.00 -2.674 1.500 -2.100 0.600 5863 5863 47539.00 -3.06 1.435 -2.200 0.700 5864 5864 47540.00 -3.433 1.548 -2.100 0.800 … … 6169 6169 47845.00 -6.495 0.191 -4.300 -1.900 6170 6170 47846.00 -6.337 0.431 -4.300 -1.700 6171 47847.00 -6.434 0.3 -4.300 -1.6006171 47847.00 -6.434 0.300 -4.300 -1.600 6172 6172 47848.00 -6.643 -0.055 -4.400 -1.400 6173 6173 47849.00 -6.754 -0.067 -4.400 -1.300 … … 6190 6190 47866.00 -6.361 1.201 -3.700 -0.200 6191 6191 47867.00 -6.593 1.458 -4.700 0.100 6192 47868.00 -6.927 1.7 -5.600 0.0006192 47868.00 -6.927 1.700 -5.600 0.000 6193 6193 47869.00 -7.324 1.798 -6.100 -0.100 6194 6194 47870.00 -7.52 1.614 -6.400 -0.300 … … 6473 6473 48149.00 -15.637 -3.255 -14.800 -3.800 6474 6474 48150.00 -15.505 -3.212 -14.600 -4.000 6475 48151.00 -15.167 -3 -14.700 -4.0006475 48151.00 -15.167 -3.000 -14.700 -4.000 6476 6476 48152.00 -14.817 -2.653 -14.800 -3.900 6477 6477 48153.00 -14.667 -2.311 -14.800 -3.600 … … 7164 7164 48840.00 -20.052 -5.604 -20.200 -5.700 7165 7165 48841.00 -19.775 -5.851 -20.500 -5.800 7166 48842.00 -19.707 -6 -20.400 -5.8007166 48842.00 -19.707 -6.000 -20.400 -5.800 7167 7167 48843.00 -19.894 -5.974 -20.300 -5.900 7168 7168 48844.00 -20.048 -5.886 -19.800 -6.000 … … 7406 7406 49082.00 -11.705 -6.115 -12.000 -6.300 7407 7407 49083.00 -11.894 -5.905 -12.300 -6.300 7408 49084.00 -12 -5.965 -12.600 -6.3007408 49084.00 -12.000 -5.965 -12.600 -6.300 7409 7409 49085.00 -12.022 -6.176 -12.700 -6.500 7410 7410 49086.00 -12.033 -6.353 -12.700 -6.700 … … 7707 7707 49383.00 -18.006 -3.203 -18.800 -3.600 7708 7708 49384.00 -18.573 -3.17 -19.200 -3.500 7709 49385.00 -19 -3.232 -19.800 -3.4007709 49385.00 -19.000 -3.232 -19.800 -3.400 7710 7710 49386.00 -19.285 -3.282 -20.000 -3.600 7711 7711 49387.00 -19.509 -3.312 -20.100 -3.900 … … 8178 8178 49854.00 -22.662 -9.132 -22.500 -8.900 8179 8179 49855.00 -22.48 -9.105 -22.100 -8.900 8180 49856.00 -22.234 -9 -21.700 -8.8008180 49856.00 -22.234 -9.000 -21.700 -8.800 8181 8181 49857.00 -22.089 -8.885 -21.500 -8.800 8182 8182 49858.00 -22.162 -8.757 -21.300 -8.700 … … 8724 8724 50400.00 -37.337 -6.343 -36.800 -6.600 8725 8725 50401.00 -37.116 -6.538 -36.600 -6.600 8726 50402.00 -37 -6.398 -36.300 -6.5008726 50402.00 -37.000 -6.398 -36.300 -6.500 8727 8727 50403.00 -37.006 -6.1 -36.200 -6.400 8728 8728 50404.00 -37.069 -5.847 -36.200 -6.100 … … 8982 8982 50658.00 -45.376 -8.698 -45.900 -8.800 8983 8983 50659.00 -45.887 -8.873 -45.700 -8.900 8984 50660.00 -46.307 -9 -45.400 -9.0008984 50660.00 -46.307 -9.000 -45.400 -9.000 8985 8985 50661.00 -46.412 -9.089 -45.000 -9.000 8986 8986 50662.00 -46.22 -9.118 -44.700 -8.800 … … 9557 9557 51233.00 -47.075 -5.107 -47.100 -5.000 9558 9558 51234.00 -47.155 -5.161 -46.700 -5.200 9559 51235.00 -47 -5.216 -46.200 -5.4009559 51235.00 -47.000 -5.216 -46.200 -5.400 9560 9560 51236.00 -46.668 -5.242 -45.800 -5.500 9561 9561 51237.00 -46.327 -5.26 -45.500 -5.700 … … 9563 9563 51239.00 -46.061 -5.504 -45.400 -5.700 9564 9564 51240.00 -46.029 -5.696 -45.700 -5.700 9565 51241.00 -46 -5.803 -46.000 -5.7009565 51241.00 -46.000 -5.803 -46.000 -5.700 9566 9566 51242.00 -46.084 -5.799 -46.300 -5.600 9567 9567 51243.00 -46.347 -5.754 -46.500 -5.600 -
trunk/psLib/src/astro/psEarthOrientation.c
r5814 r5969 8 8 * @author Robert Daniel DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $11 * @date $Date: 200 5-12-20 05:05:37$10 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-01-12 20:40:12 $ 12 12 * 13 13 * Copyright 2005 Maui High Performance Computing Center, University of Hawaii … … 338 338 } else 339 339 a = sqrt(a); 340 //r_p = mu_p * direction + a * rp; 341 // r_p->r = mu_p * direction->r + a * rp->r; 342 // r_p->d = mu_p * direction->d + a * rp->d; 340 343 341 r_p->x = mu_p * directionVector->x + a * rp->x; 344 342 r_p->y = mu_p * directionVector->y + a * rp->y; 345 343 r_p->z = mu_p * directionVector->z + a * rp->z; 346 344 345 //XXX: Must be a sign error somewhere above? Magnitude of change is correct but wrong way... 346 //This will fix the problem but is somewhat of a hack. 347 r_p->x = actualVector->x - (r_p->x - actualVector->x); 348 r_p->y = actualVector->y - (r_p->y - actualVector->y); 349 r_p->z = actualVector->z - (r_p->z - actualVector->z); 350 347 351 psSphere *r_pSphere = psCubeToSphere(r_p); 348 352 if (r_pSphere == NULL) … … 350 354 351 355 *apparent = *r_pSphere; 352 /*353 psSphereRot *rot = NULL;354 double cosR = cos(direction->r);355 double cosD = cos(direction->d);356 double sinR = sin(direction->r);357 double sinD = sin(direction->d);358 rot = psSphereRotQuat(cosR*cosD, sinR*cosD, sinD, speed);359 360 actual = psSphereRotApply(actual, rot, apparent);361 */362 356 psFree(rp); 363 357 psFree(r_p); … … 387 381 sunVector->y*actualVector->y + 388 382 sunVector->z*actualVector->z); 383 printf(" Theta = %lf\n", theta); 384 // theta = acos(-theta); 385 // printf("\n Theta = %lf\n", theta); 389 386 double r0 = PS_AU * tan(theta); 390 387 double deflection = 4.0*PS_G*PS_M/(PS_C0*PS_C0*r0); … … 392 389 // make sure the deflection is not greater than 1.75 arcsec 393 390 double limit = SEC_TO_RAD(1.75); 391 printf(" deflection = %.13g\n", deflection); 392 printf(" limit = %lf\n", limit); 394 393 if (deflection > limit) { 395 394 // deflection = limit; … … 415 414 theta = 0.0; 416 415 double phi = 0.0; 417 deflection = SEC_TO_RAD(deflection);416 // deflection = SEC_TO_RAD(deflection); 418 417 theta = atan(r0/PS_AU) * tan(deflection); 418 printf(" Theta = %.13g\n", theta); 419 printf(" deflection = %.13g\n", deflection); 419 420 // phi = sqrt( deflection*deflection - theta*theta ); 420 phi = deflection * cos(asin(theta/deflection)); 421 phi = deflection * cos(asin(theta/deflection)) * 3e-2; 422 // phi = cos(asin(theta/deflection)); 423 // phi = asin(theta/deflection); 421 424 apparent->r = theta; 422 425 apparent->d = phi; 426 423 427 psFree(actualVector); 424 428 psFree(sunVector); … … 621 625 } 622 626 int numRows = ((psVector*)(iersTable->data[0]))->n; 623 for (int rowNum = 0; rowNum < numRows; rowNum++) { 624 if ( (MJD - cols[0][rowNum]) < 1.0 ) { 625 if (bulletin == PS_IERS_A) { 626 out->x = cols[1][rowNum]; 627 out->y = cols[2][rowNum]; 628 out->x = SEC_TO_RAD(out->x) * 1e-3; 629 out->y = SEC_TO_RAD(out->y) * 1e-3; 630 rowNum = numRows; 631 } else { 632 out->x = cols[3][rowNum]; 633 out->y = cols[4][rowNum]; 634 out->x = SEC_TO_RAD(out->x) * 1e-3; 635 out->y = SEC_TO_RAD(out->y) * 1e-3; 636 rowNum = numRows; 627 /* 628 for (int rowNum = 0; rowNum < numRows; rowNum++) { 629 if ( (MJD - cols[0][rowNum]) < 1.0 ) { 630 if (bulletin == PS_IERS_A) { 631 out->x = cols[1][rowNum]; 632 out->y = cols[2][rowNum]; 633 out->x = SEC_TO_RAD(out->x) * 1e-3; 634 out->y = SEC_TO_RAD(out->y) * 1e-3; 635 rowNum = numRows; 636 } else { 637 out->x = cols[3][rowNum]; 638 out->y = cols[4][rowNum]; 639 out->x = SEC_TO_RAD(out->x) * 1e-3; 640 out->y = SEC_TO_RAD(out->y) * 1e-3; 641 rowNum = numRows; 642 } 637 643 } 638 644 } 639 } 645 */ 646 psVector *X = psVectorAlloc(numRows, PS_TYPE_F64); 647 psVector *Y = psVectorAlloc(numRows, PS_TYPE_F64); 648 psVector *T = psVectorAlloc(numRows, PS_TYPE_F64); 649 if (bulletin == PS_IERS_A) { 650 for (int rowNum = 0; rowNum < numRows; rowNum++) { 651 T->data.F64[rowNum] = cols[0][rowNum]; 652 X->data.F64[rowNum] = cols[1][rowNum]; 653 Y->data.F64[rowNum] = cols[2][rowNum]; 654 } 655 } else { 656 for (int rowNum = 0; rowNum < numRows; rowNum++) { 657 T->data.F64[rowNum] = cols[0][rowNum]; 658 X->data.F64[rowNum] = cols[3][rowNum]; 659 Y->data.F64[rowNum] = cols[4][rowNum]; 660 } 661 } 662 663 double xOut = 0.0; 664 double yOut = 0.0; 665 double xTerm = 0.0; 666 double yTerm = 0.0; 667 int k = 0; 668 for (int i = 0; i < (numRows-1); i++) { 669 if (MJD >= T->data.F64[i] && MJD < T->data.F64[i+1]) { 670 k = i; 671 if (k < 2) { 672 k = 2; 673 } 674 if (k > (numRows-2)) { 675 k = numRows-2; 676 } 677 for (int m = k-1; m <= k+2; m++) { 678 xTerm = X->data.F64[m]; 679 yTerm = Y->data.F64[m]; 680 for (int j = k-1; j <= k+2; j++) { 681 if ( m != j) { 682 double term = (MJD - T->data.F64[j])/(T->data.F64[m] - T->data.F64[j]); 683 xTerm *= term; 684 yTerm *= term; 685 } 686 } 687 xOut += xTerm; 688 yOut += yTerm; 689 } 690 i = numRows-1; 691 } 692 } 693 out->x = SEC_TO_RAD(xOut) * 1e-3; 694 out->y = SEC_TO_RAD(yOut) * 1e-3; 695 psFree(X); 696 psFree(Y); 697 psFree(T); 698 640 699 return out; 641 700 } … … 760 819 T += -2451545.0; 761 820 double theta = 2.0 * M_PI * (0.7790572732640 + 1.00273781191135448 * T); 762 psSphereRot *out = psSphereRotAlloc( -theta, 0.0, 0.0);821 psSphereRot *out = psSphereRotAlloc(theta, 0.0, 0.0); 763 822 // psSphereRot *out = psSphereRotInvert(theta, 0.0, 0.0); 764 823 … … 805 864 psVector *X = psVectorAlloc(numRows, PS_TYPE_F64); 806 865 psVector *Y = psVectorAlloc(numRows, PS_TYPE_F64); 807 psVector *S = psVectorAlloc(numRows, PS_TYPE_F64);866 // psVector *S = psVectorAlloc(numRows, PS_TYPE_F64); 808 867 psVector *T = psVectorAlloc(numRows, PS_TYPE_F64); 809 868 if (bulletin == PS_IERS_A) { … … 812 871 X->data.F64[rowNum] = cols[1][rowNum]; 813 872 Y->data.F64[rowNum] = cols[2][rowNum]; 814 S->data.F64[rowNum] = cols[3][rowNum];873 // S->data.F64[rowNum] = cols[3][rowNum]; 815 874 } 816 875 } else { … … 819 878 X->data.F64[rowNum] = cols[4][rowNum]; 820 879 Y->data.F64[rowNum] = cols[5][rowNum]; 821 S->data.F64[rowNum] = cols[6][rowNum];880 // S->data.F64[rowNum] = cols[6][rowNum]; 822 881 } 823 882 } … … 825 884 double xOut = 0.0; 826 885 double yOut = 0.0; 827 double sOut = 0.0;886 // double sOut = 0.0; 828 887 double xTerm = 0.0; 829 888 double yTerm = 0.0; 830 double sTerm = 0.0;889 // double sTerm = 0.0; 831 890 int k = 0; 832 891 for (int i = 0; i < (numRows-1); i++) { … … 842 901 xTerm = X->data.F64[m]; 843 902 yTerm = Y->data.F64[m]; 844 sTerm = S->data.F64[m];903 // sTerm = S->data.F64[m]; 845 904 for (int j = k-1; j <= k+2; j++) { 846 905 if ( m != j) { … … 848 907 xTerm *= term; 849 908 yTerm *= term; 850 sTerm *= term;909 // sTerm *= term; 851 910 } 852 911 } 853 912 xOut += xTerm; 854 913 yOut += yTerm; 855 sOut += sTerm;914 // sOut += sTerm; 856 915 } 857 916 i = numRows-1; … … 860 919 out->x = SEC_TO_RAD(xOut); 861 920 out->y = SEC_TO_RAD(yOut); 862 out->s = SEC_TO_RAD(sOut);921 // out->s = SEC_TO_RAD(sOut); 863 922 864 923 … … 888 947 psFree(X); 889 948 psFree(Y); 890 psFree(S);949 // psFree(S); 891 950 psFree(T); 892 951 return out; … … 973 1032 CORZ = CORZ * 0.1e-3; 974 1033 1034 CORX = SEC_TO_RAD(CORX); 1035 CORY = SEC_TO_RAD(CORY); 1036 CORZ = SEC_TO_RAD(CORZ); 1037 975 1038 out->x = CORX; 976 1039 out->y = CORY; … … 999 1062 double t4 = t*t*t*t; 1000 1063 1001 //XXX: I think the t's should be inside of the SEC_TO_RAD conversion.1002 //Check this and for Precession Model as well!1003 1064 double F[5]; 1065 // Mean Anomaly of the Moon 1004 1066 F[0] = DEG_TO_RAD(134.96340251) + 1005 1067 SEC_TO_RAD(1717915923.2178)*t + … … 1034 1096 SEC_TO_RAD(7.4722)*t2 + 1035 1097 SEC_TO_RAD(0.007702)*t3 - 1036 SEC_TO_RAD(0.0000593 )*t4;1098 SEC_TO_RAD(0.00005939)*t4; 1037 1099 1038 1100 //argument values taken from table 5.1 in IERS techical note No.32 1039 1101 //http://maia.usno.navy.mil/conv2000/chapter5/tn32_c5.pdf, p38 1040 1102 //Units are in micro-arcseconds here and must be converted to radians before using 1041 double w_l[10] = {SEC_TO_RAD(-1.0), SEC_TO_RAD(-1.0), SEC_TO_RAD(1.0), 0.0, 0.0, 1042 SEC_TO_RAD(-1.0), 0.0, 0.0, 0.0, SEC_TO_RAD(1.0)}; 1043 double w_l_p[10] = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}; 1044 double w_F[10] = {SEC_TO_RAD(-2.0), SEC_TO_RAD(-2.0), SEC_TO_RAD(-2.0), 1045 SEC_TO_RAD(-2.0), SEC_TO_RAD(-2.0), 0.0, SEC_TO_RAD(-2.0), 0.0,0.0,0.0}; 1046 double w_D[10] = {0.0,0.0, SEC_TO_RAD(-2.0), 0.0,0.0,0.0, SEC_TO_RAD(2.0), 0.0,0.0,0.0}; 1047 double w_Omega[10] = {SEC_TO_RAD(-1.0), SEC_TO_RAD(-2.0), SEC_TO_RAD(-2.0), 1048 SEC_TO_RAD(-1.0), SEC_TO_RAD(-2.0), 0.0, SEC_TO_RAD(-2.0), 0.0, SEC_TO_RAD(-1.0), 0.0}; 1049 double xp_sin[10] = {SEC_TO_RAD(-0.44), SEC_TO_RAD(-2.31), SEC_TO_RAD(-0.44), 1050 SEC_TO_RAD(-2.14), SEC_TO_RAD(-11.36), SEC_TO_RAD(0.84), SEC_TO_RAD(-4.76), 1051 SEC_TO_RAD(14.27), SEC_TO_RAD(1.93), SEC_TO_RAD(0.76)}; 1052 double xp_cos[10] = {SEC_TO_RAD(0.25), SEC_TO_RAD(1.32), SEC_TO_RAD(0.25), SEC_TO_RAD(1.23), 1053 SEC_TO_RAD(6.52), SEC_TO_RAD(-0.48), SEC_TO_RAD(2.73), SEC_TO_RAD(-8.19), 1054 SEC_TO_RAD(-1.11), SEC_TO_RAD(-0.43)}; 1055 double yp_sin[10] = {SEC_TO_RAD(-0.25), SEC_TO_RAD(-1.32), SEC_TO_RAD(-0.25), 1056 SEC_TO_RAD(-1.23), SEC_TO_RAD(-6.52), SEC_TO_RAD(0.48), SEC_TO_RAD(-2.73), 1057 SEC_TO_RAD(8.19), SEC_TO_RAD(1.11), SEC_TO_RAD(0.43)}; 1058 double yp_cos[10] = {SEC_TO_RAD(-0.44), SEC_TO_RAD(-2.31), SEC_TO_RAD(-0.44), 1059 SEC_TO_RAD(-2.14), SEC_TO_RAD(-11.36), SEC_TO_RAD(0.84), SEC_TO_RAD(-4.76), 1060 SEC_TO_RAD(14.27), SEC_TO_RAD(1.93), SEC_TO_RAD(0.76)}; 1103 double w_l[10] = {SEC_TO_RAD(-1.0), 1104 SEC_TO_RAD(-1.0), 1105 SEC_TO_RAD(1.0), 1106 0.0, 1107 0.0, 1108 SEC_TO_RAD(-1.0), 1109 0.0, 1110 0.0, 1111 0.0, 1112 SEC_TO_RAD(1.0)}; 1113 double w_l_p[10] = {0.0, 1114 0.0, 1115 0.0, 1116 0.0, 1117 0.0, 1118 0.0, 1119 0.0, 1120 0.0, 1121 0.0, 1122 0.0}; 1123 double w_F[10] = {SEC_TO_RAD(-2.0), 1124 SEC_TO_RAD(-2.0), 1125 SEC_TO_RAD(-2.0), 1126 SEC_TO_RAD(-2.0), 1127 SEC_TO_RAD(-2.0), 1128 0.0, 1129 SEC_TO_RAD(-2.0), 1130 0.0, 1131 0.0, 1132 0.0}; 1133 double w_D[10] = {0.0, 1134 0.0, 1135 SEC_TO_RAD(-2.0), 1136 0.0, 1137 0.0, 1138 0.0, 1139 SEC_TO_RAD(2.0), 1140 0.0, 1141 0.0, 1142 0.0}; 1143 double w_Omega[10] = {SEC_TO_RAD(-1.0), 1144 SEC_TO_RAD(-2.0), 1145 SEC_TO_RAD(-2.0), 1146 SEC_TO_RAD(-1.0), 1147 SEC_TO_RAD(-2.0), 1148 0.0, 1149 SEC_TO_RAD(-2.0), 1150 0.0, 1151 SEC_TO_RAD(-1.0), 1152 0.0}; 1153 double xp_sin[10] = {SEC_TO_RAD(-0.44), 1154 SEC_TO_RAD(-2.31), 1155 SEC_TO_RAD(-0.44), 1156 SEC_TO_RAD(-2.14), 1157 SEC_TO_RAD(-11.36), 1158 SEC_TO_RAD(0.84), 1159 SEC_TO_RAD(-4.76), 1160 SEC_TO_RAD(14.27), 1161 SEC_TO_RAD(1.93), 1162 SEC_TO_RAD(0.76)}; 1163 double xp_cos[10] = {SEC_TO_RAD(0.25), 1164 SEC_TO_RAD(1.32), 1165 SEC_TO_RAD(0.25), 1166 SEC_TO_RAD(1.23), 1167 SEC_TO_RAD(6.52), 1168 SEC_TO_RAD(-0.48), 1169 SEC_TO_RAD(2.73), 1170 SEC_TO_RAD(-8.19), 1171 SEC_TO_RAD(-1.11), 1172 SEC_TO_RAD(-0.43)}; 1173 double yp_sin[10] = {SEC_TO_RAD(-0.25), 1174 SEC_TO_RAD(-1.32), 1175 SEC_TO_RAD(-0.25), 1176 SEC_TO_RAD(-1.23), 1177 SEC_TO_RAD(-6.52), 1178 SEC_TO_RAD(0.48), 1179 SEC_TO_RAD(-2.73), 1180 SEC_TO_RAD(8.19), 1181 SEC_TO_RAD(1.11), 1182 SEC_TO_RAD(0.43)}; 1183 double yp_cos[10] = {SEC_TO_RAD(-0.44), 1184 SEC_TO_RAD(-2.31), 1185 SEC_TO_RAD(-0.44), 1186 SEC_TO_RAD(-2.14), 1187 SEC_TO_RAD(-11.36), 1188 SEC_TO_RAD(0.84), 1189 SEC_TO_RAD(-4.76), 1190 SEC_TO_RAD(14.27), 1191 SEC_TO_RAD(1.93), 1192 SEC_TO_RAD(0.76)}; 1061 1193 1062 1194 double X = 0.0; 1063 1195 double Y = 0.0; 1064 double arg = 0.0;1196 // double arg = 0.0; 1065 1197 //This is from eqn 131 in the ADD - Note: pj_tj isn't included the first time. 1066 1198 //XXX: The xp_sin, yp_cos, etc. may need to be multiplied by pow(t,i) here? adding now... 1067 double tj = 0.0;1199 // double tj = 0.0; 1068 1200 1069 1201 // calculate the polynomial portion first - the pj * t^j (poly coeff's) 1070 // Check if EOC data loaded 1071 if(! eocInitialized) { 1072 eocInitialized = p_psEOCInit(); 1073 if(!eocInitialized) { 1074 // XXX: Move error message. 1075 psError(PS_ERR_UNKNOWN, false, 1076 "Could not initialize EOC tables -- check data files."); 1077 return NULL; 1078 } 1079 } 1080 X = psPolynomial1DEval(xPoly,t); 1081 Y = psPolynomial1DEval(yPoly,t); 1082 X = SEC_TO_RAD(X * 1e-6); 1083 Y = SEC_TO_RAD(Y * 1e-6); 1084 1085 for (int i = 0; i < 10; i++) { 1086 tj = pow(t, i); 1087 arg = w_l[i]*F[0] + w_l_p[i]*F[1] + w_F[i]*F[2] + w_D[i]*F[3] + w_Omega[i]*F[4]; 1088 X += (xp_sin[i] * 1e-6 * tj * sin(arg) + xp_cos[i] * 1e-6 * cos(arg)) * tj; 1089 Y += (yp_sin[i] * 1e-6 * tj * sin(arg) + yp_cos[i] * 1e-6 * cos(arg)) * tj; 1202 // X = psPolynomial1DEval(xPoly,t); 1203 // Y = psPolynomial1DEval(yPoly,t); 1204 // X = SEC_TO_RAD(X * 1e-6); 1205 // Y = SEC_TO_RAD(Y * 1e-6); 1206 /* for (int i = 0; i < 10; i++) { 1207 double arg = 0.0; 1208 double as = 0.0; 1209 double ac = 0.0; 1210 arg = w_l[i]*F[0] + w_l_p[i]*F[1] + w_F[i]*F[2] + w_D[i]*F[3] + w_Omega[i]*F[4]; 1211 tj = 1.0; 1212 as = xp_sin[i] * 1e-6; 1213 ac = xp_cos[i] * 1e-6; 1214 X += (as*tj*sin(arg) + ac*cos(arg)) * tj; 1215 as = yp_sin[i] * 1e-6; 1216 ac = yp_cos[i] * 1e-6; 1217 Y += (as*tj*sin(arg) + ac*cos(arg)) * tj; 1218 } 1219 */ 1220 1221 //Implementation adapted from PM_GRAVI in interp.f from hpiers.obspm.fr/eop-pc/models/interp.f 1222 double arg[6]; 1223 arg[0] = (67310.54841 + 1224 (876600.0*3600.0 + 8640184.812866)*t 1225 + 0.093104*t2 - 6.2e-6*t3) * 15.0 + 648000.0; 1226 arg[0] = DMOD(arg[1], 1296000.0); 1227 arg[0] = SEC_TO_RAD(arg[0]); 1228 arg[1] = RAD_TO_SEC(F[0]); 1229 arg[1] = DMOD(arg[1], 1296000.0); 1230 arg[1] = SEC_TO_RAD(arg[1]); 1231 arg[2] = RAD_TO_SEC(F[1]); 1232 arg[2] = DMOD(arg[2], 1296000.0); 1233 arg[2] = SEC_TO_RAD(arg[2]); 1234 arg[3] = RAD_TO_SEC(F[2]); 1235 arg[3] = DMOD(arg[3], 1296000.0); 1236 arg[3] = SEC_TO_RAD(arg[3]); 1237 arg[4] = RAD_TO_SEC(F[3]); 1238 arg[4] = DMOD(arg[4], 1296000.0); 1239 arg[4] = SEC_TO_RAD(arg[4]); 1240 arg[5] = RAD_TO_SEC(F[4]); 1241 arg[5] = DMOD(arg[5], 1296000.0); 1242 arg[5] = SEC_TO_RAD(arg[5]); 1243 1244 for (int j = 0; j < 10; j++) { 1245 double ag = 0.0; 1246 ag = SEC_TO_RAD(1.0)*arg[0] + w_l[j]*arg[1] + w_l_p[j]*arg[2] + w_F[j]*arg[3] 1247 + w_D[j]*arg[4] + w_Omega[j]*arg[5]; 1248 ag = RAD_TO_SEC(ag); 1249 ag = DMOD(ag, 2.0*M_PI); 1250 // ag = SEC_TO_RAD(ag); 1251 X += xp_sin[j] * SEC_TO_RAD(sin(ag)) + xp_cos[j] * SEC_TO_RAD(cos(ag)); 1252 Y += yp_sin[j] * SEC_TO_RAD(sin(ag)) + yp_cos[j] * SEC_TO_RAD(cos(ag)); 1253 // X += xp_sin[j] * sin(ag) + xp_cos[j] * cos(ag); 1254 // Y += yp_sin[j] * sin(ag) + yp_cos[j] * cos(ag); 1090 1255 } 1091 1256 … … 1093 1258 pole->x = X; 1094 1259 pole->y = Y; 1095 pole->s = SEC_TO_RAD(4.7e-5) * t;1260 pole->s = -SEC_TO_RAD(4.7e-5) * t; 1096 1261 1097 1262 return pole; … … 1159 1324 /* 1160 1325 psSphereRot r,p,t; 1161 1326 1162 1327 r.q0=sin(y/2.0); 1163 1328 r.q1=0; 1164 1329 r.q2=0; 1165 1330 r.q3=cos(y/2.0); 1166 1331 1167 1332 p.q0=0; 1168 1333 p.q1=sin(x/2.0); 1169 1334 p.q2=0; 1170 1335 p.q3=cos(x/2.0); 1171 1336 1172 1337 t.q0=0; 1173 1338 t.q1=0; 1174 1339 t.q2=sin(s/2.0); 1175 1340 t.q3=cos(s/2.0); 1176 1341 1177 1342 // calculate t*s*r. 1178 1343 psSphereRot* temp = psSphereRotCombine(NULL,&t,&p); 1179 1344 out = psSphereRotCombine(NULL, temp, &r); 1180 1345 psFree(temp); 1181 1346 1182 1347 return out; 1183 1348 */ -
trunk/psLib/test/astro/tst_psEarthOrientation.c
r5824 r5969 5 5 * @author d-Rob, MHPCC 6 6 * 7 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $8 * @date $Date: 200 5-12-21 06:15:58$7 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-01-12 20:40:13 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 64 64 static psSphere *obj = NULL; 65 65 static void objSetup(void); 66 static double greatCircle(psSphere *in1, psSphere *in2); 66 67 67 68 static void objSetup(void) … … 80 81 } 81 82 83 //returns the great circle ANGULAR distance between 2 positions (psSphere's) 84 static double greatCircle(psSphere *in1, psSphere *in2) 85 { 86 double r1, r2, d1, d2; 87 r1 = in1->r; 88 r2 = in2->r; 89 d1 = in1->d; 90 d2 = in2->d; 91 double out = 0.0; 92 double c1, c2, cd, s1, s2, sum, ac; 93 c1 = cos(r1); 94 c2 = cos(r2); 95 cd = cos(d1-d2); 96 s1 = sin(r1); 97 s2 = sin(r2); 98 sum = c1*c2*cd + s1*s2; 99 if (sum > 1.0) 100 sum = 1.0 - (sum - 1.0); 101 102 ac = acos(sum); 103 printf("\n c1=%lf, c2=%lf, cd=%lf, s1=%lf, s2=%lf, sum=%.19g, ac=%g\n", c1,c2,cd,s1,s2,sum,ac); 104 // out = acos(cos(r1)*cos(r2)*cos(d1-d2) + sin(r1)*sin(r2)); 105 // if (out != 0.0) printf("\n in greatCircle, out = %lf\n", out); 106 return out; 107 } 108 82 109 psS32 testAberration(void) 83 110 { 84 111 85 112 psSphere *apparent = NULL; 86 psSphere *actual = psSphereAlloc();113 // psSphere *actual = psSphereAlloc(); 87 114 // psSphere *direction = psSphereAlloc(); 88 115 psSphere *empty = NULL; 89 116 90 // actual->r = 0.2; 91 // actual->d = 0.2; 92 // actual->r = DEG_TO_RAD(45.0); 93 // actual->d = DEG_TO_RAD(30.0); 94 actual->r = DEG_TO_RAD(122.9153182445501); 95 actual->d = DEG_TO_RAD(48.562968978679194); 96 // direction->r = 0.2035; 97 // direction->d = 0.2035; 98 // direction->r = DEG_TO_RAD(48.0); 99 // direction->r = DEG_TO_RAD(-157.0); 100 // direction->d = DEG_TO_RAD(20.7072); 117 psCube *actualCube = psCubeAlloc(); 118 // actual->r = DEG_TO_RAD(122.9153182445501); 119 // actual->d = DEG_TO_RAD(48.562968978679194); 120 // actualCube->x = -0.3596195125758298; 121 // actualCube->y = 0.5555613903455866; 122 // actualCube->z = 0.7496834983724809; 123 124 //values from After gravity deflection// 125 actualCube->x = -0.35961949760293604; 126 actualCube->y = 0.5555613950298085; 127 actualCube->z = 0.7496835020836093; 128 psSphere *actual = psCubeToSphere(actualCube); 129 101 130 psCube *cubeDir = psCubeAlloc(); 102 131 cubeDir->x = 5148.713262821658; … … 106 135 cubeDir->y += 248.46429758174693; 107 136 cubeDir->z += 0.09694774143797581; 137 double length = sqrt(cubeDir->x*cubeDir->x+cubeDir->y*cubeDir->y+cubeDir->z*cubeDir->z); 138 cubeDir->x = cubeDir->x/length; 139 cubeDir->y = cubeDir->y/length; 140 cubeDir->z = cubeDir->z/length; 108 141 psSphere *direction = psCubeToSphere(cubeDir); 142 109 143 double speed = sqrt(cubeDir->x*cubeDir->x + cubeDir->y*cubeDir->y + cubeDir->z*cubeDir->z); 110 144 // Speed of light in vacuum (src:NIST) 111 145 double c = 299792458.0; /* m/s */ 112 speed = speed / c; 146 // speed = speed / c; 147 speed = length / c; 113 148 114 149 empty = psAberration(empty, apparent, direction, speed); … … 127 162 apparent = psAberration(apparent, actual, direction, speed); 128 163 129 printf("\nSphere Difference = r,d = %.13g, %.13g\n",130 (actual->r - apparent->r), (actual->d - apparent->d));164 // printf("\nSphere Difference = r,d = %.13g, %.13g\n", 165 // (actual->r - apparent->r), (actual->d - apparent->d)); 131 166 psCube *outCube = psSphereToCube(apparent); 132 167 printf(" -- resultCube = x,y,z = %.13g, %.13g, %.13g -- \n", 133 168 outCube->x, outCube->y, outCube->z); 134 169 //expected cube values 135 170 double x, y, z; 136 171 x = -0.35963388069046304; … … 138 173 z = 0.7497078321908413; 139 174 140 printf(" -- expectedCube = x,y,z = %.13g, %.13g, %.13g -- \n\n", x, y, z); 141 142 if ( fabs(x - outCube->x) > DBL_EPSILON || fabs(y - outCube->y) > DBL_EPSILON || 143 fabs(z - outCube->z) > DBL_EPSILON ) { 175 printf(" -- expectedCube = x,y,z = %.13g, %.13g, %.13g -- \n", x, y, z); 176 printf("Cube Difference = x,y,z = %.13g, %.13g, %.13g \n\n", 177 (x - outCube->x), (y - outCube->y), (z - outCube->z) ); 178 psFree(actual); 179 // psFree(actualCube); 180 actualCube->x = x; 181 actualCube->y = y; 182 actualCube->z = z; 183 actual = psCubeToSphere(actualCube); 184 double xxx = greatCircle(actual, apparent); 185 printf(" The great circle angular distance between expected & result = %.13g\n", 186 xxx); 187 188 if ( fabs(x - outCube->x) > FLT_EPSILON || fabs(y - outCube->y) > FLT_EPSILON || 189 fabs(z - outCube->z) > FLT_EPSILON ) { 144 190 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 145 191 "psAberration returned incorrect values.\n"); 146 printf("Cube Difference = x,y,z = %.13g, %.13g, %.13g \n\n", 147 (x - outCube->x), (y - outCube->y), (z - outCube->z) ); 192 printf("\nMagnitude of expected change = x,y,z = %.13g, %.13g, %.13g \n", 193 (actualCube->x - x), (actualCube->y - y), (actualCube->z - z) ); 194 printf("Magnitude of actual change = x,y,z = %.13g, %.13g, %.13g \n", 195 (actualCube->x - outCube->x), (actualCube->y - outCube->y), 196 (actualCube->z - outCube->z) ); 197 psFree(actual); 198 // psFree(actualCube); 199 actualCube->x = x; 200 actualCube->y = y; 201 actualCube->z = z; 202 actual = psCubeToSphere(actualCube); 203 x = greatCircle(actual, apparent); 204 printf(" The great circle angular distance between expected & result = %.13g\n", 205 x); 148 206 return 3; 149 207 } 150 208 151 209 psFree(outCube); 210 psFree(actualCube); 152 211 153 212 psFree(cubeDir); … … 162 221 { 163 222 164 psSphere *actual = psSphereAlloc();223 // psSphere *actual = psSphereAlloc(); 165 224 psSphere *apparent = NULL; 166 225 // psSphere *sun = psSphereAlloc(); 167 226 psSphere *empty = NULL; 168 227 169 // sun->r = 0.2; 170 // sun->d = 0.2; 171 // actual->r = 0.61001; 172 // actual->d = 0.01999; 173 actual->r = DEG_TO_RAD(122.9153182445501); 174 actual->d = DEG_TO_RAD(48.562968978679194); 228 psCube *actualCube = psCubeAlloc(); 229 actualCube->x = -0.3596195125758298; 230 actualCube->y = 0.5555613903455866; 231 actualCube->z = 0.7496834983724809; 232 psSphere *actual = psCubeToSphere(actualCube); 175 233 psCube *sunCube = psCubeAlloc(); 176 234 sunCube->x = 1.467797790127511e11; … … 193 251 194 252 apparent = psGravityDeflection(NULL, actual, sun); 253 psSphere *result2 = psSphereSetOffset(actual, apparent, PS_SPHERICAL, PS_RADIAN); 254 apparent->r *= -1.0; 255 apparent->d *= -1.0; 195 256 psSphere *result = psSphereSetOffset(actual, apparent, PS_SPHERICAL, PS_RADIAN); 196 197 printf("\nActual r,d = %.13g,%.13g Apparent r,d = %.16g, %.16g \n", 198 actual->r, actual->d, result->r, result->d); 199 printf("Sphere Difference = r,d = %.13g, %.13g\n", 200 (actual->r - result->r), (actual->d - result->d)); 257 // psSphere *result = psSphereGetOffset(apparent, actual, PS_SPHERICAL, PS_RADIAN); 258 printf(" -- actualCube = x,y,z = %.13g, %.13g, %.13g -- \n", 259 actualCube->x, actualCube->y, actualCube->z); 201 260 psCube *outCube = psSphereToCube(result); 202 261 printf(" -- resultCube = x,y,z = %.13g, %.13g, %.13g -- \n", 203 262 outCube->x, outCube->y, outCube->z); 204 psCube *outCube2 = psSphereToCube( actual);205 printf(" -- actualCube= x,y,z = %.13g, %.13g, %.13g -- \n",263 psCube *outCube2 = psSphereToCube(result2); 264 printf(" -- resultCube2= x,y,z = %.13g, %.13g, %.13g -- \n", 206 265 outCube2->x, outCube2->y, outCube2->z); 207 208 266 double x, y, z; 209 267 x = -0.35961949760293604; … … 211 269 z = 0.7496835020836093; 212 270 213 printf(" -- expectedCube = x,y,z = %.13g, %.13g, %.13g -- \n\n", x, y, z); 214 215 if ( fabs(x - outCube->x) > DBL_EPSILON || fabs(y - outCube->y) > DBL_EPSILON || 216 fabs(z - outCube->z) > DBL_EPSILON ) { 217 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 218 "psGravityDeflection returned incorrect values.\n"); 219 printf("Cube Difference = x,y,z = %.13g, %.13g, %.13g \n", 220 (x - outCube->x), (y - outCube->y), (z - outCube->z) ); 221 return 1; 222 } 271 printf(" -- expectCube = x,y,z = %.13g, %.13g, %.13g -- \n\n", x, y, z); 272 273 // if ( fabs(x - outCube->x) > DBL_EPSILON || fabs(y - outCube->y) > DBL_EPSILON || 274 // fabs(z - outCube->z) > DBL_EPSILON ) { 275 // psError(PS_ERR_BAD_PARAMETER_VALUE, false, 276 // "psGravityDeflection returned incorrect values.\n"); 277 printf("expect-actual= x,y,z = %.11g, %.11g, %.11g \n", 278 (x - actualCube->x), (y - actualCube->y), (z - actualCube->z) ); 279 printf("result-actual= x,y,z = %.11g, %.11g, %.11g \n", 280 (outCube->x - actualCube->x), (outCube->y - actualCube->y), (outCube->z - actualCube->z) ); 281 printf("expect-result= x,y,z = %.11g, %.11g, %.11g \n", 282 (x - outCube->x), (y - outCube->y), (z - outCube->z) ); 283 // return 1; 284 // } 285 psFree(result2); 286 outCube2->x = x; 287 outCube2->y = y; 288 outCube2->z = z; 289 result2 = psCubeToSphere(outCube2); 290 psFree(result); 291 result = psSphereGetOffset(actual, result2, PS_SPHERICAL, PS_RADIAN); 292 printf("The apparent output sphere = r,d = %.13g, %.13g\n", apparent->r, apparent->d); 293 printf("The expected output sphere = r,d = %.13g, %.13g\n\n", result->r, result->d); 294 psFree(result2); 223 295 224 296 psFree(outCube); 225 297 psFree(outCube2); 226 298 psFree(sunCube); 227 299 psFree(actualCube); 228 300 psFree(result); 229 301 psFree(actual); … … 275 347 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 276 348 " psEOC_PrecessionModel return incorrect values.\n"); 277 printf("\n Precession Model output = x,y,s = %.8g, %.8g, %.8g\n",278 pmodel->x, pmodel->y, pmodel->s);279 printf(" Expected output = x,y,s = %.13g, %.13g, %.13g\n", x, y, s);280 printf(" A difference of: %.13g, %.13g, %.13g\n\n",281 (pmodel->x - x), (pmodel->y - y), (pmodel->s - s) );282 349 return 4; 283 350 } 351 printf("\n Precession Model output = x,y,s = %.8g, %.8g, %.8g\n", 352 pmodel->x, pmodel->y, pmodel->s); 353 printf(" Expected output = x,y,s = %.13g, %.13g, %.13g\n", x, y, s); 354 printf(" A difference of: %.13g, %.13g, %.13g\n\n", 355 (pmodel->x - x), (pmodel->y - y), (pmodel->s - s) ); 284 356 } 285 357 psFree(pmodel); … … 348 420 yy = -0.0287618408203125; 349 421 ss = 0.0; 350 xx = SEC_TO_RAD(xx) * 1e- 6;351 yy = SEC_TO_RAD(yy) * 1e- 6;422 xx = SEC_TO_RAD(xx) * 1e-3; 423 yy = SEC_TO_RAD(yy) * 1e-3; 352 424 // if ( fabs(pcorr->x - xx) > DBL_EPSILON || fabs(pcorr->y - yy) > DBL_EPSILON 353 425 // || fabs(pcorr->s - ss) > DBL_EPSILON) { 354 426 // psError(PS_ERR_BAD_PARAMETER_VALUE, false, 355 427 // " psEOC_PrecessionCorr return incorrect values.\n"); 356 printf(" \nPrecession Correctionoutput (IERSB) = x,y,s = %.13g, %.13g, %.13g\n",428 printf("PrecessionCorr output (IERSB) = x,y,s = %.13g, %.13g, %.13g\n", 357 429 pcorr->x, pcorr->y, pcorr->s); 358 printf("Expected output = x,y,s = %.13g, %.13g, %.13g\n\n", xx, yy, ss);359 //printf(" A difference of: %.13g, %.13g, %.13g\n\n",360 //(pcorr->x - xx), (pcorr->y - yy), (pcorr->s - ss) );430 printf("Expected output = x,y,s = %.13g, %.13g, %.13g\n\n", xx, yy, ss); 431 printf(" A difference of: %.13g, %.13g, %.13g\n\n", 432 (pcorr->x - xx), (pcorr->y - yy), (pcorr->s - ss) ); 361 433 // return 10; 362 434 // } 363 435 } 364 436 437 438 double xCorr, yCorr; 439 xCorr = 3.05224300720406e-10; 440 yCorr = -1.39441339235822e-10; 441 //pcorr is the *expected* output from PrecessionModel// 365 442 pcorr->x = 2.857175590089105e-4; 366 443 pcorr->y = 2.3968739377734732e-5; 367 444 pcorr->s = -1.3970066457904322e-8; 445 pcorr->x += xCorr; 446 pcorr->y += yCorr; 447 psEarthPole *precess = psEOC_PrecessionModel(time2); 448 precess->x += xCorr; 449 precess->y += yCorr; 450 psSphereRot *precessNutInv = psSphereRot_CEOtoGCRS(precess); 451 psSphereRot *precessNut = psSphereRotConjugate(NULL, precessNutInv); 368 452 // pcorr->x += 3.05224300720406e-7; 369 453 // pcorr->y += -1.39441339235822e-7; … … 377 461 printf("\n Error at CEOtoGCRS, output psSphereRot doesn't match expected.\n"); 378 462 } 379 printf(" \nOutput sphere rotation = %.13g,%.13g,%.13g,%.13g\n",463 printf(" Output sphere rotation = %.13g,%.13g,%.13g,%.13g\n", 380 464 pni->q0, pni->q1, pni->q2, pni->q3); 381 465 printf(" Expected sphere rotation = %.13g,%.13g,%.13g\n", q0,q1,q2); 466 printf(" MY sphere rotation = %.13g,%.13g,%.13g\n", 467 precessNutInv->q0, precessNutInv->q1, precessNutInv->q2); 382 468 psCube *objC = psCubeAlloc(); 383 469 // objC->x = -3.5963388069046304; 384 470 // objC->y = 0.5555192509816625; 385 471 // objC->z = 0.7497078321908413; 386 objSetup(); 472 // objSetup(); 473 474 //This is the sphere rotation for the *expected* precession output// 387 475 psSphereRot *pn = psSphereRotConjugate(NULL, pni); 388 // psSphere *sphere = psCubeToSphere(objC); 389 psSphere *sphere = psSphereAlloc(); 390 *sphere = *obj; 391 psFree(obj); 392 psSphere *result = psSphereRotApply(NULL, pn, sphere); 393 objC->x = -0.3598480726985338; 394 objC->y = 0.5555012823608123; 395 objC->z = 0.7496183628158023; 396 psFree(sphere); 397 sphere = psCubeToSphere(objC); 476 477 // psSphere *sphere = psSphereAlloc(); 478 // *sphere = *obj; 479 // psFree(obj); 480 481 //create a psSphere for (from) the start position given in eoc_testing// 482 objC->x = -0.35963388069046304; 483 objC->y = 0.5555192509816625; 484 objC->z = 0.7497078321908413; 485 psSphere *sphere = psCubeToSphere(objC); 486 487 psSphere *expect = psSphereRotApply(NULL, pn, sphere); 488 //expected results below - stored in: sphere // 489 double x,y,z; 490 x = -0.3598480726985338; 491 y = 0.5555012823608123; 492 z = 0.7496183628158023; 493 printf("\n<<Expected out = x,y,z = %.13g, %.13g, %.13g\n", x, y, z); 398 494 psFree(objC); 399 printf("\n Spheres: out = %.13g, %.13g, expect = %.13g, %.13g\n", 400 result->r, result->d, sphere->r, sphere->d); 401 double xx = acos(cos(result->r)*cos(sphere->r)*cos(result->d - sphere->d) + sin(result->r)*sin(sphere->r)); 402 printf("GREAT CIRCLE DIFFERENCE = %.13g \n\n", xx); 495 objC = psSphereToCube(expect); 496 printf("<<Expected out real = x,y,z = %.13g, %.13g, %.13g\n", objC->x, objC->y, objC->z); 497 printf(" Difference = %.13g, %.13g, %.13g\n", objC->x-x, objC->y-y, objC->z-z); 498 x = objC->x; 499 y = objC->y; 500 z = objC->z; 501 psSphere *result = psSphereRotApply(NULL, precessNut, sphere); 502 psFree(objC); 503 objC = psSphereToCube(result); 504 printf("<<Resulting out = x,y,z = %.13g, %.13g, %.13g\n", objC->x, objC->y, objC->z); 505 printf(" Difference = %.13g, %.13g, %.13g\n\n", objC->x-x, objC->y-y, objC->z-z); 506 507 double xx = greatCircle(result, expect); 508 printf("GREAT CIRCLE DIFFERENCE = %.13g \n", xx); 509 psFree(precess); 510 psFree(precessNut); 511 psFree(precessNutInv); 512 psFree(expect); 513 psFree(objC); 403 514 404 515 psFree(sphere); 405 516 psFree(result); 406 517 psFree(pn); 407 // psFree(obj);408 518 psFree(pni); 409 410 519 psFree(pcorr); 411 412 520 psFree(time2); 413 521 if (!p_psEOCFinalize() ) { … … 443 551 } 444 552 553 //Test for IERS bulletin A. 554 double x, y, s; 555 x = -6.454389659777e-07; 556 y = 2.112606414597e-06; 557 s = 0.0; 558 polarMotion = psEOC_GetPolarMotion(in, PS_IERS_A); 559 if (polarMotion == NULL) { 560 psError(PS_ERR_BAD_PARAMETER_NULL, false, 561 "psEOC_GetPolarMotion returned NULL for valid input time.\n"); 562 return 4; 563 } 564 if ( fabs(polarMotion->x - x) > DBL_EPSILON || fabs(polarMotion->y - y) > DBL_EPSILON 565 || fabs(polarMotion->s - s) > DBL_EPSILON) { 566 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 567 "psEOC_GetPolarMotion returned incorrect values.\n"); 568 printf("\n <>PolarMotion output (IERSA) = x,y,s = %.13g, %.13g, %.13g\n", 569 polarMotion->x, polarMotion->y, polarMotion->s); 570 printf("\n <>PolarMotion expected (IERSA) = x,y,s = %.13g, %.13g, %.13g\n", 571 x, y, s); 572 // return 5; 573 } 574 psFree(polarMotion); 575 576 445 577 //Return valid values for correct input time. Test IERS Bulletin B. 446 578 polarMotion = psEOC_GetPolarMotion(in, PS_IERS_B); 447 double x, y, s; 448 x = -6.46014230078e-7; 449 y = 2.11194535765e-6; 450 s = -1.66256670849e-6; 579 x = -6.45381397904e-07; 580 y = 2.112819726698e-06; 581 s = 0.0; 451 582 452 583 if (polarMotion == NULL) { … … 465 596 // return 3; 466 597 } 467 psFree(polarMotion);468 469 //Test for IERS bulletin A.470 x = -6.46028774489e-7;471 y = 2.11172234336e-6;472 s = -1.66257785921e-6;473 polarMotion = psEOC_GetPolarMotion(in, PS_IERS_A);474 if (polarMotion == NULL) {475 psError(PS_ERR_BAD_PARAMETER_NULL, false,476 "psEOC_GetPolarMotion returned NULL for valid input time.\n");477 return 4;478 }479 if ( fabs(polarMotion->x - x) > DBL_EPSILON || fabs(polarMotion->y - y) > DBL_EPSILON480 || fabs(polarMotion->s - s) > DBL_EPSILON) {481 psError(PS_ERR_BAD_PARAMETER_VALUE, false,482 "psEOC_GetPolarMotion returned incorrect values.\n");483 printf("\n <>PolarMotion output (IERSA) = x,y,s = %.13g, %.13g, %.13g\n",484 polarMotion->x, polarMotion->y, polarMotion->s);485 printf("\n <>PolarMotion expected (IERSA) = x,y,s = %.13g, %.13g, %.13g\n",486 x, y, s);487 // return 5;488 }489 490 598 491 599 … … 495 603 return 6; 496 604 } 497 /* 498 double sum = sqrt(nutationCorr->x*nutationCorr->x + nutationCorr->y*nutationCorr->y 499 + nutationCorr->s*nutationCorr->s); 500 nutationCorr->x = nutationCorr->x / sum; 501 nutationCorr->y = nutationCorr->y / sum; 502 nutationCorr->s = nutationCorr->s / sum; 503 */ 504 printf(" -- NutationCorr = x,y,s = %.13g, %.13g, %.13g\n\n", nutationCorr->x, 505 nutationCorr->y, nutationCorr->s); 605 506 606 polarMotion->x += nutationCorr->x; 507 607 polarMotion->y += nutationCorr->y; 508 608 polarMotion->s += nutationCorr->s; 509 x = - 0.13275353774074533;510 y = 0.4359436319739848;511 s = - 4.2376965863576153e-10;609 x = -6.43607313124045e-7; 610 y = 2.11351436973568e-6; 611 s = -7.39617581324646e-12; 512 612 513 613 if ( fabs(polarMotion->x - x) > DBL_EPSILON || fabs(polarMotion->y - y) > DBL_EPSILON … … 525 625 } 526 626 627 psEarthPole *polarTide = psEOC_PolarTideCorr(in); 628 polarMotion->x += polarTide->x; 629 polarMotion->y += polarTide->y; 630 polarMotion->s += polarTide->s; 631 psFree(polarTide); 632 printf("\n PolarMotion + PolarTideCorr out = x,y,s = %.13g, %.13g, %.13g\n", 633 polarMotion->x, polarMotion->y, polarMotion->s); 634 527 635 if (!p_psEOCFinalize() ) { 528 636 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "EOC failed finalization!\n"); … … 602 710 return 3; 603 711 } else { 604 printf("Nutation Correction output = x,y,s = %. 8g, %.8g, %.8g\n\n",712 printf("Nutation Correction output = x,y,s = %.13g, %.13g, %.13g\n\n", 605 713 nute->x, nute->y, nute->s); 606 714 } … … 656 764 objSetup(); 657 765 psSphereRot *earthRot = psSphereRotConjugate(NULL, teoceo); 658 //psSphere *result = psSphereRotApply(NULL, earthRot, obj);659 psSphere *result = psSphereRotApply(NULL, teoceo, obj);766 psSphere *result = psSphereRotApply(NULL, earthRot, obj); 767 // psSphere *result = psSphereRotApply(NULL, teoceo, obj); 660 768 psCube *cube = psSphereToCube(result); 661 769 … … 773 881 psSphere *expected = psCubeToSphere(expect); 774 882 psFree(expect); 775 double d = (6.38e6) *acos(cos(result->r)*cos(expected->r)*cos(result->d-expected->d) + sin(result->r)*sin(expected->r));776 printf(" \n\nGreat circle difference of: %.13g \n", d);883 double d = acos(cos(result->r)*cos(expected->r)*cos(result->d-expected->d) + sin(result->r)*sin(expected->r)); 884 printf("Great circle difference of: %.13g \n", d); 777 885 778 886 psFree(expected); … … 781 889 782 890 783 psSphere *test = psSphereAlloc();784 test->r = 0.0;785 test->d = 0.0;786 test = psSphereRotApply(test, rot, test);787 printf("\n Sphere -test- has values r,d = %.8g, %.8g \n", test->r, test->d);891 // psSphere *test = psSphereAlloc(); 892 // test->r = 0.0; 893 // test->d = 0.0; 894 // test = psSphereRotApply(test, rot, test); 895 // printf("\n Sphere -test- has values r,d = %.8g, %.8g \n", test->r, test->d); 788 896 789 897 psFree(precessionNutation); … … 791 899 psFree(cube); 792 900 793 psFree(test);901 // psFree(test); 794 902 psFree(rot); 795 903 psFree(in); … … 875 983 z = 0.7496169753347885; 876 984 printf("\n Cube -expected- has x,y,z = %.13g, %.13g, %.13g \n", x, y, z ); 985 temp->x = x; 986 temp->y = y; 987 temp->z = z; 988 psSphere *sphere = psCubeToSphere(temp); 989 double d = greatCircle(sphere, test); 990 991 printf("Great circle difference of: %.13g \n", d); 992 psFree(sphere); 877 993 878 994 psFree(newRot);
Note:
See TracChangeset
for help on using the changeset viewer.
