hirokawa / cssrlib

Python Toolkit for satellite-based open PPP/PPP-RTK services
MIT License
113 stars 37 forks source link

Error in Niell tropo function calculation ? #99 #56

Open jonathanmuller opened 1 month ago

jonathanmuller commented 1 month ago

Hi,

There is a common pattern I see in all implementations of the Niell tropo across github :

The implementation is always the same :

(1+a / ... ) / (sinel +b / ...) while I believe it should be (sinel +b / ...) / (1+a / ... ) (the opposite)

For example in the code : https://github.com/hirokawa/cssrlib/blob/4843cc76ad85948fc3adb6a653eafd818cb7882e/src/cssrlib/gnss.py#L1410

def mapf(el, a, b, c):
    """ simple tropospheric mapping function """
    sinel = np.sin(el)
    return (1.0+a/(1.0+b/(1.0+c)))/(sinel+(a/(sinel+b/(sinel+c))))

However, original paper ( https://safe.nrao.edu/wiki/pub/Main/RefBendDelayCalc/Niell_Global.pdf ) list "equation 4" as :

image So the form is (1/(1+a / ... )) / (1+1/(sinel +b / ...)) As (1/y)/(1/x) can be rewritten as x/y Then the calculation above can be simplified as (sinel +b / ...) /(1+a / ... ) There can be no ambiguity as later it is used directly as follow, without further division or calculation directly as height correction : https://github.com/hirokawa/cssrlib/blob/4843cc76ad85948fc3adb6a653eafd818cb7882e/src/cssrlib/gnss.py#L1439 image

This is the same (wrong?) implementation as RTKLib and any other commonly used RTK library I could find on github. Am I just wrong about the understanding of the calculation, or is everyone copy-pasting the same error ?

hirokawa commented 1 month ago

Thank you for your comment. The Neil mapping function is also described in the ESA Navipedia: https://gssc.esa.int/navipedia/index.php/Mapping_of_Niell

The current implementation of CSSRlib (and RTKLIB) is compatible with the Navipedia. Based on the original paper, I don't know what is wrong with your understanding.

hirokawa commented 3 weeks ago

I also checked some famous book "GPS: Theory and Practice 5th", p.114, the equation in CSSRlib/RTKLIB is correct. The original paper is Herring (1992), "Modeling atmospheric delays in the analysis of space geodetic data".

jonathanmuller commented 3 weeks ago

You fully convinced me that you -and the code- where right Thank you a lot for the details !