MISR Toolkit
1.5.1
MapQuery
src
MtkSomXYToLS.c
Go to the documentation of this file.
1
/*===========================================================================
2
= =
3
= MtkSomXYToLS =
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
32
MTKt_status
MtkSomXYToLS
(
33
MTKt_MapInfo
mapinfo,
34
double
som_x,
35
double
som_y,
36
float
*line,
37
float
*sample )
38
{
39
MTKt_status
status_code;
/* Return status of this function */
40
41
if
(line == NULL || sample == NULL)
42
MTK_ERR_CODE_JUMP
(
MTK_NULLPTR
);
43
44
/* Determine line/sample from ulc som x/y and resolution */
45
*line = (float)((som_x - mapinfo.
som
.
ulc
.
x
) / mapinfo.
resolution
);
46
*sample = (float)((som_y - mapinfo.
som
.
ulc
.
y
) / mapinfo.
resolution
);
47
48
/* Check line/sample bounds */
49
if
(*line < -0.5 || *line > mapinfo.
nline
- 0.5)
50
MTK_ERR_CODE_JUMP
(
MTK_OUTBOUNDS
);
51
if
(*sample < -0.5 || *sample > mapinfo.
nsample
- 0.5)
52
MTK_ERR_CODE_JUMP
(
MTK_OUTBOUNDS
);
53
54
return
MTK_SUCCESS
;
55
ERROR_HANDLE:
56
if
(status_code !=
MTK_NULLPTR
)
57
{
58
*line = -1.0;
59
*sample = -1.0;
60
}
61
return
status_code;
62
}
MtkSomXYToLS
MTKt_status MtkSomXYToLS(MTKt_MapInfo mapinfo, double som_x, double som_y, float *line, float *sample)
Convert SOM X, SOM Y to line, sample.
Definition:
MtkSomXYToLS.c:32
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
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