spacepy icon indicating copy to clipboard operation
spacepy copied to clipboard

Establish consistent earth radius, other constants in pybats

Open jtniehof opened this issue 2 years ago • 0 comments

From the discussion in #653, pybats appears to use different values for the Earth radius in different contexts. It also has a few other physical constants that get referenced.

We should do two things:

  1. Make Re consistent in pybats and/or document reasons for inconsistencies. (Maybe tie in to handling in ctrans?)
  2. Consider consolidating other physical constants. I would support using scipy.constants as our standard reference and declaring scipy a hard dependency.

The following locations are identified in #653 to check the Earth radius, using line numbers as of that PR (specifically spacecataz/spacepy@7c86ad37eb02142fa8b288fbfdef741b01b3a006):

  • bats.py line 33, module-level definition, apparently volumetric mean radius (637100m)
  • bats.py line 1354, gradP_regular, 6378000m (close to WGS84 equatorial)
  • bats.py line 1441, gyroradius, 6378000m (close to WGS84 equatorial)
  • bats.py line 1478, inertial_length, 6378000m (close to WGS84 equatorial)
  • bats.py line 2785, calc_radflu, 6371.0 km (volumetric mean, not using the module-level definition)

It looks like the 6378000m cases are using Re quite colloquially, as just a convenient unit of distance rather than actually relating to the Earth's field.

jtniehof avatar Oct 03 '22 17:10 jtniehof