#include "mapio.h"Functions | |
| int | check_error (int status, struct mapsrc *src) |
| void | mapsrc_fill (const char *file, struct mapsrc *src) |
| Opens a GMT GRD file and read coordinate variables. More... | |
| float | mapsrc_find (struct mapsrc *src, double x, double y) |
| Find a z value at a given point. More... | |
| struct mapsrc * | mapsrc_init (void) |
| Initializes a mapsrc structure. More... | |
| void | mapsrc_free (struct mapsrc *src) |
| Frees the memory used by a mapsrc structure. More... | |
| char * | mapsrc_tostring (struct mapsrc *src) |
| create a string of a mapsrc structure More... | |
| int | mapdata_fill (struct mapsrc *src, struct mapdata *data, double x, double y, double xwidth, double ywidth) |
| Read a submap from a netcdf UTM GRD file into a mapdata structure. More... | |
| void | mapdata_free (struct mapdata *data, int free_all) |
| Free's the memory held by a mapdata structure. More... | |
| char * | mapdata_tostring (struct mapdata *data) |
| create a string of a mapdata structure More... | |
| int | nearest (double key, const double *base, size_t nmemb) |
| Find the index of the nearest value. More... | |
| float | getZ (const float *z, int row, int column, int columns) |
| void | z_print (const float *z, int rows, int columns) |
| int | mapdata_check (struct mapdata *data, struct mapsrc *src, double xcenter, double ycenter, double xwidth, double ywidth) |
| Returns a code indicating the status of the mapdata. More... | |
| struct mapbounds * | mapbounds_init () |
| Create a mapbounds struct. More... | |
| int | mapbounds_fill1 (struct mapsrc *src, struct mapbounds *bounds) |
| Fills a mapbounds structure from a mapsrc object. More... | |
| char * | mapbounds_tostring (struct mapbounds *bounds) |
| Return a string representation of a mapbounds struct. More... | |
| int | mapbounds_fill2 (const char *file, struct mapbounds *bounds) |
| Fill in a mapbounds structure from a netcdf file. More... | |
| int | mapbounds_contains (struct mapbounds *bounds, const double x, const double y) |
| int | mapdata_checksize (struct mapbounds *bounds, struct mapdata *data, const double xwidth, const double ywidth) |
| int check_error | ( | int | status, |
| struct mapsrc * | src | ||
| ) |
| float getZ | ( | const float * | z, |
| int | row, | ||
| int | column, | ||
| int | columns | ||
| ) |
| int mapbounds_contains | ( | struct mapbounds * | bounds, |
| const double | x, | ||
| const double | y | ||
| ) |
Fills a mapbounds structure from a mapsrc object.
function: mapbounds_fill1
Fills in a mapbounds structure based on info in the src stucture
| src | The mapsrc data structure |
| bounds | The mapbounds data structure to populate |
| int mapbounds_fill2 | ( | const char * | file, |
| struct mapbounds * | bounds | ||
| ) |
Fill in a mapbounds structure from a netcdf file.
function: mapbounds_fill2
Fills in a maounds structure based on data in the netcdf file
| struct mapbounds* mapbounds_init | ( | ) |
Create a mapbounds struct.
function: mapbounds_init
Allocates memory for a mapbounds struct as sets all values to 0. The structure's memory will need to be freed when done with the structure.
| char* mapbounds_tostring | ( | struct mapbounds * | bounds | ) |
Return a string representation of a mapbounds struct.
function: mapbounds_tostring
String rep of a mapbounds struct
| bounds | A mapbounds struct |
| int mapdata_check | ( | struct mapdata * | data, |
| struct mapsrc * | src, | ||
| double | xcenter, | ||
| double | ycenter, | ||
| double | xwidth, | ||
| double | ywidth | ||
| ) |
Returns a code indicating the status of the mapdata.
function: mapdata_check
TODO
| data | THe mapdata structure |
| int mapdata_checksize | ( | struct mapbounds * | bounds, |
| struct mapdata * | data, | ||
| const double | xwidth, | ||
| const double | ywidth | ||
| ) |
| int mapdata_fill | ( | struct mapsrc * | src, |
| struct mapdata * | data, | ||
| double | x, | ||
| double | y, | ||
| double | xwidth, | ||
| double | ywidth | ||
| ) |
Read a submap from a netcdf UTM GRD file into a mapdata structure.
function: mapdata_fill
Reads in a rectangular block of bathymetry data from a file (defined by src). The size of the rectangle is based on the params but will NOT be exaclty as specified by xwidth and ywidth.
| src | The mapsrc structure definining where we are reading data from |
| data | A mapdata structure for storing the submap |
| x | The easting position of the vehicle. In the same UTM coordinate system as the src map. |
| y | The northing position of the vehicle. In the same UTM coordinate system as the src map. |
| xwidth | The width of the submap in meters to retrive. |
| ywidth | The width of the submap in meters to retrieve |
| void mapdata_free | ( | struct mapdata * | data, |
| int | free_all | ||
| ) |
Free's the memory held by a mapdata structure.
function: mapdata_free
| data | The mapdata structure who's memory we want to free |
| free_all | If equal to 0 then the structure itself will not be freed, only the internal pointers. All structure values will be set to 0. if not equal to 1 then the data structure's memory will be release. |
| char* mapdata_tostring | ( | struct mapdata * | data | ) |
create a string of a mapdata structure
function: mapdata_tostring
| data | The mapdata structure |
| void mapsrc_fill | ( | const char * | file, |
| struct mapsrc * | src | ||
| ) |
Opens a GMT GRD file and read coordinate variables.
function: mapsrc_fill
Opens a GMT version 2 GRD file (netcdf). It stores the needed information, such as ids to the netcdf file, variables, and the data for the x and y coordinate variables. Note that 'struct mapsrc' contains references to arrays which must be released. If an error occurs on fill a flag will be set in the mapsrc.status field.
| file | The path of the file to read. |
| src | The mapsrc structure for storing the information about the netcdf data file. |
| float mapsrc_find | ( | struct mapsrc * | src, |
| double | x, | ||
| double | y | ||
| ) |
Find a z value at a given point.
function: mapsrc_find
Find a z-value in a map at a given x, y location
| src | The mapsrc structure pointing to the map you want to read |
| x | The x coordinate in meters UTM (use same zone as netCDF file). |
| y | The y coordinate in meters UTM (use same zone as netCDF file). |
| void mapsrc_free | ( | struct mapsrc * | src | ) |
Frees the memory used by a mapsrc structure.
function: mapsrc_free
A mapsrc structure references to arrays. This function will free those arrays as well as the parent structure.
| src | Is the mapsrc structure to be freed |
| struct mapsrc* mapsrc_init | ( | void | ) |
Initializes a mapsrc structure.
function: mapsrc_init
Allocates memory for a mapsrc structure and sets the status flags. You will need to call 'mapsrc_free' on the structure to release it's memory when you are finished with it.
| char* mapsrc_tostring | ( | struct mapsrc * | src | ) |
create a string of a mapsrc structure
function: mapsrc_tostring
| src | The mapsrc structure |
| int nearest | ( | double | key, |
| const double * | base, | ||
| size_t | nmemb | ||
| ) |
Find the index of the nearest value.
function: nearest
Finds the index of the nearest value in a double array to a key value. this is a naive implementation but should get us going.
| key | The key value |
| base | The double array that you're searcng to find the nearest value in. This implementation of nearest assumes the arrays are sorted ascending. |
| nmemb | The number of elements in the base array |
| void z_print | ( | const float * | z, |
| int | rows, | ||
| int | columns | ||
| ) |
1.8.6