Completed
Push — master ( 2ab225...cf2b25 )
by Yannick
08:54 queued 42s
created
require/libs/Predict/Predict/Geodetic.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
  */
7 7
 class Predict_Geodetic
8 8
 {
9
-    public $lat; /*!< Lattitude [rad] */
10
-    public $lon; /*!< Longitude [rad] */
11
-    public $alt; /*!< Altitude [km] */
12
-    public $theta;
9
+	public $lat; /*!< Lattitude [rad] */
10
+	public $lon; /*!< Longitude [rad] */
11
+	public $alt; /*!< Altitude [km] */
12
+	public $theta;
13 13
 }
Please login to merge, or discard this patch.
require/libs/Predict/Predict/SGSDPStatic.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -8,32 +8,32 @@
 block discarded – undo
8 8
  */
9 9
 class Predict_SGSDPStatic
10 10
 {
11
-    public $aodp;
12
-    public $aycof;
13
-    public $c1;
14
-    public $c4;
15
-    public $c5;
16
-    public $cosio;
17
-    public $d2;
18
-    public $d3;
19
-    public $d4;
20
-    public $delmo;
21
-    public $omgcof;
22
-    public $eta;
23
-    public $omgdot;
24
-    public $sinio;
25
-    public $xnodp;
26
-    public $sinmo;
27
-    public $t2cof;
28
-    public $t3cof;
29
-    public $t4cof;
30
-    public $t5cof;
31
-    public $x1mth2;
32
-    public $x3thm1;
33
-    public $x7thm1;
34
-    public $xmcof;
35
-    public $xmdot;
36
-    public $xnodcf;
37
-    public $xnodot;
38
-    public $xlcof;
11
+	public $aodp;
12
+	public $aycof;
13
+	public $c1;
14
+	public $c4;
15
+	public $c5;
16
+	public $cosio;
17
+	public $d2;
18
+	public $d3;
19
+	public $d4;
20
+	public $delmo;
21
+	public $omgcof;
22
+	public $eta;
23
+	public $omgdot;
24
+	public $sinio;
25
+	public $xnodp;
26
+	public $sinmo;
27
+	public $t2cof;
28
+	public $t3cof;
29
+	public $t4cof;
30
+	public $t5cof;
31
+	public $x1mth2;
32
+	public $x3thm1;
33
+	public $x7thm1;
34
+	public $xmcof;
35
+	public $xmdot;
36
+	public $xnodcf;
37
+	public $xnodot;
38
+	public $xlcof;
39 39
 }
Please login to merge, or discard this patch.
require/libs/Predict/Predict/QTH.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
  */
8 8
 class Predict_QTH
9 9
 {
10
-     public $name;   /*!< Name, eg. callsign. */
11
-     public $loc;    /*!< Location, eg City, Country. */
12
-     public $desc;   /*!< Short description. */
13
-     public $lat;    /*!< Latitude in dec. deg. North. */
14
-     public $lon;    /*!< Longitude in dec. deg. East. */
15
-     public $alt;    /*!< Altitude above sea level in meters. */
16
-     public $qra;    /*!< QRA locator */
17
-     public $wx;     /*!< Weather station code (4 chars). */
10
+	 public $name;   /*!< Name, eg. callsign. */
11
+	 public $loc;    /*!< Location, eg City, Country. */
12
+	 public $desc;   /*!< Short description. */
13
+	 public $lat;    /*!< Latitude in dec. deg. North. */
14
+	 public $lon;    /*!< Longitude in dec. deg. East. */
15
+	 public $alt;    /*!< Altitude above sea level in meters. */
16
+	 public $qra;    /*!< QRA locator */
17
+	 public $wx;     /*!< Weather station code (4 chars). */
18 18
 
19
-     public $data;   /*!< Raw data from cfg file. */
19
+	 public $data;   /*!< Raw data from cfg file. */
20 20
 }
Please login to merge, or discard this patch.
require/libs/Predict/Predict/Sat.php 1 patch
Indentation   +296 added lines, -296 removed lines patch added patch discarded remove patch
@@ -22,304 +22,304 @@
 block discarded – undo
22 22
  */
23 23
 class Predict_Sat
24 24
 {
25
-    // Fifth root of a hundred, used for magnitude calculation
26
-    const POGSONS_RATIO = 2.5118864315096;
27
-
28
-    public $name     = null;
29
-    public $nickname = null;
30
-    public $website  = null;
31
-
32
-    public $tle      = null;   /*!< Keplerian elements */
33
-    public $flags    = 0;      /*!< Flags for algo ctrl */
34
-    public $sgps     = null;
35
-    public $dps      = null;
36
-    public $deep_arg = null;
37
-    public $pos      = null;   /*!< Raw position and range */
38
-    public $vel      = null;   /*!< Raw velocity */
39
-
40
-    /*** FIXME: REMOVE */
41
-    public $bearing = null;   /*!< Az, El, range and vel */
42
-    public $astro   = null;   /*!< Ra and Decl */
43
-    /*** END */
44
-
45
-    /* time keeping fields */
46
-    public $jul_epoch = null;
47
-    public $jul_utc   = null;
48
-    public $tsince    = null;
49
-    public $aos       = null;    /*!< Next AOS. */
50
-    public $los       = null;    /*!< Next LOS */
51
-
52
-    public $az         = null;   /*!< Azimuth [deg] */
53
-    public $el         = null;   /*!< Elevation [deg] */
54
-    public $range      = null;   /*!< Range [km] */
55
-    public $range_rate = null;   /*!< Range Rate [km/sec] */
56
-    public $ra         = null;   /*!< Right Ascension [deg] */
57
-    public $dec        = null;   /*!< Declination [deg] */
58
-    public $ssplat     = null;   /*!< SSP latitude [deg] */
59
-    public $ssplon     = null;   /*!< SSP longitude [deg] */
60
-    public $alt        = null;   /*!< altitude [km] */
61
-    public $velo       = null;   /*!< velocity [km/s] */
62
-    public $ma         = null;   /*!< mean anomaly */
63
-    public $footprint  = null;   /*!< footprint */
64
-    public $phase      = null;   /*!< orbit phase */
65
-    public $meanmo     = null;   /*!< mean motion kept in rev/day */
66
-    public $orbit      = null;   /*!< orbit number */
67
-    public $otype      = null;   /*!< orbit type. */
68
-
69
-    public function __construct(Predict_TLE $tle)
70
-    {
71
-        $headerParts    = explode(' ', $tle->header);
72
-        $this->name     = $headerParts[0];
73
-        $this->nickname = $this->name;
74
-        $this->tle      = $tle;
75
-        $this->pos      = new Predict_Vector();
76
-        $this->vel      = new Predict_Vector();
77
-        $this->sgps     = new Predict_SGSDPStatic();
78
-        $this->deep_arg = new Predict_DeepArg();
79
-        $this->dps      = new Predict_DeepStatic();
80
-
81
-        $this->select_ephemeris();
82
-        $this->sat_data_init_sat($this);
83
-    }
84
-
85
-    /* Selects the apropriate ephemeris type to be used */
86
-    /* for predictions according to the data in the TLE */
87
-    /* It also processes values in the tle set so that  */
88
-    /* they are apropriate for the sgp4/sdp4 routines   */
89
-    public function select_ephemeris()
90
-    {
91
-        /* Preprocess tle set */
92
-        $this->tle->xnodeo *= Predict::de2ra;
93
-        $this->tle->omegao *= Predict::de2ra;
94
-        $this->tle->xmo    *= Predict::de2ra;
95
-        $this->tle->xincl  *= Predict::de2ra;
96
-        $temp = Predict::twopi / Predict::xmnpda / Predict::xmnpda;
97
-
98
-        /* store mean motion before conversion */
99
-        $this->meanmo       = $this->tle->xno;
100
-        $this->tle->xno     = $this->tle->xno * $temp * Predict::xmnpda;
101
-        $this->tle->xndt2o *= $temp;
102
-        $this->tle->xndd6o  = $this->tle->xndd6o * $temp / Predict::xmnpda;
103
-        $this->tle->bstar  /= Predict::ae;
104
-
105
-        /* Period > 225 minutes is deep space */
106
-        $dd1 = Predict::xke / $this->tle->xno;
107
-        $dd2 = Predict::tothrd;
108
-        $a1 = pow($dd1, $dd2);
109
-        $r1 = cos($this->tle->xincl);
110
-        $dd1 = 1.0 - $this->tle->eo * $this->tle->eo;
111
-        $temp = Predict::ck2 * 1.5 * ($r1 * $r1 * 3.0 - 1.0) / pow($dd1, 1.5);
112
-        $del1 = $temp / ($a1 * $a1);
113
-        $ao = $a1 * (1.0 - $del1 * (Predict::tothrd * 0.5 + $del1 *
114
-                                 ($del1 * 1.654320987654321 + 1.0)));
115
-        $delo = $temp / ($ao * $ao);
116
-        $xnodp = $this->tle->xno / ($delo + 1.0);
117
-
118
-        /* Select a deep-space/near-earth ephemeris */
119
-        if (Predict::twopi / $xnodp / Predict::xmnpda >= .15625) {
120
-            $this->flags |= Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG;
121
-        } else {
122
-            $this->flags &= ~Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG;
123
-        }
124
-    }
125
-
126
-    /** Initialise satellite data.
127
-     *  @param sat The satellite to initialise.
128
-     *  @param qth Optional QTH info, use (0,0) if NULL.
129
-     *
130
-     * This function calculates the satellite data at t = 0, ie. epoch time
131
-     * The function is called automatically by gtk_sat_data_read_sat.
132
-     */
133
-    public function sat_data_init_sat(Predict_Sat $sat, Predict_QTH $qth = null)
134
-    {
135
-        $obs_geodetic = new Predict_Geodetic();
136
-        $obs_set = new Predict_ObsSet();
137
-        $sat_geodetic = new Predict_Geodetic();
138
-        /* double jul_utc, age; */
139
-
140
-        $jul_utc = Predict_Time::Julian_Date_of_Epoch($sat->tle->epoch); // => tsince = 0.0
141
-        $sat->jul_epoch = $jul_utc;
142
-
143
-        /* initialise observer location */
144
-        if ($qth != null) {
145
-            $obs_geodetic->lon = $qth->lon * Predict::de2ra;
146
-            $obs_geodetic->lat = $qth->lat * Predict::de2ra;
147
-            $obs_geodetic->alt = $qth->alt / 1000.0;
148
-            $obs_geodetic->theta = 0;
149
-        }
150
-        else {
151
-            $obs_geodetic->lon = 0.0;
152
-            $obs_geodetic->lat = 0.0;
153
-            $obs_geodetic->alt = 0.0;
154
-            $obs_geodetic->theta = 0;
155
-        }
156
-
157
-        /* execute computations */
158
-        $sdpsgp = Predict_SGPSDP::getInstance($sat);
159
-        if ($sat->flags & Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG) {
160
-            $sdpsgp->SDP4($sat, 0.0);
161
-        } else {
162
-            $sdpsgp->SGP4($sat, 0.0);
163
-        }
164
-
165
-        /* scale position and velocity to km and km/sec */
166
-        Predict_Math::Convert_Sat_State($sat->pos, $sat->vel);
167
-
168
-        /* get the velocity of the satellite */
169
-        $sat->vel->w = sqrt($sat->vel->x * $sat->vel->x + $sat->vel->y * $sat->vel->y + $sat->vel->z * $sat->vel->z);
170
-        $sat->velo = $sat->vel->w;
171
-        Predict_SGPObs::Calculate_Obs($jul_utc, $sat->pos, $sat->vel, $obs_geodetic, $obs_set);
172
-        Predict_SGPObs::Calculate_LatLonAlt($jul_utc, $sat->pos, $sat_geodetic);
173
-
174
-        while ($sat_geodetic->lon < -Predict::pi) {
175
-            $sat_geodetic->lon += Predict::twopi;
176
-        }
177
-
178
-        while ($sat_geodetic->lon > Predict::pi) {
179
-            $sat_geodetic->lon -= Predict::twopi;
180
-        }
181
-
182
-        $sat->az = Predict_Math::Degrees($obs_set->az);
183
-        $sat->el = Predict_Math::Degrees($obs_set->el);
184
-        $sat->range = $obs_set->range;
185
-        $sat->range_rate = $obs_set->range_rate;
186
-        $sat->ssplat = Predict_Math::Degrees($sat_geodetic->lat);
187
-        $sat->ssplon = Predict_Math::Degrees($sat_geodetic->lon);
188
-        $sat->alt = $sat_geodetic->alt;
189
-        $sat->ma = Predict_Math::Degrees($sat->phase);
190
-        $sat->ma *= 256.0 / 360.0;
191
-        $sat->footprint = 2.0 * Predict::xkmper * acos (Predict::xkmper/$sat->pos->w);
192
-        $age = 0.0;
193
-        $sat->orbit = floor(($sat->tle->xno * Predict::xmnpda / Predict::twopi +
194
-                                   $age * $sat->tle->bstar * Predict::ae) * $age +
195
-                                  $sat->tle->xmo / Predict::twopi) + $sat->tle->revnum - 1;
196
-
197
-        /* orbit type */
198
-        $sat->otype = $sat->get_orbit_type($sat);
199
-    }
200
-
201
-    public function get_orbit_type(Predict_Sat $sat)
202
-    {
203
-         $orbit = Predict_SGPSDP::ORBIT_TYPE_UNKNOWN;
204
-
205
-         if ($this->geostationary($sat)) {
206
-              $orbit = Predict_SGPSDP::ORBIT_TYPE_GEO;
207
-         } else if ($this->decayed($sat)) {
208
-              $orbit = Predict_SGPSDP::ORBIT_TYPE_DECAYED;
209
-         } else {
210
-              $orbit = Predict_SGPSDP::ORBIT_TYPE_UNKNOWN;
211
-         }
212
-
213
-         return $orbit;
214
-    }
215
-
216
-
217
-    /** Determinte whether satellite is in geostationary orbit.
218
-     *  @author John A. Magliacane, KD2BD
219
-     *  @param sat Pointer to satellite data.
220
-     *  @return TRUE if the satellite appears to be in geostationary orbit,
221
-     *          FALSE otherwise.
222
-     *
223
-     * A satellite is in geostationary orbit if
224
-     *
225
-     *     fabs (sat.meanmotion - 1.0027) < 0.0002
226
-     *
227
-     * Note: Appearantly, the mean motion can deviate much more from 1.0027 than 0.0002
228
-     */
229
-    public function geostationary(Predict_Sat $sat)
230
-    {
231
-         if (abs($sat->meanmo - 1.0027) < 0.0002) {
232
-              return true;
233
-         } else {
234
-              return false;
235
-        }
236
-    }
237
-
238
-
239
-    /** Determine whether satellite has decayed.
240
-     *  @author John A. Magliacane, KD2BD
241
-     *  @author Alexandru Csete, OZ9AEC
242
-     *  @param sat Pointer to satellite data.
243
-     *  @return TRUE if the satellite appears to have decayed, FALSE otherwise.
244
-     *  @bug Modified version of the predict code but it is not tested.
245
-     *
246
-     * A satellite is decayed if
247
-     *
248
-     *    satepoch + ((16.666666 - sat.meanmo) / (10.0*fabs(sat.drag))) < "now"
249
-     *
250
-     */
251
-    public function decayed(Predict_Sat $sat)
252
-    {
253
-        /* tle.xndt2o/(twopi/xmnpda/xmnpda) is the value before converted the
25
+	// Fifth root of a hundred, used for magnitude calculation
26
+	const POGSONS_RATIO = 2.5118864315096;
27
+
28
+	public $name     = null;
29
+	public $nickname = null;
30
+	public $website  = null;
31
+
32
+	public $tle      = null;   /*!< Keplerian elements */
33
+	public $flags    = 0;      /*!< Flags for algo ctrl */
34
+	public $sgps     = null;
35
+	public $dps      = null;
36
+	public $deep_arg = null;
37
+	public $pos      = null;   /*!< Raw position and range */
38
+	public $vel      = null;   /*!< Raw velocity */
39
+
40
+	/*** FIXME: REMOVE */
41
+	public $bearing = null;   /*!< Az, El, range and vel */
42
+	public $astro   = null;   /*!< Ra and Decl */
43
+	/*** END */
44
+
45
+	/* time keeping fields */
46
+	public $jul_epoch = null;
47
+	public $jul_utc   = null;
48
+	public $tsince    = null;
49
+	public $aos       = null;    /*!< Next AOS. */
50
+	public $los       = null;    /*!< Next LOS */
51
+
52
+	public $az         = null;   /*!< Azimuth [deg] */
53
+	public $el         = null;   /*!< Elevation [deg] */
54
+	public $range      = null;   /*!< Range [km] */
55
+	public $range_rate = null;   /*!< Range Rate [km/sec] */
56
+	public $ra         = null;   /*!< Right Ascension [deg] */
57
+	public $dec        = null;   /*!< Declination [deg] */
58
+	public $ssplat     = null;   /*!< SSP latitude [deg] */
59
+	public $ssplon     = null;   /*!< SSP longitude [deg] */
60
+	public $alt        = null;   /*!< altitude [km] */
61
+	public $velo       = null;   /*!< velocity [km/s] */
62
+	public $ma         = null;   /*!< mean anomaly */
63
+	public $footprint  = null;   /*!< footprint */
64
+	public $phase      = null;   /*!< orbit phase */
65
+	public $meanmo     = null;   /*!< mean motion kept in rev/day */
66
+	public $orbit      = null;   /*!< orbit number */
67
+	public $otype      = null;   /*!< orbit type. */
68
+
69
+	public function __construct(Predict_TLE $tle)
70
+	{
71
+		$headerParts    = explode(' ', $tle->header);
72
+		$this->name     = $headerParts[0];
73
+		$this->nickname = $this->name;
74
+		$this->tle      = $tle;
75
+		$this->pos      = new Predict_Vector();
76
+		$this->vel      = new Predict_Vector();
77
+		$this->sgps     = new Predict_SGSDPStatic();
78
+		$this->deep_arg = new Predict_DeepArg();
79
+		$this->dps      = new Predict_DeepStatic();
80
+
81
+		$this->select_ephemeris();
82
+		$this->sat_data_init_sat($this);
83
+	}
84
+
85
+	/* Selects the apropriate ephemeris type to be used */
86
+	/* for predictions according to the data in the TLE */
87
+	/* It also processes values in the tle set so that  */
88
+	/* they are apropriate for the sgp4/sdp4 routines   */
89
+	public function select_ephemeris()
90
+	{
91
+		/* Preprocess tle set */
92
+		$this->tle->xnodeo *= Predict::de2ra;
93
+		$this->tle->omegao *= Predict::de2ra;
94
+		$this->tle->xmo    *= Predict::de2ra;
95
+		$this->tle->xincl  *= Predict::de2ra;
96
+		$temp = Predict::twopi / Predict::xmnpda / Predict::xmnpda;
97
+
98
+		/* store mean motion before conversion */
99
+		$this->meanmo       = $this->tle->xno;
100
+		$this->tle->xno     = $this->tle->xno * $temp * Predict::xmnpda;
101
+		$this->tle->xndt2o *= $temp;
102
+		$this->tle->xndd6o  = $this->tle->xndd6o * $temp / Predict::xmnpda;
103
+		$this->tle->bstar  /= Predict::ae;
104
+
105
+		/* Period > 225 minutes is deep space */
106
+		$dd1 = Predict::xke / $this->tle->xno;
107
+		$dd2 = Predict::tothrd;
108
+		$a1 = pow($dd1, $dd2);
109
+		$r1 = cos($this->tle->xincl);
110
+		$dd1 = 1.0 - $this->tle->eo * $this->tle->eo;
111
+		$temp = Predict::ck2 * 1.5 * ($r1 * $r1 * 3.0 - 1.0) / pow($dd1, 1.5);
112
+		$del1 = $temp / ($a1 * $a1);
113
+		$ao = $a1 * (1.0 - $del1 * (Predict::tothrd * 0.5 + $del1 *
114
+								 ($del1 * 1.654320987654321 + 1.0)));
115
+		$delo = $temp / ($ao * $ao);
116
+		$xnodp = $this->tle->xno / ($delo + 1.0);
117
+
118
+		/* Select a deep-space/near-earth ephemeris */
119
+		if (Predict::twopi / $xnodp / Predict::xmnpda >= .15625) {
120
+			$this->flags |= Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG;
121
+		} else {
122
+			$this->flags &= ~Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG;
123
+		}
124
+	}
125
+
126
+	/** Initialise satellite data.
127
+	 *  @param sat The satellite to initialise.
128
+	 *  @param qth Optional QTH info, use (0,0) if NULL.
129
+	 *
130
+	 * This function calculates the satellite data at t = 0, ie. epoch time
131
+	 * The function is called automatically by gtk_sat_data_read_sat.
132
+	 */
133
+	public function sat_data_init_sat(Predict_Sat $sat, Predict_QTH $qth = null)
134
+	{
135
+		$obs_geodetic = new Predict_Geodetic();
136
+		$obs_set = new Predict_ObsSet();
137
+		$sat_geodetic = new Predict_Geodetic();
138
+		/* double jul_utc, age; */
139
+
140
+		$jul_utc = Predict_Time::Julian_Date_of_Epoch($sat->tle->epoch); // => tsince = 0.0
141
+		$sat->jul_epoch = $jul_utc;
142
+
143
+		/* initialise observer location */
144
+		if ($qth != null) {
145
+			$obs_geodetic->lon = $qth->lon * Predict::de2ra;
146
+			$obs_geodetic->lat = $qth->lat * Predict::de2ra;
147
+			$obs_geodetic->alt = $qth->alt / 1000.0;
148
+			$obs_geodetic->theta = 0;
149
+		}
150
+		else {
151
+			$obs_geodetic->lon = 0.0;
152
+			$obs_geodetic->lat = 0.0;
153
+			$obs_geodetic->alt = 0.0;
154
+			$obs_geodetic->theta = 0;
155
+		}
156
+
157
+		/* execute computations */
158
+		$sdpsgp = Predict_SGPSDP::getInstance($sat);
159
+		if ($sat->flags & Predict_SGPSDP::DEEP_SPACE_EPHEM_FLAG) {
160
+			$sdpsgp->SDP4($sat, 0.0);
161
+		} else {
162
+			$sdpsgp->SGP4($sat, 0.0);
163
+		}
164
+
165
+		/* scale position and velocity to km and km/sec */
166
+		Predict_Math::Convert_Sat_State($sat->pos, $sat->vel);
167
+
168
+		/* get the velocity of the satellite */
169
+		$sat->vel->w = sqrt($sat->vel->x * $sat->vel->x + $sat->vel->y * $sat->vel->y + $sat->vel->z * $sat->vel->z);
170
+		$sat->velo = $sat->vel->w;
171
+		Predict_SGPObs::Calculate_Obs($jul_utc, $sat->pos, $sat->vel, $obs_geodetic, $obs_set);
172
+		Predict_SGPObs::Calculate_LatLonAlt($jul_utc, $sat->pos, $sat_geodetic);
173
+
174
+		while ($sat_geodetic->lon < -Predict::pi) {
175
+			$sat_geodetic->lon += Predict::twopi;
176
+		}
177
+
178
+		while ($sat_geodetic->lon > Predict::pi) {
179
+			$sat_geodetic->lon -= Predict::twopi;
180
+		}
181
+
182
+		$sat->az = Predict_Math::Degrees($obs_set->az);
183
+		$sat->el = Predict_Math::Degrees($obs_set->el);
184
+		$sat->range = $obs_set->range;
185
+		$sat->range_rate = $obs_set->range_rate;
186
+		$sat->ssplat = Predict_Math::Degrees($sat_geodetic->lat);
187
+		$sat->ssplon = Predict_Math::Degrees($sat_geodetic->lon);
188
+		$sat->alt = $sat_geodetic->alt;
189
+		$sat->ma = Predict_Math::Degrees($sat->phase);
190
+		$sat->ma *= 256.0 / 360.0;
191
+		$sat->footprint = 2.0 * Predict::xkmper * acos (Predict::xkmper/$sat->pos->w);
192
+		$age = 0.0;
193
+		$sat->orbit = floor(($sat->tle->xno * Predict::xmnpda / Predict::twopi +
194
+								   $age * $sat->tle->bstar * Predict::ae) * $age +
195
+								  $sat->tle->xmo / Predict::twopi) + $sat->tle->revnum - 1;
196
+
197
+		/* orbit type */
198
+		$sat->otype = $sat->get_orbit_type($sat);
199
+	}
200
+
201
+	public function get_orbit_type(Predict_Sat $sat)
202
+	{
203
+		 $orbit = Predict_SGPSDP::ORBIT_TYPE_UNKNOWN;
204
+
205
+		 if ($this->geostationary($sat)) {
206
+			  $orbit = Predict_SGPSDP::ORBIT_TYPE_GEO;
207
+		 } else if ($this->decayed($sat)) {
208
+			  $orbit = Predict_SGPSDP::ORBIT_TYPE_DECAYED;
209
+		 } else {
210
+			  $orbit = Predict_SGPSDP::ORBIT_TYPE_UNKNOWN;
211
+		 }
212
+
213
+		 return $orbit;
214
+	}
215
+
216
+
217
+	/** Determinte whether satellite is in geostationary orbit.
218
+	 *  @author John A. Magliacane, KD2BD
219
+	 *  @param sat Pointer to satellite data.
220
+	 *  @return TRUE if the satellite appears to be in geostationary orbit,
221
+	 *          FALSE otherwise.
222
+	 *
223
+	 * A satellite is in geostationary orbit if
224
+	 *
225
+	 *     fabs (sat.meanmotion - 1.0027) < 0.0002
226
+	 *
227
+	 * Note: Appearantly, the mean motion can deviate much more from 1.0027 than 0.0002
228
+	 */
229
+	public function geostationary(Predict_Sat $sat)
230
+	{
231
+		 if (abs($sat->meanmo - 1.0027) < 0.0002) {
232
+			  return true;
233
+		 } else {
234
+			  return false;
235
+		}
236
+	}
237
+
238
+
239
+	/** Determine whether satellite has decayed.
240
+	 *  @author John A. Magliacane, KD2BD
241
+	 *  @author Alexandru Csete, OZ9AEC
242
+	 *  @param sat Pointer to satellite data.
243
+	 *  @return TRUE if the satellite appears to have decayed, FALSE otherwise.
244
+	 *  @bug Modified version of the predict code but it is not tested.
245
+	 *
246
+	 * A satellite is decayed if
247
+	 *
248
+	 *    satepoch + ((16.666666 - sat.meanmo) / (10.0*fabs(sat.drag))) < "now"
249
+	 *
250
+	 */
251
+	public function decayed(Predict_Sat $sat)
252
+	{
253
+		/* tle.xndt2o/(twopi/xmnpda/xmnpda) is the value before converted the
254 254
            value matches up with the value in predict 2.2.3 */
255
-        /*** FIXME decayed is treated as a static quantity.
255
+		/*** FIXME decayed is treated as a static quantity.
256 256
              It is time dependent. Also sat->jul_utc is often zero
257 257
              when this function is called
258 258
         ***/
259
-        if ((10.0 * abs($sat->tle->xndt2o / (Predict::twopi / Predict::xmnpda / Predict::xmnpda))) == 0) {
260
-    		return true;
261
-    	} elseif ($sat->jul_epoch + ((16.666666 - $sat->meanmo) /
262
-                               (10.0 * abs($sat->tle->xndt2o / (Predict::twopi / Predict::xmnpda / Predict::xmnpda)))) < $sat->jul_utc) {
263
-              return true;
264
-        } else {
265
-              return false;
266
-        }
267
-    }
268
-
269
-    /**
270
-     * Experimental attempt at calculating apparent magnitude.  Known intrinsic
271
-     * magnitudes are listed inside the function for now.
272
-     *
273
-     * @param float       $time The daynum the satellite is calculated for
274
-     * @param Predict_QTH $qth  The observer location
275
-     *
276
-     * @return null on failure, float otherwise
277
-     */
278
-    public function calculateApparentMagnitude($time, Predict_QTH $qth)
279
-    {
280
-        // Recorded intrinsic magnitudes and their respective
281
-        // illumination and distance from heavens-above.com
282
-        static $intrinsicMagnitudes = array(
283
-            '25544' => array(
284
-                'mag'      => -1.3,
285
-                'illum'    => .5,
286
-                'distance' => 1000,
287
-            )
288
-        );
289
-
290
-        // Return null if we don't have a record of the intrinsic mag
291
-        if (!isset($intrinsicMagnitudes[$this->tle->catnr])) {
292
-            return null;
293
-        }
294
-        $imag = $intrinsicMagnitudes[$this->tle->catnr];
295
-
296
-        // Convert the observer's geodetic info to radians and km so
297
-        // we can compare vectors
298
-        $observerGeo      = new Predict_Geodetic();
299
-        $observerGeo->lat = Predict_Math::Radians($qth->lat);
300
-        $observerGeo->lon = Predict_Math::Radians($qth->lon);
301
-        $observerGeo->alt = $qth->alt * 1000;
302
-
303
-        // Now determine the sun and observer positions
304
-        $observerPos      = new Predict_Vector();
305
-        $observerVel      = new Predict_Vector();
306
-        $solarVector      = new Predict_Vector();
307
-        Predict_Solar::Calculate_Solar_Position($time, $solarVector);
308
-        Predict_SGPObs::Calculate_User_PosVel($time, $observerGeo, $observerPos, $observerVel);
309
-
310
-        // Determine the solar phase and and thus the percent illumination
311
-        $observerSatPos = new Predict_Vector();
312
-        Predict_Math::Vec_Sub($this->pos, $observerPos, $observerSatPos);
313
-        $phaseAngle = Predict_Math::Degrees(Predict_Math::Angle($solarVector, $observerSatPos));
314
-        $illum      = $phaseAngle / 180;
315
-
316
-        $illuminationChange            = $illum / $imag['illum'];
317
-        $inverseSquareOfDistanceChange = pow(($imag['distance'] / $this->range), 2);
318
-        $changeInMagnitude             = log(
319
-            $illuminationChange * $inverseSquareOfDistanceChange,
320
-            self::POGSONS_RATIO
321
-        );
322
-
323
-        return $imag['mag'] - $changeInMagnitude;
324
-    }
259
+		if ((10.0 * abs($sat->tle->xndt2o / (Predict::twopi / Predict::xmnpda / Predict::xmnpda))) == 0) {
260
+			return true;
261
+		} elseif ($sat->jul_epoch + ((16.666666 - $sat->meanmo) /
262
+							   (10.0 * abs($sat->tle->xndt2o / (Predict::twopi / Predict::xmnpda / Predict::xmnpda)))) < $sat->jul_utc) {
263
+			  return true;
264
+		} else {
265
+			  return false;
266
+		}
267
+	}
268
+
269
+	/**
270
+	 * Experimental attempt at calculating apparent magnitude.  Known intrinsic
271
+	 * magnitudes are listed inside the function for now.
272
+	 *
273
+	 * @param float       $time The daynum the satellite is calculated for
274
+	 * @param Predict_QTH $qth  The observer location
275
+	 *
276
+	 * @return null on failure, float otherwise
277
+	 */
278
+	public function calculateApparentMagnitude($time, Predict_QTH $qth)
279
+	{
280
+		// Recorded intrinsic magnitudes and their respective
281
+		// illumination and distance from heavens-above.com
282
+		static $intrinsicMagnitudes = array(
283
+			'25544' => array(
284
+				'mag'      => -1.3,
285
+				'illum'    => .5,
286
+				'distance' => 1000,
287
+			)
288
+		);
289
+
290
+		// Return null if we don't have a record of the intrinsic mag
291
+		if (!isset($intrinsicMagnitudes[$this->tle->catnr])) {
292
+			return null;
293
+		}
294
+		$imag = $intrinsicMagnitudes[$this->tle->catnr];
295
+
296
+		// Convert the observer's geodetic info to radians and km so
297
+		// we can compare vectors
298
+		$observerGeo      = new Predict_Geodetic();
299
+		$observerGeo->lat = Predict_Math::Radians($qth->lat);
300
+		$observerGeo->lon = Predict_Math::Radians($qth->lon);
301
+		$observerGeo->alt = $qth->alt * 1000;
302
+
303
+		// Now determine the sun and observer positions
304
+		$observerPos      = new Predict_Vector();
305
+		$observerVel      = new Predict_Vector();
306
+		$solarVector      = new Predict_Vector();
307
+		Predict_Solar::Calculate_Solar_Position($time, $solarVector);
308
+		Predict_SGPObs::Calculate_User_PosVel($time, $observerGeo, $observerPos, $observerVel);
309
+
310
+		// Determine the solar phase and and thus the percent illumination
311
+		$observerSatPos = new Predict_Vector();
312
+		Predict_Math::Vec_Sub($this->pos, $observerPos, $observerSatPos);
313
+		$phaseAngle = Predict_Math::Degrees(Predict_Math::Angle($solarVector, $observerSatPos));
314
+		$illum      = $phaseAngle / 180;
315
+
316
+		$illuminationChange            = $illum / $imag['illum'];
317
+		$inverseSquareOfDistanceChange = pow(($imag['distance'] / $this->range), 2);
318
+		$changeInMagnitude             = log(
319
+			$illuminationChange * $inverseSquareOfDistanceChange,
320
+			self::POGSONS_RATIO
321
+		);
322
+
323
+		return $imag['mag'] - $changeInMagnitude;
324
+	}
325 325
 }
Please login to merge, or discard this patch.
require/libs/Predict/Predict/Vector.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
  */
7 7
 class Predict_Vector
8 8
 {
9
-    public $x = 0;
10
-    public $y = 0;
11
-    public $z = 0;
12
-    public $w = 0;
9
+	public $x = 0;
10
+	public $y = 0;
11
+	public $z = 0;
12
+	public $w = 0;
13 13
 }
Please login to merge, or discard this patch.
require/libs/Predict/Predict/Time.php 1 patch
Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -30,194 +30,194 @@
 block discarded – undo
30 30
  */
31 31
 class Predict_Time
32 32
 {
33
-    /* The function Julian_Date_of_Epoch returns the Julian Date of     */
34
-    /* an epoch specified in the format used in the NORAD two-line      */
35
-    /* element sets. It has been modified to support dates beyond       */
36
-    /* the year 1999 assuming that two-digit years in the range 00-56   */
37
-    /* correspond to 2000-2056. Until the two-line element set format   */
38
-    /* is changed, it is only valid for dates through 2056 December 31. */
39
-    public static function Julian_Date_of_Epoch($epoch)
40
-    {
41
-        $year = 0;
42
-
43
-        /* Modification to support Y2K */
44
-        /* Valid 1957 through 2056     */
45
-        $day = self::modf($epoch * 1E-3, $year) * 1E3;
46
-        if ($year < 57) {
47
-            $year = $year + 2000;
48
-        } else {
49
-            $year = $year + 1900;
50
-        }
51
-        /* End modification */
52
-
53
-        return self::Julian_Date_of_Year($year) + $day;
54
-    }
55
-
56
-    /* Equivalent to the C modf function */
57
-    public static function modf($x, &$ipart) {
58
-        $ipart = (int)$x;
59
-        return $x - $ipart;
60
-    }
61
-
62
-    /* The function Julian_Date_of_Year calculates the Julian Date  */
63
-    /* of Day 0.0 of {year}. This function is used to calculate the */
64
-    /* Julian Date of any date by using Julian_Date_of_Year, DOY,   */
65
-    /* and Fraction_of_Day. */
66
-    public static function Julian_Date_of_Year($year)
67
-    {
68
-        /* Astronomical Formulae for Calculators, Jean Meeus, */
69
-        /* pages 23-25. Calculate Julian Date of 0.0 Jan year */
70
-        $year = $year - 1;
71
-        $i = (int) ($year / 100);
72
-        $A = $i;
73
-        $i = (int) ($A / 4);
74
-        $B = (int) (2 - $A + $i);
75
-        $i = (int) (365.25 * $year);
76
-        $i += (int) (30.6001 * 14);
77
-        $jdoy = $i + 1720994.5 + $B;
78
-
79
-        return $jdoy;
80
-    }
81
-
82
-    /* The function ThetaG calculates the Greenwich Mean Sidereal Time */
83
-    /* for an epoch specified in the format used in the NORAD two-line */
84
-    /* element sets. It has now been adapted for dates beyond the year */
85
-    /* 1999, as described above. The function ThetaG_JD provides the   */
86
-    /* same calculation except that it is based on an input in the     */
87
-    /* form of a Julian Date. */
88
-    public static function ThetaG($epoch, Predict_DeepArg $deep_arg)
89
-    {
90
-        /* Reference:  The 1992 Astronomical Almanac, page B6. */
91
-        // double year,day,UT,jd,TU,GMST,_ThetaG;
92
-
93
-        /* Modification to support Y2K */
94
-        /* Valid 1957 through 2056     */
95
-        $year = 0;
96
-        $day = self::modf($epoch * 1E-3, $year) * 1E3;
97
-
98
-        if ($year < 57) {
99
-            $year += 2000;
100
-        } else {
101
-            $year += 1900;
102
-        }
103
-        /* End modification */
104
-
105
-        $UT = fmod($day, $day);
106
-        $jd = self::Julian_Date_of_Year($year) + $day;
107
-        $TU = ($jd - 2451545.0) / 36525;
108
-        $GMST = 24110.54841 + $TU * (8640184.812866 + $TU * (0.093104 - $TU * 6.2E-6));
109
-        $GMST = Predict_Math::Modulus($GMST + Predict::secday * Predict::omega_E * $UT, Predict::secday);
110
-        $deep_arg->ds50 = $jd - 2433281.5 + $UT;
111
-
112
-        return Predict_Math::FMod2p(6.3003880987 * $deep_arg->ds50 + 1.72944494);
113
-    }
114
-
115
-    /* See the ThetaG doc block above */
116
-    public static function ThetaG_JD($jd)
117
-    {
118
-        /* Reference:  The 1992 Astronomical Almanac, page B6. */
119
-        $UT   = Predict_Math::Frac($jd + 0.5);
120
-        $jd   = $jd - $UT;
121
-        $TU   = ($jd - 2451545.0) / 36525;
122
-        $GMST = 24110.54841 + $TU * (8640184.812866 + $TU * (0.093104 - $TU * 6.2E-6));
123
-        $GMST = Predict_Math::Modulus($GMST + Predict::secday * Predict::omega_E * $UT, Predict::secday);
124
-
125
-        return Predict::twopi * $GMST / Predict::secday;
126
-    }
127
-
128
-    /**
129
-     * Read the system clock and return the current Julian day.  From phpPredict
130
-     *
131
-     * @return float
132
-     */
133
-    public static function get_current_daynum() {
134
-        // Gets the current decimal day number from microtime
135
-
136
-        list($usec, $sec) = explode(' ', microtime());
137
-        return self::unix2daynum($sec, $usec);
138
-    }
139
-
140
-    /**
141
-     * Converts a standard unix timestamp and optional
142
-     * milliseconds to a daynum
143
-     *
144
-     * @param int $sec  Seconds from the unix epoch
145
-     * @param int $usec Optional milliseconds
146
-     *
147
-     * @return float
148
-     */
149
-    public static function unix2daynum($sec, $usec = 0)
150
-    {
151
-        $time = ((($sec + $usec) / 86400.0) - 3651.0);
152
-        return $time + 2444238.5;
153
-    }
154
-
155
-    /* The function Delta_ET has been added to allow calculations on   */
156
-    /* the position of the sun.  It provides the difference between UT */
157
-    /* (approximately the same as UTC) and ET (now referred to as TDT).*/
158
-    /* This function is based on a least squares fit of data from 1950 */
159
-    /* to 1991 and will need to be updated periodically. */
160
-    public static function Delta_ET($year)
161
-    {
162
-      /* Values determined using data from 1950-1991 in the 1990
33
+	/* The function Julian_Date_of_Epoch returns the Julian Date of     */
34
+	/* an epoch specified in the format used in the NORAD two-line      */
35
+	/* element sets. It has been modified to support dates beyond       */
36
+	/* the year 1999 assuming that two-digit years in the range 00-56   */
37
+	/* correspond to 2000-2056. Until the two-line element set format   */
38
+	/* is changed, it is only valid for dates through 2056 December 31. */
39
+	public static function Julian_Date_of_Epoch($epoch)
40
+	{
41
+		$year = 0;
42
+
43
+		/* Modification to support Y2K */
44
+		/* Valid 1957 through 2056     */
45
+		$day = self::modf($epoch * 1E-3, $year) * 1E3;
46
+		if ($year < 57) {
47
+			$year = $year + 2000;
48
+		} else {
49
+			$year = $year + 1900;
50
+		}
51
+		/* End modification */
52
+
53
+		return self::Julian_Date_of_Year($year) + $day;
54
+	}
55
+
56
+	/* Equivalent to the C modf function */
57
+	public static function modf($x, &$ipart) {
58
+		$ipart = (int)$x;
59
+		return $x - $ipart;
60
+	}
61
+
62
+	/* The function Julian_Date_of_Year calculates the Julian Date  */
63
+	/* of Day 0.0 of {year}. This function is used to calculate the */
64
+	/* Julian Date of any date by using Julian_Date_of_Year, DOY,   */
65
+	/* and Fraction_of_Day. */
66
+	public static function Julian_Date_of_Year($year)
67
+	{
68
+		/* Astronomical Formulae for Calculators, Jean Meeus, */
69
+		/* pages 23-25. Calculate Julian Date of 0.0 Jan year */
70
+		$year = $year - 1;
71
+		$i = (int) ($year / 100);
72
+		$A = $i;
73
+		$i = (int) ($A / 4);
74
+		$B = (int) (2 - $A + $i);
75
+		$i = (int) (365.25 * $year);
76
+		$i += (int) (30.6001 * 14);
77
+		$jdoy = $i + 1720994.5 + $B;
78
+
79
+		return $jdoy;
80
+	}
81
+
82
+	/* The function ThetaG calculates the Greenwich Mean Sidereal Time */
83
+	/* for an epoch specified in the format used in the NORAD two-line */
84
+	/* element sets. It has now been adapted for dates beyond the year */
85
+	/* 1999, as described above. The function ThetaG_JD provides the   */
86
+	/* same calculation except that it is based on an input in the     */
87
+	/* form of a Julian Date. */
88
+	public static function ThetaG($epoch, Predict_DeepArg $deep_arg)
89
+	{
90
+		/* Reference:  The 1992 Astronomical Almanac, page B6. */
91
+		// double year,day,UT,jd,TU,GMST,_ThetaG;
92
+
93
+		/* Modification to support Y2K */
94
+		/* Valid 1957 through 2056     */
95
+		$year = 0;
96
+		$day = self::modf($epoch * 1E-3, $year) * 1E3;
97
+
98
+		if ($year < 57) {
99
+			$year += 2000;
100
+		} else {
101
+			$year += 1900;
102
+		}
103
+		/* End modification */
104
+
105
+		$UT = fmod($day, $day);
106
+		$jd = self::Julian_Date_of_Year($year) + $day;
107
+		$TU = ($jd - 2451545.0) / 36525;
108
+		$GMST = 24110.54841 + $TU * (8640184.812866 + $TU * (0.093104 - $TU * 6.2E-6));
109
+		$GMST = Predict_Math::Modulus($GMST + Predict::secday * Predict::omega_E * $UT, Predict::secday);
110
+		$deep_arg->ds50 = $jd - 2433281.5 + $UT;
111
+
112
+		return Predict_Math::FMod2p(6.3003880987 * $deep_arg->ds50 + 1.72944494);
113
+	}
114
+
115
+	/* See the ThetaG doc block above */
116
+	public static function ThetaG_JD($jd)
117
+	{
118
+		/* Reference:  The 1992 Astronomical Almanac, page B6. */
119
+		$UT   = Predict_Math::Frac($jd + 0.5);
120
+		$jd   = $jd - $UT;
121
+		$TU   = ($jd - 2451545.0) / 36525;
122
+		$GMST = 24110.54841 + $TU * (8640184.812866 + $TU * (0.093104 - $TU * 6.2E-6));
123
+		$GMST = Predict_Math::Modulus($GMST + Predict::secday * Predict::omega_E * $UT, Predict::secday);
124
+
125
+		return Predict::twopi * $GMST / Predict::secday;
126
+	}
127
+
128
+	/**
129
+	 * Read the system clock and return the current Julian day.  From phpPredict
130
+	 *
131
+	 * @return float
132
+	 */
133
+	public static function get_current_daynum() {
134
+		// Gets the current decimal day number from microtime
135
+
136
+		list($usec, $sec) = explode(' ', microtime());
137
+		return self::unix2daynum($sec, $usec);
138
+	}
139
+
140
+	/**
141
+	 * Converts a standard unix timestamp and optional
142
+	 * milliseconds to a daynum
143
+	 *
144
+	 * @param int $sec  Seconds from the unix epoch
145
+	 * @param int $usec Optional milliseconds
146
+	 *
147
+	 * @return float
148
+	 */
149
+	public static function unix2daynum($sec, $usec = 0)
150
+	{
151
+		$time = ((($sec + $usec) / 86400.0) - 3651.0);
152
+		return $time + 2444238.5;
153
+	}
154
+
155
+	/* The function Delta_ET has been added to allow calculations on   */
156
+	/* the position of the sun.  It provides the difference between UT */
157
+	/* (approximately the same as UTC) and ET (now referred to as TDT).*/
158
+	/* This function is based on a least squares fit of data from 1950 */
159
+	/* to 1991 and will need to be updated periodically. */
160
+	public static function Delta_ET($year)
161
+	{
162
+	  /* Values determined using data from 1950-1991 in the 1990
163 163
          Astronomical Almanac.  See DELTA_ET.WQ1 for details. */
164 164
 
165
-      $delta_et = 26.465 + 0.747622 * ($year - 1950) +
166
-                 1.886913 * sin(Predict::twopi * ($year - 1975) / 33);
167
-
168
-      return $delta_et;
169
-    }
170
-
171
-    /**
172
-     * Converts a daynum to a unix timestamp.  From phpPredict.
173
-     *
174
-     * @param float $dn Julian Daynum
175
-     *
176
-     * @return float
177
-     */
178
-    public static function daynum2unix($dn) {
179
-        // Converts a daynum to a UNIX timestamp
180
-
181
-        return (86400.0 * ($dn - 2444238.5 + 3651.0));
182
-    }
183
-
184
-    /**
185
-     * Converts a daynum to a readable time format.
186
-     *
187
-     * @param float $dn The julian date
188
-     * @param string $zone The zone string, defaults to America/Los_Angeles
189
-     * @param string $format The date() function's format string.  Defaults to m-d-Y H:i:s
190
-     *
191
-     * @return string
192
-     */
193
-    public static function daynum2readable($dn, $zone = 'America/Los_Angeles', $format = 'm-d-Y H:i:s')
194
-    {
195
-        $unix = self::daynum2unix($dn);
196
-        $date = new DateTime("@" . round($unix));
197
-        $dateTimezone = new DateTimezone($zone);
198
-        $date->setTimezone($dateTimezone);
199
-        return $date->format($format);
200
-    }
201
-
202
-    /**
203
-     * Returns the unix timestamp of a TLE's epoch
204
-     *
205
-     * @param Predict_TLE $tle The TLE object
206
-     *
207
-     * @return int
208
-     */
209
-    public static function getEpochTimeStamp(Predict_TLE $tle)
210
-    {
211
-        $year = $tle->epoch_year;
212
-        $day  = $tle->epoch_day;
213
-        $sec  = round(86400 * $tle->epoch_fod);
214
-
215
-        $zone = new DateTimeZone('GMT');
216
-        $date = new DateTime();
217
-        $date->setTimezone($zone);
218
-        $date->setDate($year, 1, 1);
219
-        $date->setTime(0, 0, 0);
220
-
221
-        return $date->format('U') + (86400 * $day) + $sec - 86400;
222
-    }
165
+	  $delta_et = 26.465 + 0.747622 * ($year - 1950) +
166
+				 1.886913 * sin(Predict::twopi * ($year - 1975) / 33);
167
+
168
+	  return $delta_et;
169
+	}
170
+
171
+	/**
172
+	 * Converts a daynum to a unix timestamp.  From phpPredict.
173
+	 *
174
+	 * @param float $dn Julian Daynum
175
+	 *
176
+	 * @return float
177
+	 */
178
+	public static function daynum2unix($dn) {
179
+		// Converts a daynum to a UNIX timestamp
180
+
181
+		return (86400.0 * ($dn - 2444238.5 + 3651.0));
182
+	}
183
+
184
+	/**
185
+	 * Converts a daynum to a readable time format.
186
+	 *
187
+	 * @param float $dn The julian date
188
+	 * @param string $zone The zone string, defaults to America/Los_Angeles
189
+	 * @param string $format The date() function's format string.  Defaults to m-d-Y H:i:s
190
+	 *
191
+	 * @return string
192
+	 */
193
+	public static function daynum2readable($dn, $zone = 'America/Los_Angeles', $format = 'm-d-Y H:i:s')
194
+	{
195
+		$unix = self::daynum2unix($dn);
196
+		$date = new DateTime("@" . round($unix));
197
+		$dateTimezone = new DateTimezone($zone);
198
+		$date->setTimezone($dateTimezone);
199
+		return $date->format($format);
200
+	}
201
+
202
+	/**
203
+	 * Returns the unix timestamp of a TLE's epoch
204
+	 *
205
+	 * @param Predict_TLE $tle The TLE object
206
+	 *
207
+	 * @return int
208
+	 */
209
+	public static function getEpochTimeStamp(Predict_TLE $tle)
210
+	{
211
+		$year = $tle->epoch_year;
212
+		$day  = $tle->epoch_day;
213
+		$sec  = round(86400 * $tle->epoch_fod);
214
+
215
+		$zone = new DateTimeZone('GMT');
216
+		$date = new DateTime();
217
+		$date->setTimezone($zone);
218
+		$date->setDate($year, 1, 1);
219
+		$date->setTime(0, 0, 0);
220
+
221
+		return $date->format('U') + (86400 * $day) + $sec - 86400;
222
+	}
223 223
 }
Please login to merge, or discard this patch.
require/libs/Predict/Predict/SGPObs.php 1 patch
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -25,131 +25,131 @@
 block discarded – undo
25 25
  */
26 26
 class Predict_SGPObs
27 27
 {
28
-    /* Procedure Calculate_User_PosVel passes the user's geodetic position */
29
-    /* and the time of interest and returns the ECI position and velocity  */
30
-    /* of the observer. The velocity calculation assumes the geodetic      */
31
-    /* position is stationary relative to the earth's surface.             */
32
-    public static function Calculate_User_PosVel(
33
-        $_time, Predict_Geodetic $geodetic, Predict_Vector $obs_pos, Predict_Vector $obs_vel
34
-    )
35
-    {
36
-        /* Reference:  The 1992 Astronomical Almanac, page K11. */
37
-
38
-        $sinGeodeticLat = sin($geodetic->lat); /* Only run sin($geodetic->lat) once */
39
-
40
-        $geodetic->theta = Predict_Math::FMod2p(Predict_Time::ThetaG_JD($_time) + $geodetic->lon);/*LMST*/
41
-        $c = 1 / sqrt(1 + Predict::__f * (Predict::__f - 2) * $sinGeodeticLat * $sinGeodeticLat);
42
-        $sq = (1 - Predict::__f) * (1 - Predict::__f) * $c;
43
-        $achcp = (Predict::xkmper * $c + $geodetic->alt) * cos($geodetic->lat);
44
-        $obs_pos->x = $achcp * cos($geodetic->theta); /*kilometers*/
45
-        $obs_pos->y = $achcp * sin($geodetic->theta);
46
-        $obs_pos->z = (Predict::xkmper * $sq + $geodetic->alt) * $sinGeodeticLat;
47
-        $obs_vel->x = -Predict::mfactor * $obs_pos->y; /*kilometers/second*/
48
-        $obs_vel->y =  Predict::mfactor * $obs_pos->x;
49
-        $obs_vel->z =  0;
50
-        $obs_pos->w = sqrt($obs_pos->x * $obs_pos->x + $obs_pos->y * $obs_pos->y + $obs_pos->z * $obs_pos->z);
51
-        $obs_vel->w = sqrt($obs_vel->x * $obs_vel->x + $obs_vel->y * $obs_vel->y + $obs_vel->z * $obs_vel->z);
52
-    }
53
-
54
-    /* Procedure Calculate_LatLonAlt will calculate the geodetic  */
55
-    /* position of an object given its ECI position pos and time. */
56
-    /* It is intended to be used to determine the ground track of */
57
-    /* a satellite.  The calculations  assume the earth to be an  */
58
-    /* oblate spheroid as defined in WGS '72.                     */
59
-    public static function Calculate_LatLonAlt($_time, Predict_Vector $pos,  Predict_Geodetic $geodetic)
60
-    {
61
-        /* Reference:  The 1992 Astronomical Almanac, page K12. */
62
-
63
-        /* double r,e2,phi,c; */
64
-
65
-        $geodetic->theta = Predict_Math::AcTan($pos->y, $pos->x); /*radians*/
66
-        $geodetic->lon = Predict_Math::FMod2p($geodetic->theta - Predict_Time::ThetaG_JD($_time)); /*radians*/
67
-        $r = sqrt(($pos->x * $pos->x) + ($pos->y * $pos->y));
68
-        $e2 = Predict::__f * (2 - Predict::__f);
69
-        $geodetic->lat = Predict_Math::AcTan($pos->z, $r); /*radians*/
70
-
71
-        do {
72
-            $phi    = $geodetic->lat;
73
-            $sinPhi = sin($phi);
74
-            $c      = 1 / sqrt(1 - $e2 * ($sinPhi * $sinPhi));
75
-            $geodetic->lat = Predict_Math::AcTan($pos->z + Predict::xkmper * $c * $e2 * $sinPhi, $r);
76
-        } while (abs($geodetic->lat - $phi) >= 1E-10);
77
-
78
-        $geodetic->alt = $r / cos($geodetic->lat) - Predict::xkmper * $c;/*kilometers*/
79
-
80
-        if ($geodetic->lat > Predict::pio2) {
81
-            $geodetic->lat -= Predict::twopi;
82
-        }
83
-    }
84
-
85
-    /* The procedures Calculate_Obs and Calculate_RADec calculate         */
86
-    /* the *topocentric* coordinates of the object with ECI position,     */
87
-    /* {pos}, and velocity, {vel}, from location {geodetic} at {time}.    */
88
-    /* The {obs_set} returned for Calculate_Obs consists of azimuth,      */
89
-    /* elevation, range, and range rate (in that order) with units of     */
90
-    /* radians, radians, kilometers, and kilometers/second, respectively. */
91
-    /* The WGS '72 geoid is used and the effect of atmospheric refraction */
92
-    /* (under standard temperature and pressure) is incorporated into the */
93
-    /* elevation calculation; the effect of atmospheric refraction on     */
94
-    /* range and range rate has not yet been quantified.                  */
95
-
96
-    /* The {obs_set} for Calculate_RADec consists of right ascension and  */
97
-    /* declination (in that order) in radians.  Again, calculations are   */
98
-    /* based on *topocentric* position using the WGS '72 geoid and        */
99
-    /* incorporating atmospheric refraction.                              */
100
-    public static function Calculate_Obs($_time, Predict_Vector $pos, Predict_Vector $vel, Predict_Geodetic $geodetic, Predict_ObsSet $obs_set)
101
-    {
102
-        $obs_pos = new Predict_Vector();
103
-        $obs_vel = new Predict_Vector();
104
-        $range   = new Predict_Vector();
105
-        $rgvel   = new Predict_Vector();
106
-
107
-        self::Calculate_User_PosVel($_time, $geodetic, $obs_pos, $obs_vel);
108
-
109
-        $range->x = $pos->x - $obs_pos->x;
110
-        $range->y = $pos->y - $obs_pos->y;
111
-        $range->z = $pos->z - $obs_pos->z;
112
-
113
-        $rgvel->x = $vel->x - $obs_vel->x;
114
-        $rgvel->y = $vel->y - $obs_vel->y;
115
-        $rgvel->z = $vel->z - $obs_vel->z;
116
-
117
-        $range->w = sqrt($range->x * $range->x + $range->y * $range->y + $range->z * $range->z);
118
-
119
-        $sin_lat   = sin($geodetic->lat);
120
-        $cos_lat   = cos($geodetic->lat);
121
-        $sin_theta = sin($geodetic->theta);
122
-        $cos_theta = cos($geodetic->theta);
123
-        $top_s = $sin_lat * $cos_theta * $range->x
124
-            + $sin_lat * $sin_theta * $range->y
125
-            - $cos_lat * $range->z;
126
-        $top_e = -$sin_theta * $range->x
127
-            + $cos_theta * $range->y;
128
-        $top_z = $cos_lat * $cos_theta * $range->x
129
-            + $cos_lat * $sin_theta * $range->y
130
-            + $sin_lat * $range->z;
131
-        $azim = atan(-$top_e / $top_s); /*Azimuth*/
132
-        if ($top_s > 0) {
133
-            $azim = $azim + Predict::pi;
134
-        }
135
-        if ($azim < 0 ) {
136
-            $azim = $azim + Predict::twopi;
137
-        }
138
-        $el = Predict_Math::ArcSin($top_z / $range->w);
139
-        $obs_set->az = $azim;        /* Azimuth (radians)  */
140
-        $obs_set->el = $el;          /* Elevation (radians)*/
141
-        $obs_set->range = $range->w; /* Range (kilometers) */
142
-
143
-        /* Range Rate (kilometers/second)*/
144
-        $obs_set->range_rate = Predict_Math::Dot($range, $rgvel) / $range->w;
145
-
146
-        /* Corrections for atmospheric refraction */
147
-        /* Reference:  Astronomical Algorithms by Jean Meeus, pp. 101-104    */
148
-        /* Correction is meaningless when apparent elevation is below horizon */
149
-        //	obs_set->el = obs_set->el + Radians((1.02/tan(Radians(Degrees(el)+
150
-        //							      10.3/(Degrees(el)+5.11))))/60);
151
-        if ($obs_set->el < 0) {
152
-            $obs_set->el = $el;  /*Reset to true elevation*/
153
-        }
154
-    }
28
+	/* Procedure Calculate_User_PosVel passes the user's geodetic position */
29
+	/* and the time of interest and returns the ECI position and velocity  */
30
+	/* of the observer. The velocity calculation assumes the geodetic      */
31
+	/* position is stationary relative to the earth's surface.             */
32
+	public static function Calculate_User_PosVel(
33
+		$_time, Predict_Geodetic $geodetic, Predict_Vector $obs_pos, Predict_Vector $obs_vel
34
+	)
35
+	{
36
+		/* Reference:  The 1992 Astronomical Almanac, page K11. */
37
+
38
+		$sinGeodeticLat = sin($geodetic->lat); /* Only run sin($geodetic->lat) once */
39
+
40
+		$geodetic->theta = Predict_Math::FMod2p(Predict_Time::ThetaG_JD($_time) + $geodetic->lon);/*LMST*/
41
+		$c = 1 / sqrt(1 + Predict::__f * (Predict::__f - 2) * $sinGeodeticLat * $sinGeodeticLat);
42
+		$sq = (1 - Predict::__f) * (1 - Predict::__f) * $c;
43
+		$achcp = (Predict::xkmper * $c + $geodetic->alt) * cos($geodetic->lat);
44
+		$obs_pos->x = $achcp * cos($geodetic->theta); /*kilometers*/
45
+		$obs_pos->y = $achcp * sin($geodetic->theta);
46
+		$obs_pos->z = (Predict::xkmper * $sq + $geodetic->alt) * $sinGeodeticLat;
47
+		$obs_vel->x = -Predict::mfactor * $obs_pos->y; /*kilometers/second*/
48
+		$obs_vel->y =  Predict::mfactor * $obs_pos->x;
49
+		$obs_vel->z =  0;
50
+		$obs_pos->w = sqrt($obs_pos->x * $obs_pos->x + $obs_pos->y * $obs_pos->y + $obs_pos->z * $obs_pos->z);
51
+		$obs_vel->w = sqrt($obs_vel->x * $obs_vel->x + $obs_vel->y * $obs_vel->y + $obs_vel->z * $obs_vel->z);
52
+	}
53
+
54
+	/* Procedure Calculate_LatLonAlt will calculate the geodetic  */
55
+	/* position of an object given its ECI position pos and time. */
56
+	/* It is intended to be used to determine the ground track of */
57
+	/* a satellite.  The calculations  assume the earth to be an  */
58
+	/* oblate spheroid as defined in WGS '72.                     */
59
+	public static function Calculate_LatLonAlt($_time, Predict_Vector $pos,  Predict_Geodetic $geodetic)
60
+	{
61
+		/* Reference:  The 1992 Astronomical Almanac, page K12. */
62
+
63
+		/* double r,e2,phi,c; */
64
+
65
+		$geodetic->theta = Predict_Math::AcTan($pos->y, $pos->x); /*radians*/
66
+		$geodetic->lon = Predict_Math::FMod2p($geodetic->theta - Predict_Time::ThetaG_JD($_time)); /*radians*/
67
+		$r = sqrt(($pos->x * $pos->x) + ($pos->y * $pos->y));
68
+		$e2 = Predict::__f * (2 - Predict::__f);
69
+		$geodetic->lat = Predict_Math::AcTan($pos->z, $r); /*radians*/
70
+
71
+		do {
72
+			$phi    = $geodetic->lat;
73
+			$sinPhi = sin($phi);
74
+			$c      = 1 / sqrt(1 - $e2 * ($sinPhi * $sinPhi));
75
+			$geodetic->lat = Predict_Math::AcTan($pos->z + Predict::xkmper * $c * $e2 * $sinPhi, $r);
76
+		} while (abs($geodetic->lat - $phi) >= 1E-10);
77
+
78
+		$geodetic->alt = $r / cos($geodetic->lat) - Predict::xkmper * $c;/*kilometers*/
79
+
80
+		if ($geodetic->lat > Predict::pio2) {
81
+			$geodetic->lat -= Predict::twopi;
82
+		}
83
+	}
84
+
85
+	/* The procedures Calculate_Obs and Calculate_RADec calculate         */
86
+	/* the *topocentric* coordinates of the object with ECI position,     */
87
+	/* {pos}, and velocity, {vel}, from location {geodetic} at {time}.    */
88
+	/* The {obs_set} returned for Calculate_Obs consists of azimuth,      */
89
+	/* elevation, range, and range rate (in that order) with units of     */
90
+	/* radians, radians, kilometers, and kilometers/second, respectively. */
91
+	/* The WGS '72 geoid is used and the effect of atmospheric refraction */
92
+	/* (under standard temperature and pressure) is incorporated into the */
93
+	/* elevation calculation; the effect of atmospheric refraction on     */
94
+	/* range and range rate has not yet been quantified.                  */
95
+
96
+	/* The {obs_set} for Calculate_RADec consists of right ascension and  */
97
+	/* declination (in that order) in radians.  Again, calculations are   */
98
+	/* based on *topocentric* position using the WGS '72 geoid and        */
99
+	/* incorporating atmospheric refraction.                              */
100
+	public static function Calculate_Obs($_time, Predict_Vector $pos, Predict_Vector $vel, Predict_Geodetic $geodetic, Predict_ObsSet $obs_set)
101
+	{
102
+		$obs_pos = new Predict_Vector();
103
+		$obs_vel = new Predict_Vector();
104
+		$range   = new Predict_Vector();
105
+		$rgvel   = new Predict_Vector();
106
+
107
+		self::Calculate_User_PosVel($_time, $geodetic, $obs_pos, $obs_vel);
108
+
109
+		$range->x = $pos->x - $obs_pos->x;
110
+		$range->y = $pos->y - $obs_pos->y;
111
+		$range->z = $pos->z - $obs_pos->z;
112
+
113
+		$rgvel->x = $vel->x - $obs_vel->x;
114
+		$rgvel->y = $vel->y - $obs_vel->y;
115
+		$rgvel->z = $vel->z - $obs_vel->z;
116
+
117
+		$range->w = sqrt($range->x * $range->x + $range->y * $range->y + $range->z * $range->z);
118
+
119
+		$sin_lat   = sin($geodetic->lat);
120
+		$cos_lat   = cos($geodetic->lat);
121
+		$sin_theta = sin($geodetic->theta);
122
+		$cos_theta = cos($geodetic->theta);
123
+		$top_s = $sin_lat * $cos_theta * $range->x
124
+			+ $sin_lat * $sin_theta * $range->y
125
+			- $cos_lat * $range->z;
126
+		$top_e = -$sin_theta * $range->x
127
+			+ $cos_theta * $range->y;
128
+		$top_z = $cos_lat * $cos_theta * $range->x
129
+			+ $cos_lat * $sin_theta * $range->y
130
+			+ $sin_lat * $range->z;
131
+		$azim = atan(-$top_e / $top_s); /*Azimuth*/
132
+		if ($top_s > 0) {
133
+			$azim = $azim + Predict::pi;
134
+		}
135
+		if ($azim < 0 ) {
136
+			$azim = $azim + Predict::twopi;
137
+		}
138
+		$el = Predict_Math::ArcSin($top_z / $range->w);
139
+		$obs_set->az = $azim;        /* Azimuth (radians)  */
140
+		$obs_set->el = $el;          /* Elevation (radians)*/
141
+		$obs_set->range = $range->w; /* Range (kilometers) */
142
+
143
+		/* Range Rate (kilometers/second)*/
144
+		$obs_set->range_rate = Predict_Math::Dot($range, $rgvel) / $range->w;
145
+
146
+		/* Corrections for atmospheric refraction */
147
+		/* Reference:  Astronomical Algorithms by Jean Meeus, pp. 101-104    */
148
+		/* Correction is meaningless when apparent elevation is below horizon */
149
+		//	obs_set->el = obs_set->el + Radians((1.02/tan(Radians(Degrees(el)+
150
+		//							      10.3/(Degrees(el)+5.11))))/60);
151
+		if ($obs_set->el < 0) {
152
+			$obs_set->el = $el;  /*Reset to true elevation*/
153
+		}
154
+	}
155 155
 }
Please login to merge, or discard this patch.
install/populate_all.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,48 +1,48 @@
 block discarded – undo
1 1
 #!/usr/bin/php
2 2
 <?php
3
-    require_once('../require/settings.php');
4
-    if ($globalInstalled) {
5
-        echo '$globalInstalled must be set to FALSE in require/settings.php';
6
-        exit;
7
-    }
8
-    require('class.update_db.php');
9
-    echo "Populate all tables...\n";
10
-    update_db::update_all();
11
-    echo "\nInstall waypoints...(VERY slow!)";
12
-    update_db::update_waypoints();
13
-    echo "Done !\n";
14
-    echo "Install airspace...";
15
-    update_db::update_airspace();
16
-    echo "Done !\n";
17
-    echo "Install countries...";
18
-    update_db::update_countries();
19
-    echo "Done !\n";
20
-    if (isset($globalOwner) && $globalOwner) {
3
+	require_once('../require/settings.php');
4
+	if ($globalInstalled) {
5
+		echo '$globalInstalled must be set to FALSE in require/settings.php';
6
+		exit;
7
+	}
8
+	require('class.update_db.php');
9
+	echo "Populate all tables...\n";
10
+	update_db::update_all();
11
+	echo "\nInstall waypoints...(VERY slow!)";
12
+	update_db::update_waypoints();
13
+	echo "Done !\n";
14
+	echo "Install airspace...";
15
+	update_db::update_airspace();
16
+	echo "Done !\n";
17
+	echo "Install countries...";
18
+	update_db::update_countries();
19
+	echo "Done !\n";
20
+	if (isset($globalOwner) && $globalOwner) {
21 21
 	echo "Install private owners...";
22 22
 	update_db::update_owner();
23
-        echo "Done !\n";
24
-    }
25
-    /*
23
+		echo "Done !\n";
24
+	}
25
+	/*
26 26
     if (isset($globalIVAO) && $globalIVAO) {
27 27
         echo "Install IVAO airlines and logos...";
28 28
         update_db::update_IVAO();
29 29
 	echo "Done !\n";
30 30
     }
31 31
     */
32
-    if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
32
+	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
33 33
 	echo "Install NOTAM from notaminfo.com...";
34
-        update_db:update_notam();
35
-        echo "Done !\n";
36
-    }
37
-    if (isset($globalMap3D) && $globalMap3D) {
34
+		update_db:update_notam();
35
+		echo "Done !\n";
36
+	}
37
+	if (isset($globalMap3D) && $globalMap3D) {
38 38
 	echo "Install 3D models...";
39 39
 	update_db::update_models();
40 40
 	echo "Done !\n";
41 41
 	if (isset($globalMapSatellites) && $globalMapSatellites) {
42
-	    echo "Install Space 3D models...";
43
-	    update_db::update_space_models();
44
-	    echo "Done !\n";
45
-        }
46
-    }
42
+		echo "Install Space 3D models...";
43
+		update_db::update_space_models();
44
+		echo "Done !\n";
45
+		}
46
+	}
47 47
 
48 48
 ?>
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
airport-data.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -47,79 +47,79 @@
 block discarded – undo
47 47
 print '</div>';
48 48
 print '<div><span>'._("Altitude").'</span>';
49 49
 if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
50
-        print $spotter_item['altitude'].' feet';
50
+		print $spotter_item['altitude'].' feet';
51 51
 } else {
52
-        print round($spotter_item['altitude']*0.3048).' m';
52
+		print round($spotter_item['altitude']*0.3048).' m';
53 53
 }
54 54
 print '</div>';
55 55
 print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>';
56 56
 print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],3).', '.round($spotter_item['longitude'],3).'</div>';
57 57
 if (isset($spotter_item['home_link']) && $spotter_item['home_link'] != '' && isset($spotter_item['wikipedia_link']) && $spotter_item['wikipedia_link'] != '') {
58
-    print '<div><span>'._("Links").'</span>';
59
-    print '<a href="'.$spotter_item['home_link'].'">'._("Homepage").'</a>';
60
-    print ' - ';
61
-    print '<a href="'.$spotter_item['wikipedia_link'].'">Wikipedia</a>';
62
-    print '</div>';
58
+	print '<div><span>'._("Links").'</span>';
59
+	print '<a href="'.$spotter_item['home_link'].'">'._("Homepage").'</a>';
60
+	print ' - ';
61
+	print '<a href="'.$spotter_item['wikipedia_link'].'">Wikipedia</a>';
62
+	print '</div>';
63 63
 } elseif (isset($spotter_item['home_link']) && $spotter_item['home_link'] != '') {
64
-    print '<div><span>'._("Links").'</span>';
65
-    print '<a href="'.$spotter_item['home_link'].'">'._("Homepage").'</a>';
66
-    print '</div>';
64
+	print '<div><span>'._("Links").'</span>';
65
+	print '<a href="'.$spotter_item['home_link'].'">'._("Homepage").'</a>';
66
+	print '</div>';
67 67
 } elseif (isset($spotter_item['wikipedia_link']) && $spotter_item['wikipedia_link'] != '') {
68
-    print '<div><span>'._("Links").'</span>';
69
-    print '<a href="'.$spotter_item['wikipedia_link'].'">Wikipedia</a>';
70
-    print '</div>';
68
+	print '<div><span>'._("Links").'</span>';
69
+	print '<a href="'.$spotter_item['wikipedia_link'].'">Wikipedia</a>';
70
+	print '</div>';
71 71
 }
72 72
 if ($spotter_item['type'] == 'medium_airport' || $spotter_item['type'] == 'large_airport') {
73
-    print '<div><span>'._("Live Air Traffic").'</span>';
74
-    print '<a href="http://www.liveatc.net/search/?icao='.$spotter_item['icao'].'">LiveATC</a>';
75
-    print '</div>';
73
+	print '<div><span>'._("Live Air Traffic").'</span>';
74
+	print '<a href="http://www.liveatc.net/search/?icao='.$spotter_item['icao'].'">LiveATC</a>';
75
+	print '</div>';
76 76
 }
77 77
 
78 78
 print '</div>';
79 79
 
80 80
 if (isset($metar_parse)) {
81
-    print '<div class="waypoints">';
82
-    print '<div><span>METAR</span>';
83
-    print '<i>'.$metar_info[0]['metar'].'</i><br />';
84
-    print '<b>'.$metar_info[0]['metar_date'].'</b><br />';
81
+	print '<div class="waypoints">';
82
+	print '<div><span>METAR</span>';
83
+	print '<i>'.$metar_info[0]['metar'].'</i><br />';
84
+	print '<b>'.$metar_info[0]['metar_date'].'</b><br />';
85 85
 //    print_r($metar_parse);
86
-    if (isset($metar_parse['wind'])) {
87
-        print _("Wind:").' ';
86
+	if (isset($metar_parse['wind'])) {
87
+		print _("Wind:").' ';
88 88
 	if (isset($metar_parse['wind']['direction'])) {
89
-	    $direction = $Spotter->parseDirection($metar_parse['wind']['direction']);
90
-	    print $direction[0]['direction_fullname'];
91
-	    print ' ('.$metar_parse['wind']['direction'].'°) ';
92
-        }
93
-        if (isset($metar_parse['wind']['speed'])) {
94
-	    print $metar_parse['wind']['speed'].' m/s';
95
-        }
89
+		$direction = $Spotter->parseDirection($metar_parse['wind']['direction']);
90
+		print $direction[0]['direction_fullname'];
91
+		print ' ('.$metar_parse['wind']['direction'].'°) ';
92
+		}
93
+		if (isset($metar_parse['wind']['speed'])) {
94
+		print $metar_parse['wind']['speed'].' m/s';
95
+		}
96 96
 	print '<br/>';
97
-    }
98
-    if (isset($metar_parse['visibility'])) {
99
-        print _("Visibility:").' '.$metar_parse['visibility'].' m'."<br/>";
100
-    }
101
-    if (isset($metar_parse['weather'])) {
102
-        print _("Weather:").' '.$metar_parse['weather']."<br/>";
103
-    }
104
-    if (isset($metar_parse['temperature'])) {
105
-        print _("Temperature:").' '.$metar_parse['temperature'].' °C'."<br/>";
106
-    }
107
-    if (isset($metar_parse['dew'])) {
108
-        print _("Dew point:").' '.$metar_parse['dew'].' °C'."<br/>";
109
-    }
110
-    if (isset($metar_parse['temperature']) && isset($metar_parse['dew'])) {
97
+	}
98
+	if (isset($metar_parse['visibility'])) {
99
+		print _("Visibility:").' '.$metar_parse['visibility'].' m'."<br/>";
100
+	}
101
+	if (isset($metar_parse['weather'])) {
102
+		print _("Weather:").' '.$metar_parse['weather']."<br/>";
103
+	}
104
+	if (isset($metar_parse['temperature'])) {
105
+		print _("Temperature:").' '.$metar_parse['temperature'].' °C'."<br/>";
106
+	}
107
+	if (isset($metar_parse['dew'])) {
108
+		print _("Dew point:").' '.$metar_parse['dew'].' °C'."<br/>";
109
+	}
110
+	if (isset($metar_parse['temperature']) && isset($metar_parse['dew'])) {
111 111
 	$humidity = round(100 * pow((112 - (0.1 * $metar_parse['temperature']) + $metar_parse['dew']) / (112 + (0.9 * $metar_parse['temperature'])), 8),1);
112 112
 	print _("Humidity:").' '.$humidity.'%'."<br/>";
113
-    }
114
-    if (isset($metar_parse['QNH'])) {
115
-        print _("Pressure:").' '.$metar_parse['QNH'].' hPa'."<br/>";
116
-    }
113
+	}
114
+	if (isset($metar_parse['QNH'])) {
115
+		print _("Pressure:").' '.$metar_parse['QNH'].' hPa'."<br/>";
116
+	}
117 117
 /*
118 118
 if (isset($metar_parse['QNH'])) {
119 119
     print 'Pressure : '.$metar_parse['QNH'].' hPa'."<br/>";
120 120
 }
121 121
 */
122
-    print '</div>';
122
+	print '</div>';
123 123
 /*
124 124
 Wind: from the NNE (020 degrees) at 5 MPH (4 KT) (direction variable):0
125 125
 Visibility: greater than 7 mile(s):0
Please login to merge, or discard this patch.