MISR Toolkit
1.5.1
misrcoord
misrinv.c
Go to the documentation of this file.
1
#include "
misrproj.h
"
/* Prototype for this function */
2
#include "
errormacros.h
"
/* Error macros */
3
4
extern
int
nb
;
5
extern
int
nl_var
;
6
extern
int
ns
;
7
extern
float
absOffset
[
NBLOCK
];
8
extern
double
ulc
[2];
9
extern
double
lrc
[2];
10
extern
double
sx
;
11
extern
double
sy
;
12
extern
double
xc
;
13
extern
double
yc
;
14
15
#define FUNC_NAMEm "misrinv"
16
17
int
misrinv
(
18
const
int
block,
/* Input block */
19
const
float
line,
/* Input line */
20
const
float
sample,
/* Input sample */
21
double
* x,
/* Output SOM X coordinate */
22
double
* y
/* Output SOM Y coordinate */
23
)
24
{
25
int
n
;
/* Number of line to current block */
26
char
msg[
STRLEN
];
/* Warning message */
27
28
/* Check Arguments */
29
30
if
(block < 1 || block >
NBLOCK
) {
31
sprintf(msg,
"block is out of range (0 < %d < %d)"
, block,
nb
);
32
WRN_LOG_JUMP
(msg);
33
}
34
35
if
(line < -0.5 || line >
nl_var
- 0.5) {
36
sprintf(msg,
"line is out of range (0 < %e < %d)"
, line,
nl_var
);
37
WRN_LOG_JUMP
(msg);
38
}
39
40
if
(sample < -0.5 || sample >
ns
- 0.5) {
41
sprintf(msg,
"sample is out of range (0 < %e < %d)"
, sample,
ns
);
42
WRN_LOG_JUMP
(msg);
43
}
44
45
/* Compute SOM x/y coordinates in ulc/lrc units (meters) */
46
47
n = (int)((block - 1) *
nl_var
*
sx
);
48
*x = (double)(
xc
+ n + (line *
sx
));
49
*y = (double)(
yc
+ ((sample +
absOffset
[block-1]) *
sy
));
50
51
return
(0);
52
53
ERROR_HANDLE:
54
55
*x = -1e-9;
56
*y = -1e-9;
57
return
(1);
58
}
59
ns
int ns
Definition:
misr_init.c:6
nl_var
int nl_var
Definition:
misr_init.c:5
xc
double xc
Definition:
misr_init.c:13
absOffset
float absOffset[NBLOCK]
Definition:
misr_init.c:7
nb
int nb
Definition:
misr_init.c:4
STRLEN
#define STRLEN
Definition:
misrproj.h:6
lrc
double lrc[2]
Definition:
misr_init.c:10
sy
double sy
Definition:
misr_init.c:12
ulc
double ulc[2]
Definition:
misr_init.c:9
sx
double sx
Definition:
misr_init.c:11
WRN_LOG_JUMP
#define WRN_LOG_JUMP(msg)
Definition:
errormacros.h:32
NBLOCK
#define NBLOCK
Definition:
MisrProjParam.h:51
n
HDFFCLIBAPI _fcd _fcd intf * n
Definition:
hproto_fortran.h:1632
yc
double yc
Definition:
misr_init.c:14
misrinv
int misrinv(const int block, const float line, const float sample, double *x, double *y)
Definition:
misrinv.c:17
errormacros.h
misrproj.h
MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:51