MCPcopy Create free account
hub / github.com/GenericMappingTools/gmt / GMT_Convert_Data

Function GMT_Convert_Data

src/gmt_api.c:15002–15109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15000#define GMT_FORMAT_MODE 1 /* Same as GMT_TYPE_MODE [not a typo] */
15001
15002void *GMT_Convert_Data (void *V_API, void *In, unsigned int family_in, void *Out, unsigned int family_out, unsigned int flag[]) {
15003 /* Convert between valid pairs of objects, If Out == NULL then we allocate an output object,
15004 * otherwise we assume we are given adequate space already. This is most likely restricted to a GMT_MATRIX.
15005 * flag is an array with two unsigned integers controlling various aspects of the conversion:
15006 * flag[0]: Controls how headers are handled on output:
15007 * 0 : All headers are passed on as is. For Matrix/Vector all table headers are always ignored but
15008 * segment headers will be encoded as NaN records
15009 * 1 : Headers are not copied, but segment headers are preserved
15010 * 2 : Headers are preserved, but segment headers are initialized to blank
15011 * 3 : All headers headers are eliminated
15012 * The GMT Default settings in effect will control any output to files later.
15013 * [Note if that happens it is not considered an error, so API->error is GMT_NOERROR].
15014 * flag[1]: Controls the data type to use for MATRIX and VECTOR.
15015 * 0: Use the GMT default data type [GMT_EXPORT_TYPE]
15016 * >0: Assumed to contain datatype + 1 (e.g., GMT_FLOAT+1, GMT_DOUBLE+1)
15017 * If DATASET, this integer controls the restructuring of the set:
15018 * GMT_WRITE_TABLE_SEGMENT: Combine all segments into a SINGLE segment in ONE table
15019 * GMT_WRITE_TABLE: Collect all segments into ONE table.
15020 * GMT_WRITE_SEGMENT: Combine segments into ONE segment per table.
15021 * 0: Retain initial layout.
15022 * If GRID then flags are not yet used
15023 *
15024 * The following conversions are valid; the brackets indicate any side-effects or limitations]
15025 *
15026 * DATASET -> MATRIX, VECTOR
15027 * MATRIX -> DATASET, VECTOR
15028 * VECTOR -> DATASET, MATRIX
15029 * GRID -> MATRIX
15030 */
15031 int object_ID, item;
15032 void *X = NULL;
15033 struct GMTAPI_CTRL *API = NULL;
15034
15035 if (V_API == NULL) return_null (V_API, GMT_NOT_A_SESSION);
15036 API = gmtapi_get_api_ptr (V_API);
15037 API->error = GMT_NOERROR;
15038
15039 switch (family_in) {
15040 case GMT_IS_DATASET:
15041 switch (family_out) {
15042 case GMT_IS_DATASET:
15043 X = gmtapi_dataset2dataset (API, In, Out, flag[GMT_HEADER_MODE], flag[GMT_TYPE_MODE]);
15044 break;
15045 case GMT_IS_MATRIX:
15046 X = gmtapi_dataset2matrix(API, In, Out, flag[GMT_HEADER_MODE], flag[GMT_TYPE_MODE]);
15047 break;
15048 case GMT_IS_VECTOR:
15049 X = gmtapi_dataset2vector (API, In, Out, flag[GMT_HEADER_MODE], flag[GMT_TYPE_MODE]);
15050 break;
15051 default:
15052 API->error = GMT_NOT_A_VALID_FAMILY;
15053 break;
15054 }
15055 break;
15056 case GMT_IS_MATRIX:
15057 switch (family_out) {
15058 case GMT_IS_DATASET:
15059 X = gmtapi_matrix2dataset (API, In, Out, flag[GMT_HEADER_MODE]);

Callers 3

GMT_gmtconvertFunction · 0.85
mainFunction · 0.85
GMT_Convert_Data_Function · 0.85

Calls 12

gmtapi_get_api_ptrFunction · 0.85
gmtapi_dataset2datasetFunction · 0.85
gmtapi_dataset2matrixFunction · 0.85
gmtapi_dataset2vectorFunction · 0.85
gmtapi_matrix2datasetFunction · 0.85
gmtapi_matrix2vectorFunction · 0.85
gmtapi_vector2datasetFunction · 0.85
gmtapi_vector2matrixFunction · 0.85
gmtapi_grid2matrixFunction · 0.85
GMT_Register_IOFunction · 0.85
gmtlib_validate_idFunction · 0.85
gmtapi_list_objectsFunction · 0.85

Tested by 1

mainFunction · 0.68