rtklib-py icon indicating copy to clipboard operation
rtklib-py copied to clipboard

Calculation error in tropmapf -> mapf ?

Open jonathanmuller opened this issue 6 months ago • 0 comments

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 : https://github.com/rtklibexplorer/rtklib-py/blob/5d8968d85902b94e29e5b221e5f7ba35b22ca8a4/src/rtkcmn.py#L737

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 mapf : https://github.com/rtklibexplorer/rtklib-py/blob/5d8968d85902b94e29e5b221e5f7ba35b22ca8a4/src/rtkcmn.py#L755 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 ?

jonathanmuller avatar Jul 29 '24 11:07 jonathanmuller