Changeset 16936 for trunk/Ohana/src/opihi/dvo/dbExtractMeasures.c
- Timestamp:
- Mar 11, 2008, 11:11:55 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/dbExtractMeasures.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/dbExtractMeasures.c
r16810 r16936 10 10 static int TimeFormat; 11 11 12 static CoordTransform *celestial_to_galactic = NULL; 13 static CoordTransform *celestial_to_ecliptic = NULL; 14 15 static int haveGalacticAve = FALSE; 16 static double GLON_AVE = 0.0; 17 static double GLAT_AVE = 0.0; 18 19 static int haveEclipticAve = FALSE; 20 static double ELON_AVE = 0.0; 21 static double ELAT_AVE = 0.0; 22 23 static int haveGalacticMeas = FALSE; 24 static double GLON_MEAS = 0.0; 25 static double GLAT_MEAS = 0.0; 26 27 static int haveEclipticMeas = FALSE; 28 static double ELON_MEAS = 0.0; 29 static double ELAT_MEAS = 0.0; 30 12 31 void dbExtractMeasuresInit () { 13 32 GetTimeFormat (&TimeReference, &TimeFormat); 33 } 34 35 // define a locally-static transform 36 int dbExtractMeasuresInitTransform (CoordTransformSystem target) { 37 38 // galactic transform is kept forever 39 if (target == COORD_GALACTIC) { 40 if (celestial_to_galactic != NULL) return (TRUE); 41 celestial_to_galactic = InitTransform (COORD_CELESTIAL, target); 42 return (TRUE); 43 } 44 45 // ecliptic transform must be updated (is weakly time-dependent) 46 if (target == COORD_ECLIPTIC) { 47 if (celestial_to_ecliptic != NULL) { 48 free (celestial_to_ecliptic); 49 } 50 celestial_to_ecliptic = InitTransform (COORD_CELESTIAL, target); 51 return (TRUE); 52 } 53 return (FALSE); 54 } 55 56 int dbExtractMeasuresInitAve () { 57 haveGalacticAve = FALSE; 58 haveEclipticAve = FALSE; 59 return (TRUE); 60 } 61 62 int dbExtractMeasuresInitMeas () { 63 haveGalacticMeas = FALSE; 64 haveEclipticMeas = FALSE; 65 return (TRUE); 14 66 } 15 67 … … 88 140 value = average[0].D; 89 141 break; 142 143 case MEAS_GLON: 144 if (!haveGalacticMeas) { 145 ApplyTransform (&GLON_MEAS, &GLAT_MEAS, average[0].R - measure[0].dR / 3600.0, average[0].D - measure[0].dD / 3600.0, celestial_to_galactic); 146 haveGalacticMeas = TRUE; 147 } 148 value = GLON_MEAS; 149 break; 150 case MEAS_GLAT: 151 if (!haveGalacticMeas) { 152 ApplyTransform (&GLON_MEAS, &GLAT_MEAS, average[0].R - measure[0].dR / 3600.0, average[0].D - measure[0].dD / 3600.0, celestial_to_galactic); 153 haveGalacticMeas = TRUE; 154 } 155 value = GLAT_MEAS; 156 break; 157 case MEAS_ELON: 158 if (!haveEclipticMeas) { 159 ApplyTransform (&ELON_MEAS, &ELAT_MEAS, average[0].R - measure[0].dR / 3600.0, average[0].D - measure[0].dD / 3600.0, celestial_to_ecliptic); 160 haveEclipticMeas = TRUE; 161 } 162 value = ELON_MEAS; 163 break; 164 case MEAS_ELAT: 165 if (!haveEclipticMeas) { 166 ApplyTransform (&ELON_MEAS, &ELAT_MEAS, average[0].R - measure[0].dR / 3600.0, average[0].D - measure[0].dD / 3600.0, celestial_to_ecliptic); 167 haveEclipticMeas = TRUE; 168 } 169 value = ELAT_MEAS; 170 break; 171 172 case MEAS_GLON_AVE: 173 if (!haveGalacticAve) { 174 ApplyTransform (&GLON_AVE, &GLAT_AVE, average[0].R, average[0].D, celestial_to_galactic); 175 haveGalacticAve = TRUE; 176 } 177 value = GLON_AVE; 178 break; 179 case MEAS_GLAT_AVE: 180 if (!haveGalacticAve) { 181 ApplyTransform (&GLON_AVE, &GLAT_AVE, average[0].R, average[0].D, celestial_to_galactic); 182 haveGalacticAve = TRUE; 183 } 184 value = GLAT_AVE; 185 break; 186 case MEAS_ELON_AVE: 187 if (!haveEclipticAve) { 188 ApplyTransform (&ELON_AVE, &ELAT_AVE, average[0].R, average[0].D, celestial_to_ecliptic); 189 haveEclipticAve = TRUE; 190 } 191 value = ELON_AVE; 192 break; 193 case MEAS_ELAT_AVE: 194 if (!haveEclipticAve) { 195 ApplyTransform (&ELON_AVE, &ELAT_AVE, average[0].R, average[0].D, celestial_to_ecliptic); 196 haveEclipticAve = TRUE; 197 } 198 value = ELAT_AVE; 199 break; 200 90 201 case MEAS_RA_AVE_ERR: /* OK */ 91 202 value = average[0].dR;
Note:
See TracChangeset
for help on using the changeset viewer.
