OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
lonlat2pixline.cpp File Reference
#include <netcdf>
#include <cstdio>
#include "lonlat2pixline.h"
#include <readL2scan.h>
#include <string.h>
#include <math.h>
#include <string>
#include <vector>
#include <hdf.h>
#include <mfhdf.h>
Include dependency graph for lonlat2pixline.cpp:

Go to the source code of this file.

Functions

void check_nc (int status, char *file, int line)
 
int lonlat2pixline (lonlat2pixline_t *params)
 
int lonlat2pixline1 (char *input_filename, char *geo_filename, int32_t resolution, float SWlon, float SWlat, float NElon, float NElat, int32_t *spixl, int32_t *epixl, int32_t *sline, int32_t *eline)
 
int lonlat2pixline2 (char *input_filename, char *geo_filename, int32_t resolution, float lon, float lat, int32_t dx, int32_t dy, int32_t *spixl, int32_t *epixl, int32_t *sline, int32_t *eline)
 
int lonlat2pixline3 (char *input_filename, char *geo_filename, int32_t resolution, float lon, float lat, int32_t *pixl, int32_t *line)
 

Function Documentation

◆ check_nc()

void check_nc ( int  status,
char *  file,
int  line 
)

Print NetCDF error message and exit.

Parameters
[in]statusNetCDF error status.
[in]fileOriginating FILE.
[in]lineOriginating LINE.

Definition at line 58 of file lonlat2pixline.cpp.

◆ lonlat2pixline()

int lonlat2pixline ( lonlat2pixline_t *  params)

Function that returns the pixel, line of a lon, lat or lon, lat box for the given L1, L2 or MODIS GEO file.

Note that if a MODIS GEO file is given with a resolution of 500 or 250 the pixl and line could be off by 1 or 3 respectively.

box usage:
params->SWlon - SW longitude corner of box params->SWlat - SW latitude corner of box params->NElon - NE longitude corner of box params->NElat - NE latitude corner of box params->want_pixbox - 0
params->pix_srch - 0
params->input_filename - L1, L2 or GEO file
params->geo_filename - MODIS GEO file
params->resolution - output resolution if MODIS (-1,1000,500,250)

pix usage:
params->SWlon - longitude value of location
params->SWlat - latitude value of location
params->want_pixbox - 0 for single point
1 for box defined by xbox, ybox (pixels)
params->pix_srch - 1
params->xbox - num pixels on either side of location (want_pixbox=1)
params->ybox - num scan lines on either side of location
params->input_filename - L1 or L2 file
params->geo_filename - MODIS GEO file
params->resolution - output resolution if MODIS (-1,1000,500,250)

other inputs:
want_verbose(gloabal) - 0 for no output to stdout

  • 1 for status messages

outputs:
params->box_failed - 1 if the box was not fully extracted, else 0
params->pixLon - actual longitude of the pixel found
params->pixLat - actual latitude of the pixel found
params->spix - start pixel
params->epix - end pixel
params->sline - start line
params->eline - end line

Parameters
paramsa structure that controls the function.
Returns
0 = all OK
1=error
110=full box not extracted
120=whole file extracted

Definition at line 70 of file lonlat2pixline.cpp.

◆ lonlat2pixline1()

int lonlat2pixline1 ( char *  input_filename,
char *  geo_filename,
int32_t  resolution,
float  SWlon,
float  SWlat,
float  NElon,
float  NElat,
int32_t *  spixl,
int32_t *  epixl,
int32_t *  sline,
int32_t *  eline 
)

Definition at line 758 of file lonlat2pixline.cpp.

◆ lonlat2pixline2()

int lonlat2pixline2 ( char *  input_filename,
char *  geo_filename,
int32_t  resolution,
float  lon,
float  lat,
int32_t  dx,
int32_t  dy,
int32_t *  spixl,
int32_t *  epixl,
int32_t *  sline,
int32_t *  eline 
)

Definition at line 784 of file lonlat2pixline.cpp.

◆ lonlat2pixline3()

int lonlat2pixline3 ( char *  input_filename,
char *  geo_filename,
int32_t  resolution,
float  lon,
float  lat,
int32_t *  pixl,
int32_t *  line 
)

Definition at line 810 of file lonlat2pixline.cpp.