@@ -25,7 +25,7 @@ PG_FUNCTION_INFO_V1(epoch_prop);
25
25
/* A_nu as per ESA/SP-1200 */
26
26
#define A_NU (AU/(J_YEAR))
27
27
28
- /* Following SOFA, we use 1e-7 arcsec as minimal parallax
28
+ /* Following SOFA, we use 1e-7 arcsec as minimal parallax
29
29
("celestial sphere"); parallax=0 exactly means "infinite distance", which
30
30
leads to all sorts for problems; our parallaxes come in in mas, so: */
31
31
#define PX_MIN 1e-7*1000
@@ -59,11 +59,11 @@ static void propagate_phasevec(
59
59
spoint_vector3d (& r0 , & (pv -> pos ));
60
60
61
61
p0 .x = - sin (pv -> pos .lng );
62
- p0 .y = cos (pv -> pos .lng );
62
+ p0 .y = cos (pv -> pos .lng );
63
63
p0 .z = 0 ;
64
64
65
65
q0 .x = - sin (pv -> pos .lat ) * cos (pv -> pos .lng );
66
- q0 .y = - sin (pv -> pos .lat ) * sin (pv -> pos .lng );
66
+ q0 .y = - sin (pv -> pos .lat ) * sin (pv -> pos .lng );
67
67
q0 .z = cos (pv -> pos .lat );
68
68
69
69
/* the original proper motion vector */
@@ -117,25 +117,25 @@ static void propagate_phasevec(
117
117
}
118
118
119
119
120
- /*
120
+ /*
121
121
Propagate a position with proper motions and optionally parallax
122
122
and radial velocity.
123
123
124
124
Arguments: pos0 (spoint), pm_long, pm_lat (in rad/yr)
125
- par (parallax, mas), rv (in km/s), delta_t (in years)
125
+ par (parallax, mas), rv (in km/s), delta_t (in years)
126
126
127
127
This returns a 6-array of lat, long (in rad), parallax (in mas)
128
128
pmlat, pmlong (in rad/yr), rv (in km/s).
129
129
*/
130
- Datum
130
+ Datum
131
131
epoch_prop (PG_FUNCTION_ARGS ) {
132
132
double delta_t ;
133
133
phasevec input , output ;
134
134
ArrayType * result ;
135
135
Datum retvals [6 ];
136
136
137
137
if (PG_ARGISNULL (0 )) {
138
- ereport (ERROR ,
138
+ ereport (ERROR ,
139
139
(errcode (ERRCODE_NULL_VALUE_NOT_ALLOWED ),
140
140
errmsg ("NULL position not supported in epoch propagation" ))); }
141
141
memcpy (& (input .pos ), (void * )PG_GETARG_POINTER (0 ), sizeof (SPoint ));
@@ -164,6 +164,10 @@ epoch_prop(PG_FUNCTION_ARGS) {
164
164
input .rv = PG_GETARG_FLOAT8 (4 );
165
165
}
166
166
167
+ if (PG_ARGISNULL (5 )) {
168
+ ereport (ERROR ,
169
+ (errcode (ERRCODE_NULL_VALUE_NOT_ALLOWED ),
170
+ errmsg ("NULL delta t not supported in epoch propagation" ))); }
167
171
delta_t = PG_GETARG_FLOAT8 (5 );
168
172
169
173
propagate_phasevec (& input , delta_t , & output );
0 commit comments