MISR Toolkit
1.5.1
MapQuery
src
MtkLSToSomXY.c
Go to the documentation of this file.
1
/*===========================================================================
2
= =
3
= MtkLSToSomXY =
4
= =
5
=============================================================================
6
7
Jet Propulsion Laboratory
8
MISR
9
MISR Toolkit
10
11
Copyright 2005, California Institute of Technology.
12
ALL RIGHTS RESERVED.
13
U.S. Government Sponsorship acknowledged.
14
15
============================================================================*/
16
17
#include "
MisrMapQuery.h
"
18
#include "
MisrError.h
"
19
33
MTKt_status
MtkLSToSomXY
(
34
MTKt_MapInfo
mapinfo,
35
float
line,
36
float
sample,
37
double
*som_x,
38
double
*som_y )
39
{
40
MTKt_status
status_code;
/* Return status of this function */
41
42
if
(som_x == NULL || som_y == NULL)
43
MTK_ERR_CODE_JUMP
(
MTK_NULLPTR
);
44
45
/* Check argument bounds */
46
if
(line < -0.5 || line > mapinfo.
nline
- 0.5)
47
MTK_ERR_CODE_JUMP
(
MTK_OUTBOUNDS
);
48
if
(sample < -0.5 || sample > mapinfo.
nsample
- 0.5)
49
MTK_ERR_CODE_JUMP
(
MTK_OUTBOUNDS
);
50
51
/* Determine som x/y from ulc and line/sample and resolution */
52
*som_x = mapinfo.
som
.
ulc
.
x
+ line * mapinfo.
resolution
;
53
*som_y = mapinfo.
som
.
ulc
.
y
+ sample * mapinfo.
resolution
;
54
55
return
MTK_SUCCESS
;
56
57
ERROR_HANDLE:
58
if
(status_code !=
MTK_NULLPTR
)
59
{
60
*som_x = -1e-9;
61
*som_y = -1e-9;
62
}
63
return
status_code;
64
}
MTK_NULLPTR
Definition:
MisrError.h:19
MTKt_SomCoord::y
double y
Definition:
MisrMapQuery.h:35
MTK_ERR_CODE_JUMP
#define MTK_ERR_CODE_JUMP(code)
Definition:
MisrError.h:175
MTKt_MapInfo
Map Information.
Definition:
MisrMapQuery.h:65
MTK_SUCCESS
Definition:
MisrError.h:12
MTK_OUTBOUNDS
Definition:
MisrError.h:14
MTKt_SomCoord::x
double x
Definition:
MisrMapQuery.h:34
MisrError.h
MtkLSToSomXY
MTKt_status MtkLSToSomXY(MTKt_MapInfo mapinfo, float line, float sample, double *som_x, double *som_y)
Convert line, sample to SOM X, SOM Y.
Definition:
MtkLSToSomXY.c:33
MTKt_MapInfo::nsample
int nsample
Definition:
MisrMapQuery.h:72
MisrMapQuery.h
MTKt_status
MTKt_status
Definition:
MisrError.h:11
MTKt_MapInfo::som
MTKt_SomRegion som
Definition:
MisrMapQuery.h:74
MTKt_MapInfo::nline
int nline
Definition:
MisrMapQuery.h:71
MTKt_MapInfo::resolution
int resolution
Definition:
MisrMapQuery.h:69
MTKt_SomRegion::ulc
MTKt_SomCoord ulc
Definition:
MisrMapQuery.h:56
MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:51