MISR Toolkit  1.5.1
foo.c
Go to the documentation of this file.
1 /*===========================================================================
2 = =
3 = foo =
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 "MisrToolkit.h"
18 #include "MisrError.h"
19 #include <stdio.h>
20 
21 int bar( double, double );
22 int biz();
23 
24 int main() {
25 
26  MTKt_status status;
27  int result;
28  int path = 37;
29  int resolution = 275;
30  int block = 60;
31  float line = 256;
32  float sample = 1024;
33  double lat_dd, lon_dd;
34  int b;
35  float l, s;
36  int latdeg, londeg, latmin, lonmin;
37  double latsec, lonsec;
38 
39  status = MtkBlsToLatLon(path, resolution, block, line, sample,
40  &lat_dd, &lon_dd);
41  if (status != MTK_SUCCESS) return 1;
42 
43  status = MtkLatLonToBls(path, resolution, lat_dd, lon_dd, &b, &l, &s);
44  if (status != MTK_SUCCESS) return 1;
45 
46  status = MtkDdToDegMinSec(lat_dd, &latdeg, &latmin, &latsec);
47  if (status != MTK_SUCCESS) return 1;
48 
49  status = MtkDdToDegMinSec(lon_dd, &londeg, &lonmin, &lonsec);
50  if (status != MTK_SUCCESS) return 1;
51 
52  printf("\nExample 1:\n");
53  printf("path = %d\n", path);
54  printf("resolution = %d\n", resolution);
55  printf("block, line, sample = %d, %6.1f, %6.1f\n", block, line, sample);
56  printf("lat_dd, lon_dd = %f, %f\n", lat_dd, lon_dd);
57  printf("lat deg, min, sec = %d:%02d:%5.2f\n", latdeg, latmin, latsec);
58  printf("lon deg, min, sec = %d:%02d:%5.2f\n", londeg, lonmin, lonsec);
59  printf("b, l, s = %d, %6.1f, %6.1f\n", b, l, s);
60 
61  printf("\nExample2:\n");
62  result = bar(lat_dd, lon_dd);
63  if (result) return 1;
64 
65  printf("\nExample 3:\n");
66  status = biz();
67  if (status != MTK_SUCCESS) return 1;
68 
69  printf("\nWorked like champ!\n");
70  return 0;
71 }
MTKt_status MtkBlsToLatLon(int path, int resolution_meters, int block, float line, float sample, double *lat_dd, double *lon_dd)
Convert from Block, Line, Sample, to Latitude and Longitude in decimal degrees.
MTKt_status MtkLatLonToBls(int path, int resolution_meters, double lat_dd, double lon_dd, int *block, float *line, float *sample)
Convert decimal degrees latitude and longitude to block, line, sample.
int biz()
Definition: biz.c:25
long b
Definition: jpegint.h:371
int bar(double, double)
Definition: bar.c:21
int main()
Definition: foo.c:24
MTKt_status MtkDdToDegMinSec(double dd, int *deg, int *min, double *sec)
Convert decimal degrees to unpacked degrees, minutes, seconds.
MTKt_status
Definition: MisrError.h:11

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:51