MISR Toolkit  1.5.1
Data Structures | Macros | Enumerations | Functions
MisrMapQuery.h File Reference
#include "MisrError.h"
#include "MisrProjParam.h"
#include "MisrUtil.h"

Go to the source code of this file.

Data Structures

struct  MTKt_GeoCoord
 Geographic Coordinates. More...
 
struct  MTKt_SomCoord
 SOM Coordinates. More...
 
struct  MTKt_GeoRegion
 Geographic Region. More...
 
struct  MTKt_SomRegion
 SOM Region. More...
 
struct  MTKt_MapInfo
 Map Information. More...
 
struct  MTKt_GenericMapInfo
 Generic map information. More...
 
struct  MTKt_GCTPProjInfo
 GCTP projection information. More...
 

Macros

#define MTKT_GEOCOORD_INIT   { 0.0, 0.0 }
 
#define MTKT_SOMCOORD_INIT   { 0.0, 0.0 }
 
#define MTKT_GEOREGION_INIT
 
#define MTKT_SOMREGION_INIT
 
#define MTKT_MAPINFO_INIT
 
#define MTKT_GENERICMAPINFO_INIT   { 0, 0, 0, 0, 0, 0, 0, 0, {0,0,0}, {0,0,0}, MTKe_ORIGIN_UL, MTKe_PIX_REG_CENTER }
 
#define MTKT_GCTPPROJINFO_INIT   { 0, 0, 0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} }
 

Enumerations

enum  MTKt_OriginCode {
  MTKe_ORIGIN_UL = 0,
  MTKe_ORIGIN_UR = 1,
  MTKe_ORIGIN_LL = 2,
  MTKe_ORIGIN_LR = 3
}
 Origin code. More...
 
enum  MTKt_PixRegCode {
  MTKe_PIX_REG_CENTER = 0,
  MTKe_PIX_REG_CORNER = 1
}
 Pixel registration code. More...
 

Functions

MTKt_status MtkLSToSomXY (MTKt_MapInfo mapinfo, float line, float sample, double *som_x, double *som_y)
 Convert line, sample to SOM X, SOM Y. More...
 
MTKt_status MtkLSToSomXYAry (MTKt_MapInfo mapinfo, int nelement, const float *line, const float *sample, double *som_x, double *som_y)
 Convert array of line, sample to array of SOM X, SOM Y. More...
 
MTKt_status MtkSomXYToLS (MTKt_MapInfo mapinfo, double som_x, double som_y, float *line, float *sample)
 Convert SOM X, SOM Y to line, sample. More...
 
MTKt_status MtkSomXYToLSAry (MTKt_MapInfo mapinfo, int nelement, const double *som_x, const double *som_y, float *line, float *sample)
 Convert array of SOM X, SOM Y to array of line, sample. More...
 
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. More...
 
MTKt_status MtkLatLonToLSAry (MTKt_MapInfo mapinfo, int nelement, const double *lat_dd, const double *lon_dd, float *line, float *sample)
 Convert array of decimal degrees latitude and longitude to array of line, sample. More...
 
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. More...
 
MTKt_status MtkLSToLatLonAry (MTKt_MapInfo mapinfo, int nelement, const float *line, const float *sample, double *lat_dd, double *lon_dd)
 Convert array of line, sample to array of decimal degrees latitude and longitude. More...
 
MTKt_status MtkCreateLatLon (MTKt_MapInfo mapinfo, MTKt_DataBuffer *latbuf, MTKt_DataBuffer *lonbuf)
 Creates a 2-D latitude buffer and a 2-D longitude buffer in decimal degrees corresponding to the data plane described by the mapinfo argument given a mapinfo structure. More...
 
MTKt_status MtkGenericMapInfo (double Min_x, double Min_y, double Resolution_x, double Resolution_y, int Number_pixel_x, int Number_pixel_y, MTKt_OriginCode Origin_code, MTKt_PixRegCode Pix_reg_code, MTKt_GenericMapInfo *Map_info)
 Initialize a MTKt_GenericMapInfo structure. More...
 
MTKt_status MtkGCTPProjInfo (int Proj_code, int Sphere_code, int Zone_code, double Proj_param[15], MTKt_GCTPProjInfo *Proj_info)
 Initialize a MTKt_GCTPProjInfo structure. More...
 
MTKt_status MtkGCTPCreateLatLon (const MTKt_GenericMapInfo *Map_info, const MTKt_GCTPProjInfo *Proj_info, MTKt_DataBuffer *Latitude, MTKt_DataBuffer *Longitude)
 Create an array of latitude and longitude values corresponding to each pixel in the given map. More...
 
MTKt_status MtkGenericMapInfoRead (const char *Filename, MTKt_GenericMapInfo *Map_info)
 Initialize a MTKt_GenericMapInfo structure using data from an external file. More...
 
MTKt_status MtkGCTPProjInfoRead (const char *Filename, MTKt_GCTPProjInfo *Proj_info)
 Initialize a MTKt_GCTPProjInfo structure using data from an external file. More...
 
MTKt_status MtkChangeMapResolution (const MTKt_MapInfo *Map_info_in, int Resolution, MTKt_MapInfo *Map_info_out)
 Change resolution of an MTKt_MapInfo structure. More...
 

Macro Definition Documentation

◆ MTKT_GCTPPROJINFO_INIT

#define MTKT_GCTPPROJINFO_INIT   { 0, 0, 0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} }

Definition at line 130 of file MisrMapQuery.h.

◆ MTKT_GENERICMAPINFO_INIT

#define MTKT_GENERICMAPINFO_INIT   { 0, 0, 0, 0, 0, 0, 0, 0, {0,0,0}, {0,0,0}, MTKe_ORIGIN_UL, MTKe_PIX_REG_CENTER }

Definition at line 120 of file MisrMapQuery.h.

◆ MTKT_GEOCOORD_INIT

#define MTKT_GEOCOORD_INIT   { 0.0, 0.0 }

Definition at line 30 of file MisrMapQuery.h.

◆ MTKT_GEOREGION_INIT

#define MTKT_GEOREGION_INIT
Value:
MTKT_GEOCOORD_INIT, MTKT_GEOCOORD_INIT, \
MTKT_GEOCOORD_INIT }
#define MTKT_GEOCOORD_INIT
Definition: MisrMapQuery.h:30

Definition at line 49 of file MisrMapQuery.h.

◆ MTKT_MAPINFO_INIT

#define MTKT_MAPINFO_INIT
Value:
{ 0, 0, 0, 0, 0, 0, 0, MTK_TRUE, \
MTKT_SOMREGION_INIT, MTKT_GEOREGION_INIT, \
MTKT_MISRPROJPARAM_INIT }
#define MTKT_GEOREGION_INIT
Definition: MisrMapQuery.h:49

Definition at line 79 of file MisrMapQuery.h.

◆ MTKT_SOMCOORD_INIT

#define MTKT_SOMCOORD_INIT   { 0.0, 0.0 }

Definition at line 38 of file MisrMapQuery.h.

◆ MTKT_SOMREGION_INIT

#define MTKT_SOMREGION_INIT
Value:
MTKT_SOMCOORD_INIT }
#define MTKT_SOMCOORD_INIT
Definition: MisrMapQuery.h:38

Definition at line 61 of file MisrMapQuery.h.

Enumeration Type Documentation

◆ MTKt_OriginCode

Origin code.

Enumerator
MTKe_ORIGIN_UL 

Upper Left (min X, max Y); Line=Y, Sample=X

MTKe_ORIGIN_UR 

Upper Right (max X, max Y); Line=X, Sample=Y

MTKe_ORIGIN_LL 

Lower Left (min X, min Y); Line=X, Sample=Y

MTKe_ORIGIN_LR 

Lower Right (max X, min Y); Line=Y, Sample=X

Definition at line 84 of file MisrMapQuery.h.

◆ MTKt_PixRegCode

Pixel registration code.

Enumerator
MTKe_PIX_REG_CENTER 

Center

MTKe_PIX_REG_CORNER 

Corner

Definition at line 92 of file MisrMapQuery.h.

Function Documentation

◆ MtkChangeMapResolution()

MTKt_status MtkChangeMapResolution ( const MTKt_MapInfo Map_info_in,
int  New_resolution,
MTKt_MapInfo Map_info_out 
)

Change resolution of an MTKt_MapInfo structure.

New resolution must be an integer multiple of the base MISR resolution, defined by MAXRESOLUTION.

The edges of the output map will be anchored at the same locations as the input map. Therefore, the size of input map must evenly divisible by the new resolution.

Returns
MTK_SUCCESS if successful.
Example:
Note
Parameters
[in]Map_info_inInput map information
[in]New_resolutionNew resolution.
[out]Map_info_outOutput map information.

Definition at line 43 of file MtkChangeMapResolution.c.

◆ MtkCreateLatLon()

MTKt_status MtkCreateLatLon ( MTKt_MapInfo  mapinfo,
MTKt_DataBuffer latbuf,
MTKt_DataBuffer lonbuf 
)

Creates a 2-D latitude buffer and a 2-D longitude buffer in decimal degrees corresponding to the data plane described by the mapinfo argument given a mapinfo structure.

Returns
MTK_SUCCESS if successful.
Example:
In this example, we define a region centered at lat 35.0, lon -115.0 with a lat extent of 110.0km and lon extent 110.0km. We then read the Regional Best Estimate Spectral Optical Depth and create the corresponding latutide and longitude buffers for this dataplane described by mapinfo. This routine computes the latitude and longitude for every pixel in the dataplane for which there is MISR data. It does not preclude the use of the MapQuery routines MtkLSToLatLon or MtkLatLonToLS that compute latitude and longitude. In fact this routine makes use of those routines.
status = MtkSetRegionByLatLonExtent(35.0, -115.0, 110.0, 110.0, "km", &region);
status = MtkReadData("MISR_AM1_AS_AEROSOL_P037_O029058_F09_0017.hdf", "RegParamsAer", "RegBestEstimateSpectralOptDepth",
region, &databuf, &mapinfo);
status = MtkCreateLatLon(mapinfo, &latbuf, &lonbuf);
Note
The caller is responsible for using MtkDataBufferFree() to free the memory used by databuf, latbuf and lonbuf
Parameters
[in]mapinfoMapinfo
[out]latbufLatitude data buffer
[out]lonbufLongitue data buffer

Definition at line 48 of file MtkCreateLatLon.c.

◆ MtkGCTPCreateLatLon()

MTKt_status MtkGCTPCreateLatLon ( const MTKt_GenericMapInfo Map_info,
const MTKt_GCTPProjInfo Proj_info,
MTKt_DataBuffer Latitude,
MTKt_DataBuffer Longitude 
)

Create an array of latitude and longitude values corresponding to each pixel in the given map.

Returns
MTK_SUCCESS if successful.
Example:
Note
Parameters
[in]Map_infoMap information.
[in]Proj_infoProjection information.
[out]LatitudeLatitude values.
[out]LongitudeLongitude values.

Definition at line 36 of file MtkGCTPCreateLatLon.c.

◆ MtkGCTPProjInfo()

MTKt_status MtkGCTPProjInfo ( int  Proj_code,
int  Sphere_code,
int  Zone_code,
double  Proj_param[15],
MTKt_GCTPProjInfo Proj_info 
)

Initialize a MTKt_GCTPProjInfo structure.

Returns
MTK_SUCCESS if successful.
Example:
status = MtkGCTPProjInfo()
Note
Parameters
[in]Proj_codeProjection code.
[in]Sphere_codeSpheroid code.
[in]Zone_codeUTM zone code (only applicable if Projection code is UTM
[in]Proj_paramProjection parameters.
[out]Proj_infoProjection information.

Definition at line 35 of file MtkGCTPProjInfo.c.

◆ MtkGCTPProjInfoRead()

MTKt_status MtkGCTPProjInfoRead ( const char *  Filename,
MTKt_GCTPProjInfo Proj_info 
)

Initialize a MTKt_GCTPProjInfo structure using data from an external file.

The external file must be simple text format with parameter_name = value pairs.

Parameter names recognized by this routine are as follows: proj_code is the GCTP projection code. utm_zone is the UTM zone number for UTM projections only. sphere_code is GCTP spheroid code. proj_param(n) is the nth GCTP projection parameter. (1 <= n <= 15)

Unrecognized parameter names are ignored. Lines starting with a '#' character are ignored. Everything after the first name = value on a line is ignored.

The default value for proj_param(n) which are not specified is zero. Utm_zone is only required if proj_code is UTM (1).

Example map information file:

this is a comment

proj_code = 3 # Albers #utm_zone = -1 sphere_code = 8 # GRS80 proj_param(1) = 0.0 # Semi-major axis of ellipsoid. (superceded by sphere code) proj_param(2) = 0.0 # Semi-minor axis of ellipsoid. (superceded by sphere code) proj_param(3) = 29030000.0 # Latitude of the first standard parallel. (DDDMMMSSS.SS) proj_param(4) = 45030000.0 # Latitude of the second standard parallel. (DDDMMMSSS.SS) proj_param(5) = -96000000.0 # Longitude of the central meridian. (DDDMMMSSS.SS) proj_param(6) = 23000000.0 # Latitude of the projection origin. (DDDMMMSSS.SS)

Returns
MTK_SUCCESS if successful.
Example:
Note
Parameters
[in]FilenameFilename
[out]Proj_infoProj information.

Definition at line 64 of file MtkGCTPProjInfoRead.c.

◆ MtkGenericMapInfo()

MTKt_status MtkGenericMapInfo ( double  Min_x,
double  Min_y,
double  Resolution_x,
double  Resolution_y,
int  Number_pixel_x,
int  Number_pixel_y,
MTKt_OriginCode  Origin_code,
MTKt_PixRegCode  Pix_reg_code,
MTKt_GenericMapInfo Map_info 
)

Initialize a MTKt_GenericMapInfo structure.

Min_x and Min_y contains the minimum x,y coordinates at the edge of the map.

Resolution_x is the size of a pixel along the X-axis. Resolution_y is the size of a pixel along the Y-axis.

Number_pixel_x and number_pixel_y specifies the size of the map in pixels along the respective axes.

Origin_code defines the corner of the map at which pixel 0,0 is located. Possible values are: MTKe_ORIGIN_UL - Upper Left (min X, max Y) MTKe_ORIGIN_UR - Upper Right (max X, max Y) MTKe_ORIGIN_LL - Lower Left (min X, min Y) MTKe_ORIGIN_LR - Lower Right (max X, min Y)

Pix_reg_code defines whether a pixel value is related to the corner or center of the corresponding area of that pixel on the map. If the corner is used, then it is always the corner corresponding to the corner of the origin. Possible values are: MTKe_PIX_REG_CENTER - Center MTKe_PIX_REG_CORNER - Corner

Returns
MTK_SUCCESS if successful.
Example:
Note
Parameters
[in]Min_xMinimum X value in map units
[in]Min_yMinimum Y value in map units
[in]Resolution_xSize of a pixel along X-axis, in map units
[in]Resolution_ySize of a pixel along Y-axis, in map units
[in]Number_pixel_xNumber of pixels along X-axis.
[in]Number_pixel_yNumber of pixels along Y-axis.
[in]Origin_codeCorner of the map at which pixel 0,0 is located.
[in]Pix_reg_codeFlag indicating if pixel values correspond to the center or corner of the area of the pixel on the map.
[out]Map_infoMap information.

Definition at line 58 of file MtkGenericMapInfo.c.

◆ MtkGenericMapInfoRead()

MTKt_status MtkGenericMapInfoRead ( const char *  Filename,
MTKt_GenericMapInfo Map_info 
)

Initialize a MTKt_GenericMapInfo structure using data from an external file.

The external file must be simple text format with parameter_name = value pairs.

Parameter names recognized by this routine are as follows: min_corner_x is the minimum X coordinate at the edge of the map. min_corner_y is the minimum Y coordinate at the edge of the map. resolution_x is the size of a pixel along the X-axis. resolution_y is the size of a pixel along the Y-axis. number_pixel_x is the size of the map in pixels, along the X-axis. number_pixel_y is the size of the map in pixels, along the Y-axis. origin_code defines the corner of the map at which pixel 0,0 is located. pix_reg_code defines whether a pixel value is related to the corner or center of the corresponding area of that pixel on the map. If the corner is used, then it is always the corner corresponding to the corner of the origin.

Possible values for origin_code are: UL - Upper Left (min X, max Y) UR - Upper Right (max X, max Y) LL - Lower Left (min X, min Y) LR - Lower Right (max X, min Y)

Possible values are: CENTER - Center CORNER - Corner

Unrecognized parameter names are ignored. Lines starting with a '#' character are ignored. Comments may be placed on the same line, after a name = value pair as well.

Example map information file:

this is a comment

min_corner_x = 10000.0 min_corner_y = 20000.0 resolution_x = 250.0 resolution_y = 250.0 number_pixel_x = 1000 number_pixel_y = 2000 origin_code = UL # min x, max y pix_reg_code = CENTER

Returns
MTK_SUCCESS if successful.
Example:
Note
Parameters
[in]FilenameFilename
[out]Map_infoMap information.

Definition at line 78 of file MtkGenericMapInfoRead.c.

◆ MtkLatLonToLS()

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.

Returns
MTK_SUCCESS if successful.
Example:
In this example, we convert decimal degrees latitude 44.322089 and longitude -112.00821 to line, sample.
status = MtkLatLonToLS(mapinfo, 44.322089, -112.00821, &line, &sample);
Parameters
[in]mapinfoMap Info
[in]lat_ddLatitude
[in]lon_ddLongitude
[out]lineLine
[out]sampleSample

Definition at line 33 of file MtkLatLonToLS.c.

◆ MtkLatLonToLSAry()

MTKt_status MtkLatLonToLSAry ( MTKt_MapInfo  mapinfo,
int  nelement,
const double *  lat_dd,
const double *  lon_dd,
float *  line,
float *  sample 
)

Convert array of decimal degrees latitude and longitude to array of line, sample.

Returns
MTK_SUCCESS if successful.
Example:
In this example, we convert an array of latitude and longitude to line, sample.
double lat_dd[2] = {44.322089, 45.0};
dobule lon_dd[2] = {-112.00821, -113.0};
float line[2];
float sample[2];
status = MtkLatLonToLSAry(mapinfo, 2, lat_dd, lon_dd, line, sample);
Parameters
[in]mapinfoMap Info
[in]nelementNumber of elements
[in]lat_ddLatitude
[in]lon_ddLongitude
[out]lineLine
[out]sampleSample

Definition at line 43 of file MtkLatLonToLSAry.c.

◆ MtkLSToLatLon()

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.

Returns
MTK_SUCCESS if successful.
Example:
In this example, we convert line 1.0 and sample 1.0 to latitude and longitude in decimal degrees.
status = MtkLSToLatLon(mapinfo, 1.0, 1.0, &lat_dd, &lon_dd);
Parameters
[in]mapinfoMap Info
[in]lineLine
[in]sampleSample
[out]lat_ddLatitude
[out]lon_ddLongitude

Definition at line 33 of file MtkLSToLatLon.c.

◆ MtkLSToLatLonAry()

MTKt_status MtkLSToLatLonAry ( MTKt_MapInfo  mapinfo,
int  nelement,
const float *  line,
const float *  sample,
double *  lat_dd,
double *  lon_dd 
)

Convert array of line, sample to array of decimal degrees latitude and longitude.

Returns
MTK_SUCCESS if successful.
Example:
In this example, we convert an array of line and sample values to latitude and longitude in decimal degrees.
float line[2] = {1.0, 2.0};
float sample[2] = {1.0, 2.0};
double lat_dd[2];
double lon_dd[2];
status = MtkLSToLatLonAry(mapinfo, 2, line, sample, lat_dd, lon_dd);
Parameters
[in]mapinfoMap info
[in]nelementNumber of elements
[in]lineLine
[in]sampleSample
[out]lat_ddLatitude
[out]lon_ddLongitude

Definition at line 38 of file MtkLSToLatLonAry.c.

◆ 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.

Returns
MTK_SUCCESS if successful.
Example:
In this example, we convert line 1.0 and sample 1.0 to SOM Cordinates.
status = MtkLSToSomXY(mapinfo, 1.0, 1.0, &som_x, &som_y);
Parameters
[in]mapinfoMap Info
[in]lineLine
[in]sampleSample
[out]som_xSOM X
[out]som_ySOM Y

Definition at line 33 of file MtkLSToSomXY.c.

◆ MtkLSToSomXYAry()

MTKt_status MtkLSToSomXYAry ( MTKt_MapInfo  mapinfo,
int  nelement,
const float *  line,
const float *  sample,
double *  som_x,
double *  som_y 
)

Convert array of line, sample to array of SOM X, SOM Y.

Returns
MTK_SUCCESS if successful.
Example:
In this example, we convert an array of line, sample values to SOM Coordinates.
float line[2] = {101, 202};
float sample[2] = {22, 122};
double som_x[2];
double som_y[2];
status = MtkLSToSomXYAry(mapinfo, 2, line, sample, som_x, som_y);
Parameters
[in]mapinfoMap Info
[in]nelementNumber of elemnts
[in]lineLine
[in]sampleSample
[out]som_xSOM X
[out]som_ySOM Y

Definition at line 37 of file MtkLSToSomXYAry.c.

◆ 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.

Returns
MTK_SUCCESS if successful.
Example:
In this example, we convert SOM X 10529200.016621 and SOM Y 622600.018066 to line, sample.
status = MtkSomXYToBls(mapinfo, 10529200.016621, 622600.018066, &line, &sample);
Parameters
[in]mapinfoMap Info
[in]som_xSOM X
[in]som_ySOM Y
[out]lineLine
[out]sampleSample

Definition at line 32 of file MtkSomXYToLS.c.

◆ MtkSomXYToLSAry()

MTKt_status MtkSomXYToLSAry ( MTKt_MapInfo  mapinfo,
int  nelement,
const double *  som_x,
const double *  som_y,
float *  line,
float *  sample 
)

Convert array of SOM X, SOM Y to array of line, sample.

Returns
MTK_SUCCESS if successful.
Example:
In this example, we convert an array of SOM X and SOM Y values to line and sample.
double som_x[2] = {10529200.016621, 10811900.026208};
double som_y[2] = {622600.018066, 623700.037609};
float line[2];
float sample[2];
status = MtkSomXYToBlsAry(mapinfo, 2, som_x, som_y, line, sample);
Parameters
[in]mapinfoMap Info
[in]nelementNumber of elements
[in]som_xSOM X
[in]som_ySOM Y
[out]lineLine
[out]sampleSample

Definition at line 37 of file MtkSomXYToLSAry.c.


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