Skip to content

Commit 02be345

Browse files
gshiromaGitHub Enterprise
authored andcommitted
Change direction of the LOS vector and update unitest (#710)
* change direction of the LOS vector and update unitest * update docstrings
1 parent 4cd0865 commit 02be345

File tree

4 files changed

+34
-25
lines changed

4 files changed

+34
-25
lines changed

cxx/isce3/geometry/metadataCubes.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ static inline void writeVectorDerivedCubes(const int array_pos_i,
101101

102102
// Create target-to-sat vector in ECEF
103103
const isce3::core::Vec3 look_vector_xyz =
104-
(target_xyz - sat_xyz).normalized();
104+
(sat_xyz - target_xyz).normalized();
105105

106106
// Compute elevation angle calculated in ECEF (geocentric)
107107
if (elevation_angle_raster != nullptr) {
108108
const double cos_elevation =
109-
sat_xyz.dot(-look_vector_xyz) / sat_xyz.norm();
109+
sat_xyz.dot(look_vector_xyz) / sat_xyz.norm();
110110
elevation_angle_array(i, j) = std::acos(cos_elevation) * 180.0 / M_PI;
111111
}
112112

@@ -167,7 +167,7 @@ static inline void writeVectorDerivedCubes(const int array_pos_i,
167167

168168
// Compute target-to-sat vector (proj)
169169
const isce3::core::Vec3 look_vector_proj =
170-
(target_proj - sat_proj).normalized();
170+
(sat_proj - target_proj).normalized();
171171

172172
// LOS unit vector X (proj)
173173
if (los_unit_vector_x_raster != nullptr) {

cxx/isce3/geometry/metadataCubes.h

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ namespace isce3 { namespace geometry {
2222
* @param[in] proj Output projection
2323
* @param[out] incidence_angle_raster Incidence angle cube raster
2424
* @param[out] incidence_angle_array Incidence angle cube array
25-
* @param[out] los_unit_vector_x_raster LOS unit vector X cube raster
26-
* @param[out] los_unit_vector_x_array LOS unit vector X cube array
27-
* @param[out] los_unit_vector_y_raster LOS unit vector Y cube raster
28-
* @param[out] los_unit_vector_y_array LOS unit vector Y cube array
25+
* @param[out] los_unit_vector_x_raster LOS (target-to-sensor) unit
26+
* vector X cube raster
27+
* @param[out] los_unit_vector_x_array LOS (target-to-sensor) unit
28+
* vector X cube array
29+
* @param[out] los_unit_vector_y_raster LOS (target-to-sensor) unit
30+
* vector Y cube raster
31+
* @param[out] los_unit_vector_y_array LOS (target-to-sensor) unit
32+
* vector Y cube array
2933
* @param[out] along_track_unit_vector_x_raster Along-track unit vector X raster
3034
* @param[out] along_track_unit_vector_x_array Along-track unit vector X array
3135
* @param[out] along_track_unit_vector_y_raster Along-track unit vector Y raster
@@ -90,14 +94,16 @@ static inline void writeVectorDerivedCubes(
9094
* cube raster
9195
* @param[out] incidence_angle_raster Incidence angle (in degrees wrt
9296
* ellipsoid normal at target) cube raster
93-
* @param[out] los_unit_vector_x_raster LOS unit vector X cube raster
94-
* @param[out] los_unit_vector_y_raster LOS unit vector Y cube raster
97+
* @param[out] los_unit_vector_x_raster LOS (target-to-sensor) unit vector
98+
* X cube raster
99+
* @param[out] los_unit_vector_y_raster LOS (target-to-sensor) unit vector
100+
* Y cube raster
95101
* @param[out] along_track_unit_vector_x_raster Along-track unit vector X
96102
* cube raster
97103
* @param[out] along_track_unit_vector_y_raster Along-track unit vector Y
98104
* cube raster
99105
* @param[out] elevation_angle_raster Elevation angle (in degrees wrt
100-
* geocentric nadir) cube raster
106+
* geodedic nadir) cube raster
101107
* @param[in] threshold_geo2rdr Range threshold for geo2rdr
102108
* @param[in] numiter_geo2rdr Geo2rdr maximum number of iterations
103109
* @param[in] delta_range Step size used for computing
@@ -154,17 +160,20 @@ void makeRadarGridCubes(
154160
* @param[out] coordinate_y_raster Geolocation coordinage Y raster
155161
* @param[out] incidence_angle_raster Incidence angle (in degrees wrt
156162
* ellipsoid normal at target) cube raster
157-
* @param[out] los_unit_vector_x_raster LOS unit vector X cube raster
158-
* @param[out] los_unit_vector_y_raster LOS unit vector Y cube raster
163+
* @param[out] los_unit_vector_x_raster LOS (target-to-sensor) unit vector
164+
* X cube raster
165+
* @param[out] los_unit_vector_y_raster LOS (target-to-sensor) unit vector
166+
* Y cube raster
159167
* @param[out] along_track_unit_vector_x_raster Along-track unit vector X
160168
* cube raster
161169
* @param[out] along_track_unit_vector_y_raster Along-track unit vector Y
162170
* cube raster
163171
* @param[out] elevation_angle_raster Elevation angle (in degrees wrt
164-
* geocentric nadir) cube raster
172+
* geodedic nadir) cube raster
165173
* @param[in] threshold_geo2rdr Range threshold for geo2rdr
166174
* @param[in] numiter_geo2rdr Geo2rdr maximum number of iterations
167-
* @param[in] delta_range Step size used for computing derivative of doppler
175+
* @param[in] delta_range Step size used for computing
176+
* derivative of doppler
168177
*/
169178
void makeGeolocationGridCubes(
170179
const isce3::product::RadarGridParameters& radar_grid,

python/extensions/pybind_isce3/geometry/metadataCubes.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ void addbinding_metadata_cubes(py::module & m)
7070
Incidence angle (in degrees wrt ellipsoid normal at target)
7171
cube raster
7272
los_unit_vector_x_raster : isce3.io.Raster, optional
73-
LOS unit vector X cube raster
73+
LOS (target-to-sensor) unit vector X cube raster
7474
los_unit_vector_y_raster : isce3.io.Raster, optional
75-
LOS unit vector Y cube raster
75+
LOS (target-to-sensor) unit vector Y cube raster
7676
along_track_unit_vector_x_raster : isce3.io.Raster, optional
7777
Along-track unit vector X raster
7878
along_track_unit_vector_y_raster : isce3.io.Raster, optional
7979
Along-track unit vector Y raster
8080
elevation_angle_raster : isce3.io.Raster, optional
81-
Elevation angle (in degrees wrt geocentric nadir) cube raster
81+
Elevation angle (in degrees wrt geodedic nadir) cube raster
8282
threshold_geo2rdr : double, optional
8383
Range threshold for geo2rdr
8484
numiter_geo2rdr : int, optional
@@ -152,15 +152,15 @@ void addbinding_metadata_cubes(py::module & m)
152152
Incidence angle (in degrees wrt ellipsoid normal at target)
153153
cube raster
154154
los_unit_vector_x_raster : isce3.io.Raster, optional
155-
LOS unit vector X cube raster
155+
LOS (target-to-sensor) unit vector X cube raster
156156
los_unit_vector_y_raster : isce3.io.Raster, optional
157-
LOS unit vector Y cube raster
157+
LOS (target-to-sensor) unit vector Y cube raster
158158
along_track_unit_vector_x_raster : isce3.io.Raster, optional
159159
Along-track unit vector X raster
160160
along_track_unit_vector_y_raster : isce3.io.Raster, optional
161161
Along-track unit vector Y raster
162162
elevation_angle_raster : isce3.io.Raster, optional
163-
Elevation angle (in degrees wrt geocentric nadir) cube raster
163+
Elevation angle (in degrees wrt geodedic nadir) cube raster
164164
threshold_geo2rdr : double, optional
165165
Range threshold for geo2rdr
166166
numiter_geo2rdr : int, optional

tests/cxx/isce3/geometry/metadata_cubes/metadata_cubes.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ void _check_vectors(const isce3::product::GeoGridParameters& geogrid,
136136
los_unit_test[1] = los_unit_vector_y_array(i, j);
137137
/*
138138
Obtain height term considering that the vector is unitary
139-
the lign-of-sight vector points downwards (i.e. height term
140-
is negative)
139+
the lign-of-sight vector points upwards (i.e. height term
140+
is positive) from the target to the sensor.
141141
*/
142-
los_unit_test[2] = -std::sqrt(
142+
los_unit_test[2] = std::sqrt(
143143
std::max(0.0, 1.0 - std::pow(los_unit_test[0], 2) -
144144
std::pow(los_unit_test[1], 2)));
145145

@@ -149,13 +149,13 @@ void _check_vectors(const isce3::product::GeoGridParameters& geogrid,
149149
// For epsg == 4326, vectors are given in ENU
150150
const isce3::core::Vec3 los_xyz_test =
151151
enu2xyz.dot(los_unit_test).normalized();
152-
sat_xyz_test = target_xyz - slant_range_test * los_xyz_test;
152+
sat_xyz_test = target_xyz + slant_range_test * los_xyz_test;
153153

154154
} else {
155155
const isce3::core::Vec3 look_vector_test =
156156
slant_range_test * los_unit_test;
157157
const isce3::core::Vec3 sat_proj_test =
158-
target_proj - look_vector_test;
158+
target_proj + look_vector_test;
159159
sat_llh_test = proj->inverse(sat_proj_test);
160160
sat_xyz_test = ellipsoid.lonLatToXyz(sat_llh_test);
161161
}

0 commit comments

Comments
 (0)