mrJean1 / PyGeodesy

Pure Python geodesy tools
https://mrjean1.github.io/PyGeodesy/
297 stars 58 forks source link

missing g2012b_bin #64

Closed SBFRF closed 2 years ago

SBFRF commented 2 years ago

1st time user, trying to convert raw ellipsoid values to NAVD88 with g2012b. Have a difficult time interpreting the documentation and couldn't find any examples either on stack or in the documentation, so i'm left here. if this isn't the forum forgive me. the initialization for the geoid2012 class requires a bin file for the conversion..... I'm guessing its the actual model, but hard to tell. where does one acquire this bin file?

from pygeodesy import geoids 
 instance = geoids.GeoidG2012B()

Traceback (most recent call last):
  File "/home/spike/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-42-a7fe79c11b99>", line 1, in <module>
    instance = geoids.GeoidG2012B()
TypeError: __init__() missing 1 required positional argument: 'g2012b_bin'
SBFRF commented 2 years ago

on further investigation, I got it! https://geodesy.noaa.gov/GEOID/GEOID12B/GEOID12B_CONUS.shtml

you all may want to consider updating your documentation with a few examples

mrJean1 commented 2 years ago

Did you see the documention of module geoids? If so, do the examples not cover your particular usage? If so, could you provide one?

Also, geoid model files are specific to each interpolator class. The documentation of each interpolator class contains links to suitable geoid model files.

SBFRF commented 2 years ago

yea I did, i didn't really follow any of those as there isn't a practical example, it's missing import statements among other things. As a new user, something like below would be helpful to see

import pandas as pd
from pygeodesy import geoids

fname = "data/ExampleFile.csv"
geoidFile = "data/g2012bu8.bin"   # available at this location: https://geodesy.noaa.gov/GEOID/GEOID12B/GEOID12B_CONUS.shtml
instance = geoids.GeoidG2012B(geoidFile)
data = pd.read_csv(fname)                                                                             # open and read file 
data['ellipsoid'] = data.gga_altitude_m - data.gga_height_geoid_m               # getting back to raw ellipsoid value from GGA string instance = geoids.GeoidG2012B(geoidFile)                                                  # initalize geoid 2012B instance with the 
geoidHeight = instance.height(data.latitude, data.longitude)                         # generate the geoid Height from the lat/lon values
data['elevation_NAVD88_m'] = data.ellipsoid + geoidHeight                         # convert back to orthometric using the new geoid
data.plot.scatter('longitude', 'latitude', c='elevation_NAVD88_m', cmap='ocean')  # plot my data

image .... i'm not sure how i'm supposed to get you the data file i'm using through github issues

SBFRF commented 2 years ago

ExampleFile.csv got it here through a drag and drop

mrJean1 commented 2 years ago

Thank you. There are links to geoid model files in the class documentation. Perhaps, some are broken and slipped through the tests.

Next time, just post an issue and ask for a usage example of any of the pygeodesy classes or functions.

SBFRF commented 2 years ago

will do, thanks for developing this! (and being responsive)

mrJean1 commented 2 years ago

PyGeodesy 21.11.22 includes several updates to the documentation of the geoids module (and the heights one), including a reference to the example above.