boule icon indicating copy to clipboard operation
boule copied to clipboard

Better __repr__ or .info() method

Open MarkWieczorek opened this issue 3 months ago • 4 comments

Description of the desired feature: Printing the contents of a boule ellipsoid gives the following:

In [1]: print(boule.WGS84)
Ellipsoid(name='WGS84', semimajor_axis=6378137, flattening=0.0033528106647474805, geocentric_grav_const=398600441800000.0, angular_velocity=7.292115e-05, long_name='World Geodetic System (1984)', reference='Hofmann-Wellenhof, B., & Moritz, H. (2006). Physical Geodesy (2nd, corr. ed. 2006 edition ed.). Wien\u202f; New York: Springer.')

As this is a really long string, it is somewhat difficult to read if you a looking for a particular element. I propose that we provide an easier way to print the entirety of the ellipsoid contents for human readibility. This could either be by explicitly defining __repr__ for each ellispoid class or by providing a simple method such as Ellipsoid.info(). The output would look something like this:

In [1]: print(boule.WGS84)
Class: Ellipsoid
name = 'WGS84'
long_name = 'World Geodetic System (1984)'
semimajor_axis = 6378137
flattening = 0.0033528106647474805
geocentric_grav_const = 398600441800000.0
angular_velocity = 7.292115e-05
reference = 'Hofmann-Wellenhof, B., & Moritz, H. (2006). Physical Geodesy (2nd, corr. ed. 2006 edition ed.). Wien\u202f; New York: Springer.'

If desired, we could also append the units, but if we did this, we should probably define the units for each attribute in the class.

Are you willing to help implement and maintain this feature? After we decide on how to do this, the changes would be trivial to make...

MarkWieczorek avatar Apr 05 '24 08:04 MarkWieczorek