/*-------------------------------------------------------------------- * The MB-system: mb_lgpl.h 9/13/2004 * $Id: $ * * Copyright (c) 2004-2012 by * David W. Caress (caress@mbari.org) * Monterey Bay Aquarium Research Institute * Moss Landing, CA 95039 * and Dale N. Chayes (dale@ldeo.columbia.edu) * Lamont-Doherty Earth Observatory * Palisades, NY 10964 * * This file contains source code modified from source files * distributed as part of MB-System. In contrast to the GPL-licensed * MB-System distributions, the code contained here is licensed * under the Lesser GNU Public license, or LGPL. This means that * compiled versions of these functions, or functions derived from * modifications to this code, may be linked with commercial * applications without imposing any restriction on the sale and * and distribution of those applications. * * The full LGPL text may be accessed at http://www.gnu.org/ * * The release of this code under the LGPL does not change the * the GPL licensing of any code contained in the regular * MB-System distribution. * * The source code provided here does not come with any warranties, * nor is it guarenteed to work on your computer or to do * anything useful. The user assumes full responsibility for * the use of this software. In particular, David W. Caress, * Dale N. Chayes, the Lamont-Doherty Earth Observatory of * Columbia University, the Monterey Bay Aquarium Research Institute, * or any other individuals or organizations involved in the * design and maintenance of the MB-System software package * and derived distributions are NOT responsible for any * damage that may follow from correct or incorrect use of this * source code. Moreover, it should be noted that the source * code provided here has NOT been tested after modification * from the related functions that are part of MB-System. * * To access MB-System documentation or source code releases see: * http://www.mbari.org/data/mbsystem * http://www.ldeo.columbia.edu/MB-System * *--------------------------------------------------------------------*/ /* * Author: D. W. Caress * Originated: September 13, 2004 * Revised: May 16, 2012 * * $Log: $ * *--------------------------------------------------------------------*/ /* * This header file mb_lgpl.h includes structure and macro definitions * required for the source provided in the file mb_lgpl.c to compile. * */ /* include this code only once */ #ifndef MBLGPL_HEADER_DEF #define MBLGPL_HEADER_DEF /* MBLGPL function boolean convention */ #define MBLGPL_YES 1 #define MBLGPL_NO 0 /* MBIO function status convention */ #define MBLGPL_SUCCESS 1 #define MBLGPL_FAILURE 0 /* MBIO function fatal error values */ #define MBLGPL_ERROR_NO_ERROR 0 #define MBLGPL_ERROR_MEMORY_FAIL 1 #define MBLGPL_ERROR_EOF 4 #define MBLGPL_ERROR_UNINTELLIGIBLE -8 /* MBLGPL data type ("kind") convention */ #define MBLGPL_DATA_NONE 0 #define MBLGPL_DATA_DATA 1 /* general survey data */ #define MBLGPL_DATA_COMMENT 2 /* general comment */ /* define record id tags */ #define MBLGPL_FBT_ID_COMMENT1 8995 /* ## */ #define MBLGPL_FBT_ID_COMMENT2 25443 /* cc */ #define MBLGPL_FBT_ID_V1DATA 25700 /* dd */ #define MBLGPL_FBT_ID_V2DATA 28270 /* nn */ #define MBLGPL_FBT_ID_V3DATA 17476 /* DD */ #define MBLGPL_FBT_ID_V4DATA 13398 /* V4 */ /* define some important sizes */ #define MBLGPL_FBT_V1HEADERSIZE 38 #define MBLGPL_FBT_V2HEADERSIZE 44 #define MBLGPL_FBT_V3HEADERSIZE 48 #define MBLGPL_FBT_V4HEADERSIZE 90 #define MBLGPL_FBT_COMMENTSIZE 128 /* define byte swapping macros */ #define mblgpl_swap_short(a) ( ((a & 0xff) << 8) | ((unsigned short)(a) >> 8) ) #define mblgpl_swap_int(a) ( ((a) << 24) | \ (((a) << 8) & 0x00ff0000) | \ (((a) >> 8) & 0x0000ff00) | \ ((unsigned int)(a) >>24) ) #define mblgpl_swap_long(a) ( ((a) << 56) | \ (((a) << 40) & 0x00ff000000000000) | \ (((a) << 24) & 0x0000ff0000000000) | \ (((a) << 8) & 0x000000ff00000000) | \ (((a) >> 8) & 0x00000000ff000000) | \ (((a) >> 24) & 0x0000000000ff0000) | \ (((a) >> 40) & 0x000000000000ff00) | \ ((unsigned long)(a) >> 56)) /* data storage structure for fbt swath bathymetry data */ struct mblgpl_fbt_struct { /* type of data record */ int kind; /* time stamp */ double time_d; /* decimal seconds since start of 1970 */ /* position */ double longitude; /* longitude (degrees 0-360) */ double latitude; /* latitude (degrees 0-360) */ /* sonar depth and altitude */ double sonardepth; /* meters (sonar depth for bathymetry calculation, already corrected for heave if needed, sonardepth = transducer_depth bath = altitude + sonardepth sonardepth = draft - heave draft = sonardepth + heave */ double altitude; /* meters */ /* heading and speed */ float heading; /* heading (degrees 0-360) */ float speed; /* km/hour */ /* attitude */ float roll; /* degrees */ float pitch; /* degrees */ float heave; /* meters */ /* beam widths */ float beam_xwidth; /* degrees */ float beam_lwidth; /* degrees */ /* numbers of beams */ short beams_bath; /* number of depth values */ short beams_amp; /* number of amplitude values */ short pixels_ss; /* number of sidescan pixels */ short spare1; short beams_bath_alloc; /* number of depth values allocated */ short beams_amp_alloc; /* number of amplitude values allocated */ short pixels_ss_alloc; /* number of sidescan pixels allocated */ /* scaling */ float depth_scale; /* depth[i] = (bath[i] * depth_scale) + transducer_depth */ float distance_scale; /* acrosstrackdistance[i] = acrosstrack[i] * distance_scale alongtrackdistance[i] = alongtrack[i] * distance_scale */ /* sidescan type */ short ss_type; /* indicates if sidescan values are logarithmic or linear ss_type = 0: logarithmic (dB) ss_type = 1: linear (voltage) */ short spare2; /* pointers to arrays */ unsigned char *beamflag; short *bath; short *amp; short *bath_acrosstrack; short *bath_alongtrack; short *ss; short *ss_acrosstrack; short *ss_alongtrack; /* comment */ char comment[MBLGPL_FBT_COMMENTSIZE]; }; /* data storage structure for old fbt swath bathymetry data */ struct mblgpl_oldfbt_struct { /* type of data record */ int kind; /* time stamp */ short year; /* year (4 digits) */ short day; /* julian day (1-366) */ short min; /* minutes from beginning of day (0-1439) */ short sec; /* seconds from beginning of minute (0-59) */ short msec; /* milliseconds from beginning of minute (0-59) */ /* position */ unsigned short lon2u; /* minutes east of prime meridian */ unsigned short lon2b; /* fraction of minute times 10000 */ unsigned short lat2u; /* number of minutes north of 90S */ unsigned short lat2b; /* fraction of minute times 10000 */ /* heading and speed */ unsigned short heading;/* heading: 0 = 0 degrees 1 = 0.0055 degrees 16384 = 90 degrees 65535 = 359.9945 degrees 0 = 360 degrees */ unsigned short speed; /* km/s X100 */ /* numbers of beams */ short beams_bath; /* number of depth values */ short beams_amp; /* number of amplitude values */ short pixels_ss; /* number of sidescan pixels */ short beams_bath_alloc; /* number of depth values allocated */ short beams_amp_alloc; /* number of amplitude values allocated */ short pixels_ss_alloc; /* number of sidescan pixels allocated */ /* scaling */ short depth_scale; /* 1000*scale where depth = bath*scale + transducer_depth * 1000 */ short distance_scale; /* 1000*scale where distance = dist*scale */ int transducer_depth; /* 0.001 m */ int altitude; /* 0.001 m */ short beam_xwidth; /* 0.01 degrees */ short beam_lwidth; /* 0.01 degrees */ short ss_type; /* indicates if sidescan values are logarithmic or linear ss_type = 0: logarithmic (dB) ss_type = 1: linear (voltage) */ /* pointers to arrays */ unsigned char *beamflag; short *bath; short *amp; short *bath_acrosstrack; short *bath_alongtrack; short *ss; short *ss_acrosstrack; short *ss_alongtrack; /* comment */ char comment[MBLGPL_FBT_COMMENTSIZE]; }; #endif