Gravity.usage 10.4 KB
Newer Older
Valentin Platzgummer's avatar
Valentin Platzgummer committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
int usage(int retval, bool brief) {
  if (brief)
    ( retval ? std::cerr : std::cout ) << "Usage:\n"
"    Gravity [ -n name ] [ -d dir ] [ -N Nmax ] [ -M Mmax ] [ -G | -D | -A |\n"
"    -H ] [ -c lat h ] [ -w ] [ -p prec ] [ -v ] [ --comment-delimiter\n"
"    commentdelim ] [ --version | -h | --help ] [ --input-file infile |\n"
"    --input-string instring ] [ --line-separator linesep ] [ --output-file\n"
"    outfile ]\n"
"\n"
"For full documentation type:\n"
"    Gravity --help\n"
"or visit:\n"
"    https://geographiclib.sourceforge.io/1.50.1/Gravity.1.html\n";
  else
    ( retval ? std::cerr : std::cout ) << "Man page:\n"
"NAME\n"
"       Gravity -- compute the earth's gravity field\n"
"\n"
"SYNOPSIS\n"
"       Gravity [ -n name ] [ -d dir ] [ -N Nmax ] [ -M Mmax ] [ -G | -D | -A |\n"
"       -H ] [ -c lat h ] [ -w ] [ -p prec ] [ -v ] [ --comment-delimiter\n"
"       commentdelim ] [ --version | -h | --help ] [ --input-file infile |\n"
"       --input-string instring ] [ --line-separator linesep ] [ --output-file\n"
"       outfile ]\n"
"\n"
"DESCRIPTION\n"
"       Gravity reads in positions on standard input and prints out the\n"
"       gravitational field on standard output.\n"
"\n"
"       The input line is of the form lat lon h.  lat and lon are the latitude\n"
"       and longitude expressed as decimal degrees or degrees, minutes, and\n"
"       seconds; for details on the allowed formats for latitude and longitude,\n"
"       see the \"GEOGRAPHIC COORDINATES\" section of GeoConvert(1).  h is the\n"
"       height above the ellipsoid in meters; this quantity is optional and\n"
"       defaults to 0.  Alternatively, the gravity field can be computed at\n"
"       various points on a circle of latitude (constant lat and h) via the -c\n"
"       option; in this case only the longitude should be given on the input\n"
"       lines.  The quantities printed out are governed by the -G (default),\n"
"       -D, -A, or -H options.\n"
"\n"
"       All the supported gravity models, except for grs80, use WGS84 as the\n"
"       reference ellipsoid a = 6378137 m, f = 1/298.257223563, omega =\n"
"       7292115e-11 rad/s, and GM = 3986004.418e8 m^3/s^2.\n"
"\n"
"OPTIONS\n"
"       -n name\n"
"           use gravity field model name instead of the default \"egm96\".  See\n"
"           \"MODELS\".\n"
"\n"
"       -d dir\n"
"           read gravity models from dir instead of the default.  See \"MODELS\".\n"
"\n"
"       -N Nmax\n"
"           limit the degree of the model to Nmax.\n"
"\n"
"       -M Mmax\n"
"           limit the order of the model to Mmax.\n"
"\n"
"       -G  compute the acceleration due to gravity (including the centrifugal\n"
"           acceleration due the the earth's rotation) g.  The output consists\n"
"           of gx gy gz (all in m/s^2), where the x, y, and z components are in\n"
"           easterly, northerly, and up directions, respectively.  Usually gz\n"
"           is negative.\n"
"\n"
"       -D  compute the gravity disturbance delta = g - gamma, where gamma is\n"
"           the \"normal\" gravity due to the reference ellipsoid .  The output\n"
"           consists of deltax deltay deltaz (all in mGal, 1 mGal = 10^-5\n"
"           m/s^2), where the x, y, and z components are in easterly,\n"
"           northerly, and up directions, respectively.  Note that deltax = gx,\n"
"           because gammax = 0.\n"
"\n"
"       -A  computes the gravitational anomaly.  The output consists of 3 items\n"
"           Dg01 xi eta, where Dg01 is in mGal (1 mGal = 10^-5 m/s^2) and xi\n"
"           and eta are in arcseconds.  The gravitational anomaly compares the\n"
"           gravitational field g at P with the normal gravity gamma at Q where\n"
"           the P is vertically above Q and the gravitational potential at P\n"
"           equals the normal potential at Q.  Dg01 gives the difference in the\n"
"           magnitudes of these two vectors and xi and eta give the difference\n"
"           in their directions (as northerly and easterly components).  The\n"
"           calculation uses a spherical approximation to match the results of\n"
"           the NGA's synthesis programs.\n"
"\n"
"       -H  compute the height of the geoid above the reference ellipsoid (in\n"
"           meters).  In this case, h should be zero.  The results accurately\n"
"           match the results of the NGA's synthesis programs.  GeoidEval(1)\n"
"           can compute geoid heights much more quickly by interpolating on a\n"
"           grid of precomputed results; however the results from GeoidEval(1)\n"
"           are only accurate to a few millimeters.\n"
"\n"
"       -c lat h\n"
"           evaluate the field on a circle of latitude given by lat and h\n"
"           instead of reading these quantities from the input lines.  In this\n"
"           case, Gravity can calculate the field considerably more quickly.\n"
"           If geoid heights are being computed (the -H option), then h must be\n"
"           zero.\n"
"\n"
"       -w  toggle the longitude first flag (it starts off); if the flag is on,\n"
"           then on input and output, longitude precedes latitude (except that,\n"
"           on input, this can be overridden by a hemisphere designator, N, S,\n"
"           E, W).\n"
"\n"
"       -p prec\n"
"           set the output precision to prec.  By default prec is 5 for\n"
"           acceleration due to gravity, 3 for the gravity disturbance and\n"
"           anomaly, and 4 for the geoid height.\n"
"\n"
"       -v  print information about the gravity model on standard error before\n"
"           processing the input.\n"
"\n"
"       --comment-delimiter commentdelim\n"
"           set the comment delimiter to commentdelim (e.g., \"#\" or \"//\").  If\n"
"           set, the input lines will be scanned for this delimiter and, if\n"
"           found, the delimiter and the rest of the line will be removed prior\n"
"           to processing and subsequently appended to the output line\n"
"           (separated by a space).\n"
"\n"
"       --version\n"
"           print version and exit.\n"
"\n"
"       -h  print usage, the default gravity path and name, and exit.\n"
"\n"
"       --help\n"
"           print full documentation and exit.\n"
"\n"
"       --input-file infile\n"
"           read input from the file infile instead of from standard input; a\n"
"           file name of \"-\" stands for standard input.\n"
"\n"
"       --input-string instring\n"
"           read input from the string instring instead of from standard input.\n"
"           All occurrences of the line separator character (default is a\n"
"           semicolon) in instring are converted to newlines before the reading\n"
"           begins.\n"
"\n"
"       --line-separator linesep\n"
"           set the line separator character to linesep.  By default this is a\n"
"           semicolon.\n"
"\n"
"       --output-file outfile\n"
"           write output to the file outfile instead of to standard output; a\n"
"           file name of \"-\" stands for standard output.\n"
"\n"
"MODELS\n"
"       Gravity computes the gravity field using one of the following models\n"
"\n"
"           egm84, earth gravity model 1984.  See\n"
"             http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html\n"
"           egm96, earth gravity model 1996.  See\n"
"             http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html\n"
"           egm2008, earth gravity model 2008.  See\n"
"             http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008\n"
"           wgs84, world geodetic system 1984.  This returns the normal\n"
"             gravity for the WGS84 ellipsoid.\n"
"           grs80, geodetic reference system 1980.  This returns the normal\n"
"             gravity for the GRS80 ellipsoid.\n"
"\n"
"       These models approximate the gravitation field above the surface of the\n"
"       earth.  By default, the \"egm96\" gravity model is used.  This may\n"
"       changed by setting the environment variable\n"
"       \"GEOGRAPHICLIB_GRAVITY_NAME\" or with the -n option.\n"
"\n"
"       The gravity models will be loaded from a directory specified at compile\n"
"       time.  This may changed by setting the environment variables\n"
"       \"GEOGRAPHICLIB_GRAVITY_PATH\" or \"GEOGRAPHICLIB_DATA\", or with the -d\n"
"       option.  The -h option prints the default gravity path and name.  Use\n"
"       the -v option to ascertain the full path name of the data file.\n"
"\n"
"       Instructions for downloading and installing gravity models are\n"
"       available at\n"
"       <https://geographiclib.sourceforge.io/html/gravity.html#gravityinst>.\n"
"\n"
"ENVIRONMENT\n"
"       GEOGRAPHICLIB_GRAVITY_NAME\n"
"           Override the compile-time default gravity name of \"egm96\".  The -h\n"
"           option reports the value of GEOGRAPHICLIB_GRAVITY_NAME, if defined,\n"
"           otherwise it reports the compile-time value.  If the -n name option\n"
"           is used, then name takes precedence.\n"
"\n"
"       GEOGRAPHICLIB_GRAVITY_PATH\n"
"           Override the compile-time default gravity path.  This is typically\n"
"           \"/usr/local/share/GeographicLib/gravity\" on Unix-like systems and\n"
"           \"C:/ProgramData/GeographicLib/gravity\" on Windows systems.  The -h\n"
"           option reports the value of GEOGRAPHICLIB_GRAVITY_PATH, if defined,\n"
"           otherwise it reports the compile-time value.  If the -d dir option\n"
"           is used, then dir takes precedence.\n"
"\n"
"       GEOGRAPHICLIB_DATA\n"
"           Another way of overriding the compile-time default gravity path.\n"
"           If it is set (and if GEOGRAPHICLIB_GRAVITY_PATH is not set), then\n"
"           $GEOGRAPHICLIB_DATA/gravity is used.\n"
"\n"
"ERRORS\n"
"       An illegal line of input will print an error message to standard output\n"
"       beginning with \"ERROR:\" and causes Gravity to return an exit code of 1.\n"
"       However, an error does not cause Gravity to terminate; following lines\n"
"       will be converted.\n"
"\n"
"EXAMPLES\n"
"       The gravity field from EGM2008 at the top of Mount Everest\n"
"\n"
"           echo 27:59:17N 86:55:32E 8820 | Gravity -n egm2008\n"
"           => -0.00001 0.00103 -9.76782\n"
"\n"
"SEE ALSO\n"
"       GeoConvert(1), GeoidEval(1), geographiclib-get-gravity(8).\n"
"\n"
"AUTHOR\n"
"       Gravity was written by Charles Karney.\n"
"\n"
"HISTORY\n"
"       Gravity was added to GeographicLib,\n"
"       <https://geographiclib.sourceforge.io>, in version 1.16.\n"
;
  return retval;
}