Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
Usgscsm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aflab
astrogeology
Usgscsm
Commits
eb2efc7b
Commit
eb2efc7b
authored
Feb 18, 2019
by
Jesse Mapel
Committed by
jlaura
Feb 18, 2019
Browse files
Options
Downloads
Patches
Plain Diff
Copied unit conversion from framer to ls (#177)
parent
aaafa013
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/UsgsAstroLsSensorModel.cpp
+52
-17
52 additions, 17 deletions
src/UsgsAstroLsSensorModel.cpp
with
52 additions
and
17 deletions
src/UsgsAstroLsSensorModel.cpp
+
52
−
17
View file @
eb2efc7b
...
@@ -2512,6 +2512,18 @@ double UsgsAstroLsSensorModel::determinant3x3(double mat[9]) const
...
@@ -2512,6 +2512,18 @@ double UsgsAstroLsSensorModel::determinant3x3(double mat[9]) const
std
::
string
UsgsAstroLsSensorModel
::
constructStateFromIsd
(
const
std
::
string
imageSupportData
,
csm
::
WarningList
*
warnings
)
const
std
::
string
UsgsAstroLsSensorModel
::
constructStateFromIsd
(
const
std
::
string
imageSupportData
,
csm
::
WarningList
*
warnings
)
const
{
{
auto
metric_conversion
=
[](
double
val
,
std
::
string
from
,
std
::
string
to
=
"m"
)
{
json
typemap
=
{
{
"m"
,
0
},
{
"km"
,
3
}
};
// everything to lowercase
std
::
transform
(
from
.
begin
(),
from
.
end
(),
from
.
begin
(),
::
tolower
);
std
::
transform
(
to
.
begin
(),
to
.
end
(),
to
.
begin
(),
::
tolower
);
return
val
*
pow
(
10
,
typemap
[
from
].
get
<
int
>
()
-
typemap
[
to
].
get
<
int
>
());
};
// Instantiate UsgsAstroLineScanner sensor model
// Instantiate UsgsAstroLineScanner sensor model
json
isd
=
json
::
parse
(
imageSupportData
);
json
isd
=
json
::
parse
(
imageSupportData
);
json
state
;
json
state
;
...
@@ -2557,16 +2569,22 @@ std::string UsgsAstroLsSensorModel::constructStateFromIsd(const std::string imag
...
@@ -2557,16 +2569,22 @@ std::string UsgsAstroLsSensorModel::constructStateFromIsd(const std::string imag
state
[
"m_numEphem"
]
=
isd
.
at
(
"sensor_position"
).
at
(
"positions"
).
size
();
state
[
"m_numEphem"
]
=
isd
.
at
(
"sensor_position"
).
at
(
"positions"
).
size
();
state
[
"m_numQuaternions"
]
=
isd
.
at
(
"sensor_orientation"
).
at
(
"quaternions"
).
size
();
state
[
"m_numQuaternions"
]
=
isd
.
at
(
"sensor_orientation"
).
at
(
"quaternions"
).
size
();
for
(
auto
&
location
:
isd
.
at
(
"sensor_position"
).
at
(
"positions"
))
{
{
state
[
"m_ephemPts"
].
push_back
(
location
[
0
]);
json
jayson
=
isd
.
at
(
"sensor_position"
);
state
[
"m_ephemPts"
].
push_back
(
location
[
1
]);
json
unit
=
jayson
.
at
(
"unit"
);
state
[
"m_ephemPts"
].
push_back
(
location
[
2
]);
unit
=
unit
.
get
<
std
::
string
>
();
for
(
auto
&
location
:
jayson
.
at
(
"positions"
))
{
state
[
"m_ephemPts"
].
push_back
(
metric_conversion
(
location
[
0
].
get
<
double
>
(),
unit
));
state
[
"m_ephemPts"
].
push_back
(
metric_conversion
(
location
[
1
].
get
<
double
>
(),
unit
));
state
[
"m_ephemPts"
].
push_back
(
metric_conversion
(
location
[
2
].
get
<
double
>
(),
unit
));
}
}
for
(
auto
&
velocity
:
isd
.
at
(
"sensor_position"
).
at
(
"velocities"
))
{
for
(
auto
&
velocity
:
jayson
.
at
(
"velocities"
))
{
state
[
"m_ephemRates"
].
push_back
(
velocity
[
0
]);
state
[
"m_ephemRates"
].
push_back
(
metric_conversion
(
velocity
[
0
].
get
<
double
>
(),
unit
));
state
[
"m_ephemRates"
].
push_back
(
velocity
[
1
]);
state
[
"m_ephemRates"
].
push_back
(
metric_conversion
(
velocity
[
1
].
get
<
double
>
(),
unit
));
state
[
"m_ephemRates"
].
push_back
(
velocity
[
2
]);
state
[
"m_ephemRates"
].
push_back
(
metric_conversion
(
velocity
[
2
].
get
<
double
>
(),
unit
));
}
}
}
for
(
auto
&
quaternion
:
isd
.
at
(
"sensor_orientation"
).
at
(
"quaternions"
))
{
for
(
auto
&
quaternion
:
isd
.
at
(
"sensor_orientation"
).
at
(
"quaternions"
))
{
...
@@ -2581,8 +2599,16 @@ std::string UsgsAstroLsSensorModel::constructStateFromIsd(const std::string imag
...
@@ -2581,8 +2599,16 @@ std::string UsgsAstroLsSensorModel::constructStateFromIsd(const std::string imag
// state["m_parameterVals"][15] = state["m_focal"].get<double>();
// state["m_parameterVals"][15] = state["m_focal"].get<double>();
// Set the ellipsoid
// Set the ellipsoid
state
[
"m_semiMajorAxis"
]
=
isd
.
at
(
"radii"
).
at
(
"semimajor"
);
{
state
[
"m_semiMinorAxis"
]
=
isd
.
at
(
"radii"
).
at
(
"semiminor"
);
json
jayson
=
isd
.
at
(
"radii"
);
json
semiminor
=
jayson
.
at
(
"semiminor"
);
json
semimajor
=
jayson
.
at
(
"semimajor"
);
json
unit
=
jayson
.
at
(
"unit"
);
unit
=
unit
.
get
<
std
::
string
>
();
state
[
"m_semiMajorAxis"
]
=
metric_conversion
(
semiminor
.
get
<
double
>
(),
unit
);
state
[
"m_semiMinorAxis"
]
=
metric_conversion
(
semimajor
.
get
<
double
>
(),
unit
);
}
// Now finish setting the state data from the ISD read in
// Now finish setting the state data from the ISD read in
...
@@ -2594,9 +2620,18 @@ std::string UsgsAstroLsSensorModel::constructStateFromIsd(const std::string imag
...
@@ -2594,9 +2620,18 @@ std::string UsgsAstroLsSensorModel::constructStateFromIsd(const std::string imag
state
[
"m_collectionIdentifier"
]
=
"UNKNOWN"
;
state
[
"m_collectionIdentifier"
]
=
"UNKNOWN"
;
// Ground elevations
// Ground elevations
{
json
reference_height
=
isd
.
at
(
"reference_height"
);
json
maxheight
=
reference_height
.
at
(
"maxheight"
);
json
minheight
=
reference_height
.
at
(
"minheight"
);
json
unit
=
reference_height
.
at
(
"unit"
);
unit
=
unit
.
get
<
std
::
string
>
();
state
[
"m_refElevation"
]
=
0.0
;
state
[
"m_refElevation"
]
=
0.0
;
state
[
"m_minElevation"
]
=
isd
.
at
(
"reference_height"
).
at
(
"minheight"
);
state
[
"m_minElevation"
]
=
metric_conversion
(
minheight
.
get
<
double
>
(),
unit
);
state
[
"m_maxElevation"
]
=
isd
.
at
(
"reference_height"
).
at
(
"maxheight"
);
state
[
"m_maxElevation"
]
=
metric_conversion
(
maxheight
.
get
<
double
>
(),
unit
);
}
// Zero ateter values
// Zero ateter values
for
(
int
i
=
0
;
i
<
NUM_PARAMETERS
;
i
++
)
{
for
(
int
i
=
0
;
i
<
NUM_PARAMETERS
;
i
++
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment