mgd77manage − Manage extra columns in MGD77+ files |
mgd77manage NGDC-ids [ −A[+]a|c|d|D|e|g|i|n|t|Tfileinfo ] [ −Cf|g|e ] [ −Dabbrev1,abbrev2,... ] [ −Eempty ] [ −Iabbrev/name/unit/type/scale/offset/comment ] [ −Ne|k|m|n ] [ −Q[value] ] [ −V ] [ −bin[s|d] ] |
mgd77manage deals with maintaining extra custom columns in MGD77+ netCDF files. You can either delete one or more columns, add a new column, update an existing column with new data, or supply error correction information (*.e77 files). New data may come from a table (ASCII unless −b is used), be based on existing columns and certain theoretical expressions, or they may be obtained by sampling a grid (choose between GMT grid or a Sandwell/Smith Mercator *.img grid) along track. The new data will be appended to the MGD77+ file in the form of an extra data column of specified type. The data file will be modified; no new file will be created. For the big issues, see the DISCUSSION section below. |
NGDC-ids |
Can be one or more MGD77 8-character cruise identifiers. To give a list of names, use ‘cat cruises.lis‘. The ".mgd77" or ".nc" extensions will automatically be appended, if needed (use −I to ignore certain file types). Cruise files will be looked for first in the current directory and second in all directories listed in $MGD77_HOME/mgd77_paths.txt [If $MGD77_HOME is not set it will default to $GMTHOME/share/mgd77]. |
No space between the option flag and the associated arguments |
−A |
Add a new data column. If an existing column with the same abbreviation already exists in the file we will cowardly refuse to update the file. Specifying −A+ overcomes this reluctance (However, sometimes an existing column cannot be upgraded without first deleting it; if so you will be warned). Select a column source code among a, c, d, D, e, g, i, n, t, or T; detailed descriptions for each choice follow: |
a Append filename of a single column table to add. File must have the same number of rows as the MGD77+ file. If no file is given we read from stdin instead. c Create a new column that derives from existing data or formulas for corrections and reference fields. Append c for the Carter corrections subtracted from uncorrected depths, g for the IGF gravity reference field (a.k.a "normal gravity"), and m for the IGRF total field magnetic reference field. For gravity we choose the reference field based on the parameter Gravity Theoretical Formula Code in the cruise’s MGD77 header. If this is not set or is invalid we default to the IGF 1980.’ You can override this behaviour by appending the desired code: 1 = Heiskanen 1924, 2 = International 1930, 3 = IGF1967, or 4 = IGF1980. d Append filename of a two-column table with the first column holding distances along track and the second column holding data values. If no file is given we read from stdin instead. Records with matching distances in the MGD77+ file will be assigned the new values; at other distances we set them to NaN. Alternatively, give upper case D instead and we will interpolate the column at all record distances. See −N for chosing distance units and −C for chosing how distances are calculated. e Read the e77 error/correction log from mgd77sniffer and add or update the special column flag which will hold bitflags (0 = GOOD, 1 = BAD) for each data field in the standard MGD77 data set. Any correction terms found (such as needing to scale a field by 0.1 or 10 because the source agency used incorrect units) will be written as attributes to the netCDF MGD77+ file and applied when the data are read by mgd77list. g Sample a GMT geographic (lon, lat) grid along the track given by the MGD77+ file using bicubic interpolation (however, see −Q). Append name of a GMT grid file. i Sample a Sandwell/Smith Mercator *.img grid along the track given by the MGD77+ file using bicubic interpolation (however, see −Q). Append grid spacing in minutes (1 or 2), the gridded data scale (typically 1 or 10), the IMG file mode (0-3), and finally the img grid filename. The modes stand for the following: (0) Img files with no constraint code, returns data at all points, (1) Img file with constraints coded, return data at all points, (2) Img file with constraints coded, return data only at constrained points and NaN elsewhere, and (3) Img file with constraints coded, return 1 at constraints and 0 elsewhere. n Append filename of a two-column table with the first column holding the record number (0 to nrows - 1) and the second column holding data values. If no file is given we read from stdin instead. Records with matching record numbers in the MGD77+ file will be assigned the new values; at other records we set them to NaN. t Append filename of a two-column table with the first column holding absolute times along track and the second column holding data values. If no file is given we read from stdin instead. Records with matching times in the MGD77+ file will be assigned the new values; at other times we set them to NaN. Alternatively, give upper case T instead and we will interpolate the column at all record times. |
−C |
Append a one-letter code to select the procedure for along-track distance calculation when using −Ad|D (see −N for selecting distance units): |
f Flat Earth distances. |
−D |
Give a comma-separated list of column abbreviations that you want to delete from the MGD77+ files. Do NOT use this option to remove columns that you are replacing with new data (use −A+ instead). Because we cannot remove variables from netCDF files we must create a new file without the columns to be deleted. Once the file is successfully created we temporarily rename the old file, change the new filename to the old filename, and finally remove the old, renamed file. |
||
−E |
Give a single character that will be repeated to fill empty string values, e.g., ’9’ will yield a string like "99999..." [9]. |
||
−I |
In addition to file information we must specify additional information about the extra column. Specify a short (16 char or less, using letters, digits, or underscores only) abbreviation for the selected data, its more descriptive name, the data unit, the data type 1-character code (byte, short, float, int, double, or text) you want used for storage in the netCDF file, any scale and offset we should apply to the data to make them fit inside the range implied by the chosen storage type, and a general comment (< 128 characters) regarding what these data represent. Note: If text data type is selected then the terms "values" in the −A discussion refer to your text data. Furthermore, the discussion on interpolation does not apply and the NaN value becomes a "no string" value (see −E for what this is). Place quotes around terms with more than one word (e.g., "Corrected Depth"). |
||
−N |
Specify the distance unit used when using −Ad|D by appending e (meter), k (km), m (miles), or n (nautical miles). [Default is −Nk (km)]. |
||
−Q |
Quick mode, use bilinear rather than bicubic interpolation [Default]. Optionally, append value in the 0 <= value <= 1 range. This parameter controls how close to nodes with NaN values the interpolation will go. E.g., a value of 0.5 will interpolate about 1/2-way from a non-NaN to a NaN node, whereas 0.1 will go about 90% of the way, etc. [Default is 1, which means none of the four nearby nodes may be NaN]. A value of 0 will just return the value of the nearest node instead of interpolating. Only relevant when −Ag|i is selected. |
||
−V |
Selects verbose mode, which will send progress reports to stderr [Default runs "silently"]. |
||
−bi |
Selects binary input. Append s for single precision [Default is double]. Uppercase S (or D) will force byte-swapping. This applies to the input 1- or 2-column data files specified under some of the −A options. The binary input option is only available for numerical data columns. |
To append Geosat/ERS-1 gravity version 11.2 as an extra data column in the cruises 01010047.nc and 01010008.nc, storing the values as mGal*10 in a 2-byte short integer, try mgd77manage 01010047 01010008 −Ai2/10/1/grav.11.2.img −Isatgrav/"Geosat/ERS-1 gravity"/"mGal"/s/10/0/"Sandwell/Smith version 11.2" −V To append a filtered version of magnetics as an extra data column of type float for the cruise 01010047.nc, and interpolate the filtered data at the times given in the MGD77+ file, try mgd77manage 01010047 −ATmymag.tm −Ifiltmag/"Intermediate-wavelength magnetic residuals"/"nTesla"/f/1/0/"Useful for looking for isochrons" −V To delete the existing extra columns satfaa, coastdist, and satvgg from all MGD77+ files, try mgd77manage ‘cat allmgd77.lis‘ −Dsatfaa,coastdist,satvgg −V To create a 4-byte float column with the correct IGRF reference field in all MGD77+ files, try mgd77manage ‘cat allmgd77.lis‘ −Acm −Iigrf/"IGRF reference field"/"nTesla"/f/1/0/"IGRF version 10 for 1990-2010" −V |
1. Preamble 2. Introduction 3. Conversion mgd77convert −Fa −Tc −V −Lwe+ ‘cat cruises.lis‘ > log.txt The verbose settings will ensure that all problems found during conversion will be reported. The new *.nc files may also be placed in one or more separate sub-directories and these should also be listed in the mgd77_paths.txt file. We suggest you place the directories with *.nc files ahead of the *.mgd77 directories. When you later want to limit a search to files of a certain extension you should use the −I option. 4. Adding new columns 5. Error sources 6. Finding errors 7. Error corrections |
The IGRF calculations are based on a Fortran program written by Susan Macmillan, British Geological Survey, translated to C via f2c by Joaquim Luis, and adapted to GMT style by Paul Wessel. |
mgd77convert(l), mgd77list(l), mgd77info(l), mgd77track(l) x2sys_init(l) |
Wessel, P., and W. H. F. Smith, 2005, The Generic Mapping
Tools (GMT) version 4.1 Technical Reference & Cookbook,
SOEST/NOAA. |