.\" Man page generated from reStructuredText. . .TH "X2SYS_INIT" "1gmt" "May 21, 2019" "5.4.5" "GMT" .SH NAME x2sys_init \- Initialize a new x2sys track database . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp \fBx2sys_init\fP \fITAG\fP \fB\-D\fP\fIdeffile\fP [ \fB\-C\fP\fBc\fP|\fBf\fP|\fBg\fP|\fBe\fP ] [ \fB\-E\fP\fIsuffix\fP ] [ \fB\-F\fP ] [ \fB\-G\fP\fBd\fP|\fBg\fP ] [ \fB\-I\fP\fIdx\fP[/\fIdy\fP] ] [ \fB\-N\fP\fBd\fP|\fBs\fP\fIunit\fP ] [ \fB\-R\fP\fIregion\fP ] [ \fB\-V\fP[\fIlevel\fP] ] [ \fB\-W\fP\fBt\fP|\fBd\fP\fIgap\fP ] .sp \fBNote:\fP No space is allowed between the option flag and the associated arguments. .SH DESCRIPTION .sp \fBx2sys_init\fP is the starting point for anyone wishing to use x2sys; it initializes a set of data bases that are particular to one kind of track data. These data, their associated data bases, and key parameters are given a short\-hand notation called an x2sys TAG. The TAG keeps track of settings such as file format, whether the data are geographic or not, and the binning resolution for track indices. Running \fBx2sys_init\fP is a prerequisite to running any of the other x2sys programs, such as x2sys_binlist, which will create a crude representation of where each data track go within the domain and which observations are available; this information serves as input to x2sys_put which updates the track data base. Then, x2sys_get can be used to find which tracks and data are available inside a given region. With that list of tracks you can use x2sys_cross to calculate track crossovers, use x2sys_report to report crossover statistics or x2sys_list to pull out selected crossover information that x2sys_solve can use to determine track\-specific systematic corrections. These corrections may be used with x2sys_datalist to extract corrected data values for use in subsequent work. Because you can run \fBx2sys_init\fP you \fImust\fP set the environmental parameter X2SYS_HOME to a directory where you have write permission, which is where x2sys can keep track of your settings. .SH REQUIRED ARGUMENTS .INDENT 0.0 .TP .B \fITAG\fP The unique name of this data type x2sys TAG. .UNINDENT .INDENT 0.0 .TP \fB\-D\fP\fIdeffile\fP Definition file prefix for this data set [See DEFINITION FILES below for more information]. Specify full path if the file is not in the current directory. .UNINDENT .SH OPTIONAL ARGUMENTS .INDENT 0.0 .TP \fB\-Cc\fP|\fBf\fP|\fBg\fP|\fBe\fP Select procedure for along\-track distance calculation when needed by other programs: .sp \fBc\fP Cartesian distances [Default, unless \fB\-G\fP is set]. .sp \fBf\fP Flat Earth distances. .sp \fBg\fP Great circle distances [Default if \fB\-G\fP is set]. .sp \fBe\fP Geodesic distances on current GMT ellipsoid. .UNINDENT .INDENT 0.0 .TP \fB\-E\fP\fIsuffix\fP Specifies the file extension (suffix) for these data files. If not given we use the definition file prefix as the suffix (see \fB\-D\fP). .UNINDENT .INDENT 0.0 .TP \fB\-F\fP Force creating new files if old ones are present [Default will abort if old TAG files are found]. .UNINDENT .INDENT 0.0 .TP \fB\-Gd\fP|\fBg\fP Selects geographical coordinates. Append \fBd\fP for discontinuity at the Dateline (makes longitude go from \-180 to + 180) or \fBg\fP for discontinuity at Greenwich (makes longitude go from 0 to 360 [Default]). If not given we assume the data are Cartesian. .UNINDENT .INDENT 0.0 .TP \fB\-I\fP\fIdx\fP[/\fIdy\fP] \fIx_inc\fP [and optionally \fIy_inc\fP] is the grid spacing. Append \fBm\fP to indicate minutes or \fBc\fP to indicate seconds for geographic data. These spacings refer to the binning used in the track bin\-index data base. .UNINDENT .INDENT 0.0 .TP \fB\-Nd\fP|\fBs\fP\fIunit\fP Sets the units used for distance and speed when requested by other programs. Append \fBd\fP for distance or \fBs\fP for speed, then give the desired \fIunit\fP as \fBc\fP (Cartesian userdist or userdist/usertime), \fBe\fP (meters or m/s), \fBf\fP (feet or feet/s), \fBk\fP (km or kms/hr), \fBm\fP (miles or miles/hr), \fBn\fP (nautical miles or knots) or \fBu\fP (survey feet or survey feet/s). [Default is \fB\-Ndk\fP \fB\-Nse\fP (km and m/s) if \fB\-G\fP is set and \fB\-Ndc\fP and \fB\-Nsc\fP otherwise (Cartesian units)]. .UNINDENT .INDENT 0.0 .TP \fB\-R\fP\fIwest\fP/\fIeast\fP/\fIsouth\fP/\fInorth\fP[/\fIzmin\fP/\fIzmax\fP][\fB+r\fP][\fB+u\fP\fIunit\fP] \fIwest\fP, \fIeast\fP, \fIsouth\fP, and \fInorth\fP specify the region of interest, and you may specify them in decimal degrees or in [±]dd:mm[:ss.xxx][\fBW\fP|\fBE\fP|\fBS\fP|\fBN\fP] format Append \fB+r\fP if lower left and upper right map coordinates are given instead of w/e/s/n. The two shorthands \fB\-Rg\fP and \fB\-Rd\fP stand for global domain (0/360 and \-180/+180 in longitude respectively, with \-90/+90 in latitude). Alternatively for grid creation, give \fBR\fP\fIcode\fP\fIlon\fP/\fIlat\fP/\fInx\fP/\fIny\fP, where \fIcode\fP is a 2\-character combination of L, C, R (for left, center, or right) and T, M, B for top, middle, or bottom. e.g., BL for lower left. This indicates which point on a rectangular region the \fIlon\fP/\fIlat\fP coordinate refers to, and the grid dimensions \fInx\fP and \fIny\fP with grid spacings via \fB\-I\fP is used to create the corresponding region. Alternatively, specify the name of an existing grid file and the \fB\-R\fP settings (and grid spacing, if applicable) are copied from the grid. Appending \fB+u\fP\fIunit\fP expects projected (Cartesian) coordinates compatible with chosen \fB\-J\fP and we inversely project to determine actual rectangular geographic region. For perspective view (\fB\-p\fP), optionally append /\fIzmin\fP/\fIzmax\fP\&. In case of perspective view (\fB\-p\fP), a z\-range (\fIzmin\fP, \fIzmax\fP) can be appended to indicate the third dimension. This needs to be done only when using the \fB\-Jz\fP option, not when using only the \fB\-p\fP option. In the latter case a perspective view of the plane is plotted, with no third dimension. For Cartesian data just give \fIxmin/xmax/ymin/ymax\fP\&. This option bases the statistics on those COE that fall inside the specified domain. .UNINDENT .INDENT 0.0 .TP \fB\-V\fP[\fIlevel\fP] (more ...) Select verbosity level [c]. .TP \fB\-Wt\fP|\fBd\fP\fIgap\fP Give \fBt\fP or \fBd\fP and append the corresponding maximum time gap (in user units; this is typically seconds [Infinity]), or distance (for units, see \fB\-N\fP) gap [Infinity]) allowed between the two data points immediately on either side of a crossover. If these limits are exceeded then a data gap is assumed and no COE will be determined. .UNINDENT .INDENT 0.0 .TP \fB\-^\fP or just \fB\-\fP Print a short message about the syntax of the command, then exits (NOTE: on Windows just use \fB\-\fP). .TP \fB\-+\fP or just \fB+\fP Print an extensive usage (help) message, including the explanation of any module\-specific option (but not the GMT common options), then exits. .TP \fB\-?\fP or no arguments Print a complete usage (help) message, including the explanation of all options, then exits. .UNINDENT .SH DEFINITION FILES .sp These *.def files contain information about the data file format and have two sections: (1) header information and (2) column information. All header information starts with the character # in the first column, immediately followed by an upper\-case directive. If the directive takes an argument it is separated by white\-space. You may append a trailing # comments. Five directives are recognized: .sp \fBASCII\fP states that the data files are in ASCII format. .sp \fBBINARY\fP states that the data files are native binary files. .sp \fBNETCDF\fP states that the data files are COARDS\-compliant 1\-D netCDF files. .sp \fBSKIP\fP takes an integer argument which is either the number of lines to skip (when reading ASCII files) or the number of bytes to skip (when reading native binary files). Not used with netCDF files. .sp \fBGEO\fP indicates that these files are geographic data sets, with periodicities in the \fIx\fP\-coordinate (longitudes). Alternatively, use \fB\-G\fP\&. .sp \fBMULTISEG\fP means each track consists of multiple segments separated by a GMT segment header (alternatively, use \fB\-m\fP when defining the system TAG). Not used with netCDF files. .sp The column information consists of one line per column in the order the columns appear in the data file. For each column you must provide seven attributes: .sp \fIname type NaN NaN\-proxy scale offset oformat\fP .sp \fIname\fP is the name of the column variable. It is expected that you will use the special names \fIlon\fP (or \fIx\fP if Cartesian) and \fIlat\fP (or \fIy\fP) for the two required coordinate columns, and \fItime\fP when optional time data are present. .sp \fItype\fP is always \fBa\fP for ASCII representations of numbers, whereas for binary files you may choose among \fBc\fP for signed 1\-byte character (\-127,+128), \fBu\fP for unsigned byte (0\-255), \fBh\fP for signed 2\-byte integers (\-32768,+32767), \fBi\fP for signed 4\-byte integers (\-2,147,483,648,+2,147,483,647), \fBf\fP for 4\-byte floating points and \fBd\fP for 8\-byte double precision floating points. For netCDF, simply use \fBd\fP as netCDF will automatically handle type\-conversions during reading. .sp \fINaN\fP is Y if certain values (e.g, \-9999) are to be replaced by NAN, and N otherwise. .sp \fINaN\-proxy\fP is that special value (e.g., \-9999). .sp \fIscale\fP is used to multiply the data after reading. .sp \fIoffset\fP is used to add to the scaled data. .sp \fIoformat\fP is a C\-style format string used to print values from this column. .sp If you give \- as the \fIoformat\fP then GMT\(aqs formatting machinery will be used instead (i.e., FORMAT_FLOAT_OUT, FORMAT_GEO_MAP, FORMAT_DATE_MAP, FORMAT_CLOCK_MAP). Some file formats already have definition files premade. These include mgd77 (for plain ASCII MGD77 data files), mgd77+ (for enhanced MGD77+ netCDF files), gmt (for old mgg supplement binary files), xy (for plain ASCII x, y tables), xyz (same, with one z\-column), geo (for plain ASCII longitude, latitude files), and geoz (same, with one z\-column). .SH EXAMPLES .sp If you have a large set of track data files you can organize them using the x2sys tools. Here we will outline the steps. Let us assume that your track data file format consist of 2 header records with text information followed by any number of identically formatted data records with 6 columns (lat, lon, time, obs1, obs2, obs3) and that files are called *.trk. We will call this the "line" format. First, we create the line.def file: .TS center; |l|l|l|l|l|l|l|. _ T{ # Define file for the line format T} _ T{ # SKIP 2 T} T{ # Skip 2 header records T} _ T{ # GEO T} T{ # Data are geographic T} _ T{ #name T} T{ type T} T{ NaN T} T{ NaN\-proxy T} T{ scale T} T{ offset T} T{ oformat T} _ T{ lat T} T{ a T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %9.5f T} _ T{ lon T} T{ a T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %10.5f T} _ T{ time T} T{ a T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %7.1f T} _ T{ obs1 T} T{ a T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %7.2f T} _ T{ obs2 T} T{ a T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %7.2f T} _ T{ obs3 T} T{ a T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %7.2f T} _ .TE .sp Next we create the TAG and the TAG directory with the databases for these line track files. Assuming these contain geographic data and that we want to keep track of the data distribution at a 1 x 1 degree resolution, with distances in km calculated along geodesics and with speeds given in knots, we may run .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C gmt x2sys_init LINE \-V \-G \-Dline \-Rg \-Ce \-Ndk \-NsN \-I1/1 \-Etrk .ft P .fi .UNINDENT .UNINDENT .UNINDENT .UNINDENT .sp where we have selected LINE to be our x2sys tag. When x2sys tools try to read your line data files they will first look in the current directory and second look in the file \fITAG\fP_paths.txt for a list of additional directories to examine. Therefore, create such a file (here LINE_paths.txt) and stick the full paths to your data directories there. All TAG\-related files (definition files, tag files, and track data bases created) will be expected to be in the directory pointed to by \fB$X2SYS_HOME\fP/\fITAG\fP (in our case \fB$X2SYS_HOME\fP/LINE). Note that the argument to \fB\-D\fP must contain the full path if the *.def file is not in the current directory. \fBx2sys_init\fP will copy this file to the \fB$X2SYS_HOME\fP/\fITAG\fP directory where all other x2sys tools will expect to find it. .INDENT 0.0 .TP \fBCreate tbf file(s):\fP Once the (empty) TAG databases have been initialized we go through a two\-step process to populate them. First we run x2sys_binlist on all our track files to create one (or more) multisegment track bin\-index files (tbf). These contain information on which 1 x 1 degree bins (or any other blocksize; see \fB\-I\fP) each track has visited and which observations (in your case obs1, obs2, obs3) were actually observed (not all tracks may have all three kinds of observations everywhere). For instance, if your tracks are listed in the file tracks.lis we may run this command: .INDENT 7.0 .INDENT 3.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C gmt x2sys_binlist \-V \-TLINE :tracks.lis > tracks.tbf .ft P .fi .UNINDENT .UNINDENT .UNINDENT .UNINDENT .TP \fBUpdate index data base:\fP Next, the track bin\-index files are fed to x2sys_put which will insert the information into the TAG databases: .INDENT 7.0 .INDENT 3.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C gmt x2sys_put \-V \-TLINE tracks.tbf .ft P .fi .UNINDENT .UNINDENT .UNINDENT .UNINDENT .TP \fBSearch for data:\fP You may now use x2sys_get to find all the tracks within a certain sub\-region, and optionally limit the search to those tracks that have a particular combination of observables. E.g., to find all the tracks which has both obs1 and obs3 inside the specified region, run .INDENT 7.0 .INDENT 3.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C gmt x2sys_get \-V \-TLINE \-R20/40/\-40/\-20 \-Fobs1,obs3 > tracks.tbf .ft P .fi .UNINDENT .UNINDENT .UNINDENT .UNINDENT .TP \fBMGD77[+] or GMT:\fP Definition files already exist for MGD77 files (both standard ASCII and enhanced netCDF\-based MGD77+ files) and the old *.gmt files manipulated by the mgg supplements; for these data sets the \fB\-C\fP and \fB\-N\fP will default to great circle distance calculation in km and speed in m/s. There are also definition files for plain x,y[,z] and lon,lat[,z] tracks. To initiate new track databases to be used with MGD77 data from NGDC, try .INDENT 7.0 .INDENT 3.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C gmt x2sys_init MGD77 \-V \-Dmgd77 \-Emgd77 \-Rd \-Gd \-Nsn \-I1/1 \-Wt900 \-Wd5 .ft P .fi .UNINDENT .UNINDENT .UNINDENT .UNINDENT .sp where we have chosen a 15 minute (900 sec) or 5 km threshold to indicate a data gap and selected knots as the speed; the other steps are similar. .TP \fBBinary files:\fP Let us pretend that your line files actually are binary files with a 128\-byte header structure (to be skipped) followed by the data records and where \fIlon\fP, \fIlat\fP, \fItime\fP are double precision numbers while the three observations are 2\-byte integers which must be multiplied by 0.1. Finally, the first two observations may be \-32768 which means there is no data available. All that is needed is a different line.def file: .TS center; |l|l|l|l|l|l|l|. _ T{ # Define file for the binary line format T} _ T{ # BINARY T} T{ # File is now binary T} _ T{ # SKIP 128 T} T{ # Skip 128 bytes T} _ T{ # GEO T} T{ # Data are geographic T} _ T{ #name T} T{ type T} T{ NaN T} T{ NaN\-proxy T} T{ scale T} T{ offset T} T{ oformat T} _ T{ lon T} T{ d T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %10.5f T} _ T{ lat T} T{ d T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %9.5f T} _ T{ time T} T{ d T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %7.1f T} _ T{ obs1 T} T{ h T} T{ Y T} T{ \-32768 T} T{ 0.1 T} T{ 0 T} T{ %6.1f T} _ T{ obs2 T} T{ h T} T{ Y T} T{ \-32768 T} T{ 0.1 T} T{ 0 T} T{ %6.1f T} _ T{ obs3 T} T{ h T} T{ N T} T{ 0 T} T{ 0.1 T} T{ 0 T} T{ %6.1f T} _ .TE .sp The rest of the steps are identical. .TP \fBCOARDS 1\-D netCDF files:\fP Finally, suppose that your line files actually are netCDF files that conform to the COARDS convention, with data columns named \fIlon\fP, \fIlat\fP, \fItime\fP, \fIobs1\fP, \fIobs2\fP, and \fIobs3\fP\&. All that is needed is a different line.def file: .TS center; |l|l|l|l|l|l|l|. _ T{ # Define file for the netCDF COARDS line format T} _ T{ # NETCDF T} T{ # File is now netCDF T} _ T{ # GEO T} T{ # Data are geographic T} _ T{ #name T} T{ type T} T{ NaN T} T{ NaN\-proxy T} T{ scale T} T{ offset T} T{ oformat T} _ T{ lon T} T{ d T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %10.5f T} _ T{ lat T} T{ d T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %9.5f T} _ T{ time T} T{ d T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %7.1f T} _ T{ obs1 T} T{ d T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %6.1f T} _ T{ obs2 T} T{ d T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %6.1f T} _ T{ obs3 T} T{ d T} T{ N T} T{ 0 T} T{ 1 T} T{ 0 T} T{ %6.1f T} _ .TE .sp Note we use no scaling or NAN proxies since those issues are usually handled internally in the netCDF format description. .UNINDENT .SH SEE ALSO .sp x2sys_binlist, x2sys_datalist, x2sys_get, x2sys_list, x2sys_put, x2sys_report, x2sys_solve, x2sys_cross .SH COPYRIGHT 2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe .\" Generated by docutils manpage writer. .