OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
get_nc_height.c File Reference
#include "l12_proto.h"
#include "nc_gridutils.h"
Include dependency graph for get_nc_height.c:

Go to the source code of this file.

Classes

struct  tile_struct
 

Macros

#define TILE_ROWS   120
 
#define MAXSENZEN   75
 
#define BORDER   0.30
 
#define REMM   6371000.000
 

Functions

void print_area (grid_area_t area)
 
void print_tile (tile_struct tile)
 
void define_tile_geometry ()
 
int initialize_deminfo ()
 
void free_deminfo ()
 
void unload_tile (int itile)
 
void load_tile_cache (int itile)
 
int load_tile (float lat, float lon)
 
int tile_findex (tile_struct tile, float lat, float lon, double *findex)
 
int tile_index (tile_struct tile, float lat, float lon, size_t *index)
 
int get_tilevalue (tile_struct tile, float lat, float lon, double *value)
 
int interp_tilevalue (tile_struct tile, float lat, float lon, double *result)
 
int get_nc_height (float *xlon, float *xlat, float *senz, float *sena, float *height)
 
int lookup_nc_height (float *xlon, float *xlat, float *height)
 
int interp_nc_height (float *xlon, float *xlat, float *height)
 

Detailed Description

Reads DEM from NetCDF4 file, and performs terrain correction.

Author
Gwyn Fireman
Ocean Ecology Laboratory, NASA Goddard Space Flight Center

Definition in file get_nc_height.c.

Macro Definition Documentation

◆ BORDER

#define BORDER   0.30

Degrees latitude around each tile; calculated from MAXSENZEN.

Definition at line 15 of file get_nc_height.c.

◆ MAXSENZEN

#define MAXSENZEN   75

Maximum sensor zenith angle; avoid limb.

Definition at line 13 of file get_nc_height.c.

◆ REMM

#define REMM   6371000.000

Earth mean radius (m).

Definition at line 17 of file get_nc_height.c.

◆ TILE_ROWS

#define TILE_ROWS   120

Number of tile (latitude) rows, adjustable for performance.

Definition at line 11 of file get_nc_height.c.

Function Documentation

◆ define_tile_geometry()

void define_tile_geometry ( )

Divide the globe into approximately equal-area chunks.

Definition at line 97 of file get_nc_height.c.

◆ free_deminfo()

void free_deminfo ( )

Definition at line 227 of file get_nc_height.c.

◆ get_nc_height()

int get_nc_height ( float *  xlon,
float *  xlat,
float *  senz,
float *  sena,
float *  height 
)

Perform terrain correction; return DEM value

Parameters
[in,out]xlon,xlat
[in,out]senz
[in]sena
[out]height
Returns

Definition at line 574 of file get_nc_height.c.

◆ get_tilevalue()

int get_tilevalue ( tile_struct  tile,
float  lat,
float  lon,
double *  value 
)
Parameters
[in]tile
[in]lat,lon
[out]value
Returns

Definition at line 485 of file get_nc_height.c.

◆ initialize_deminfo()

int initialize_deminfo ( )
Parameters
[in]demfile(via input struct)
Returns

Definition at line 190 of file get_nc_height.c.

◆ interp_nc_height()

int interp_nc_height ( float *  xlon,
float *  xlat,
float *  height 
)

Return DEM value obtained by interpolating between four nearest points.

Parameters
[in]xlon,xlat
[out]height
Returns

Definition at line 735 of file get_nc_height.c.

◆ interp_tilevalue()

int interp_tilevalue ( tile_struct  tile,
float  lat,
float  lon,
double *  result 
)
Parameters
[in]tile
[in]lat,lon
[out]result
Returns

Definition at line 503 of file get_nc_height.c.

◆ load_tile()

int load_tile ( float  lat,
float  lon 
)
Parameters
[in]dem_tile_t
[in]lat
[in]lon
Returns

Definition at line 285 of file get_nc_height.c.

◆ load_tile_cache()

void load_tile_cache ( int  itile)

Definition at line 261 of file get_nc_height.c.

◆ lookup_nc_height()

int lookup_nc_height ( float *  xlon,
float *  xlat,
float *  height 
)

Return DEM value nearest to specified coordinates.

Parameters
[in]xlon,xlat
[out]height
Returns

Definition at line 705 of file get_nc_height.c.

◆ print_area()

void print_area ( grid_area_t  area)

Print info for a rectangular area.

Parameters
[in]area

Definition at line 63 of file get_nc_height.c.

◆ print_tile()

void print_tile ( tile_struct  tile)

Print info for a single tile.

Parameters
[in]tile

Definition at line 76 of file get_nc_height.c.

◆ tile_findex()

int tile_findex ( tile_struct  tile,
float  lat,
float  lon,
double *  findex 
)

Floating-point index of lat, lon within current tile.

Parameters
[in]tile
[in]lat,lon
[out]findex
Returns

Definition at line 408 of file get_nc_height.c.

◆ tile_index()

int tile_index ( tile_struct  tile,
float  lat,
float  lon,
size_t *  index 
)

Integer index of lat, lon within current tile.

Parameters
[in]tile
[in]lat,lon
[out]index
Returns

Definition at line 460 of file get_nc_height.c.

◆ unload_tile()

void unload_tile ( int  itile)

Definition at line 252 of file get_nc_height.c.

Variable Documentation

◆ ncols

size_t ncols[TILE_ROWS]

Definition at line 54 of file get_nc_height.c.

◆ ntiles

size_t ntiles

Definition at line 53 of file get_nc_height.c.

◆ start_tile

size_t start_tile[TILE_ROWS]

Definition at line 55 of file get_nc_height.c.

◆ tiles

tile_struct* tiles

Definition at line 56 of file get_nc_height.c.