31 double lat_dd = 32.2, lon_dd = -114.5;
33 double lat_extent = 200, lon_extent = 100;
38 float blk_line, blk_sample;
40 int latdeg, londeg, latmin, lonmin;
41 double latsec, lonsec;
59 lat_extent, lon_extent,
"km", ®ion);
62 printf(
"region center lat/lon (dd) = (%f, %f)\n",
64 printf(
" region extent (m) = (%f, %f)\n",
75 strcat(filename,
"C:\\Mtk_testdata\\in\\");
76 strcat(filename,
"MISR_AM1_GRP_ELLIPSOID_GM_P037_O029058_AA_F03_0024.hdf");
77 strcpy(gridname,
"RedBand");
78 strcpy(fieldname,
"Red Brf");
80 printf(
"Filename is: %s\n", filename);
81 status =
MtkReadData(filename, gridname, fieldname, region,
82 &brf_databuf, &brf_mapinfo);
85 status =
MtkLatLonToLS(brf_mapinfo, lat_dd, lon_dd, &line, &sample);
89 s = (int)round(sample);
98 &block, &blk_line, &blk_sample);
101 status =
MtkLSToLatLon(brf_mapinfo, line, sample, &lat, &lon);
110 status =
MtkLSToSomXY(brf_mapinfo, line, sample, &somx, &somy);
119 printf(
"\n Reading file = %s\n",filename);
120 printf(
" Reading grid = %s\n",gridname);
121 printf(
" Reading field = %s\n",fieldname);
122 printf(
" number of lines/samples = (%d, %d)\n",
124 printf(
" input lat/lon (dd) = (%f, %f)\n", lat_dd, lon_dd);
125 printf(
" line/sample = (%f, %f)\n", line, sample);
126 printf(
" Brf[%d][%d] = %f\n", l, s, brf_databuf.
data.
f[l][s]),
127 printf(
" block/line/sample = (%d, %f, %f)\n",
128 block, blk_line, blk_sample);
129 printf(
" lat/lon (dd) = (%f, %f)\n", lat, lon);
130 printf(
" lat/lon (dms) = (%d:%d:%f, %d:%d:%f)\n",
131 latdeg, latmin, latsec, londeg, lonmin, lonsec);
132 printf(
" SOM x/y = (%f, %f)\n", somx, somy);
133 printf(
" pixel time[%d][%d] = %s\n", l, s, datetime);
145 strcat(filename,
"C:\\Mtk_testdata\\in\\");
146 strcat(filename,
"MISR_AM1_AS_LAND_P037_O029058_F06_0017.hdf");
147 strcpy(gridname,
"SubregParamsLnd");
148 strcpy(fieldname,
"LandHDRF[3][4]");
150 status =
MtkReadData(filename, gridname, fieldname, region,
151 &hdrf_databuf, &hdrf_mapinfo);
154 status =
MtkLatLonToLS(hdrf_mapinfo, lat_dd, lon_dd, &line, &sample);
157 l = (int)round(line);
158 s = (int)round(sample);
167 &block, &blk_line, &blk_sample);
170 status =
MtkLSToLatLon(hdrf_mapinfo, line, sample, &lat, &lon);
182 printf(
"\n Reading file = %s\n",filename);
183 printf(
" Reading grid = %s\n",gridname);
184 printf(
" Reading field = %s\n",fieldname);
185 printf(
" number of lines/samples = (%d, %d)\n",
187 printf(
" input lat/lon (dd) = (%f, %f)\n", lat_dd, lon_dd);
188 printf(
" line/sample = (%f, %f)\n", line, sample);
189 printf(
" HDRF[%d][%d] = %f\n", l, s, hdrf_databuf.
data.
f[l][s]),
190 printf(
" block/line/sample = (%d, %f, %f)\n",
191 block, blk_line, blk_sample);
192 printf(
" lat/lon (dd) = (%f, %f)\n", lat, lon);
193 printf(
" lat/lon (dms) = (%d:%d:%f, %d:%d:%f)\n",
194 latdeg, latmin, latsec, londeg, lonmin, lonsec);
195 printf(
" SOM x/y = (%f, %f)\n", somx, somy);
201 printf(
"Error: %s\n",err_msg[status_code]);
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.
#define MTKT_TIME_METADATA_INIT
#define MTKT_MAPINFO_INIT
MTKt_status MtkLSToLatLon(MTKt_MapInfo mapinfo, float line, float sample, double *lat_dd, double *lon_dd)
Convert line, sample to decimal degrees latitude and longitude.
MTKt_status MtkLSToSomXY(MTKt_MapInfo mapinfo, float line, float sample, double *som_x, double *som_y)
Convert line, sample to SOM X, SOM Y.
MTKt_status MtkLatLonToLS(MTKt_MapInfo mapinfo, double lat_dd, double lon_dd, float *line, float *sample)
Convert decimal degrees latitude and longitude to line, sample.
2-dimensional Data Buffer
#define MTKT_DATABUFFER_INIT
MTKt_status MtkDataBufferFree(MTKt_DataBuffer *databuf)
Free data buffer.
MTKt_status MtkReadData(const char *filename, const char *gridname, const char *fieldname, MTKt_Region region, MTKt_DataBuffer *databuf, MTKt_MapInfo *mapinfo)
Reads any grid/field from any MISR product file and performs unpacking or unscaling. It also reads any MISR conventional product file.
MTKt_status MtkSetRegionByLatLonExtent(double ctr_lat_dd, double ctr_lon_dd, double lat_extent, double lon_extent, const char *extent_units, MTKt_Region *region)
Select region by latitude, longitude in decimal degrees, and extent in specified units of degrees...
MTKt_status MtkTimeMetaRead(const char *filename, MTKt_TimeMetaData *time_metadata)
Read time metadata from L1B2 Ellipsoid product file.
MTKt_status MtkPixelTime(MTKt_TimeMetaData time_metadata, double som_x, double som_y, char pixel_time[MTKd_DATETIME_LEN])
Given SOM Coordinates compute pixel time.
MTKt_status MtkDdToDegMinSec(double dd, int *deg, int *min, double *sec)
Convert decimal degrees to unpacked degrees, minutes, seconds.
#define MTK_ERR_COND_JUMP(code)
MTKt_status MtkFileToPath(const char *filename, int *path)
Read path number from file.
#define MTKd_DATETIME_LEN
MTKt_status MtkLatLonToSomXY(int path, double lat_dd, double lon_dd, double *som_x, double *som_y)
Convert decimal degrees latitude and longitude to SOM X, SOM Y.
MTKt_status MtkFileGridToResolution(const char *filename, const char *gridname, int *resolution)
Get resolution of a particular grid.