{"action":"created","issue":{"url":"https://api.github.com/repos/wradlib/wradlib/issues/117","repository_url":"https://api.github.com/repos/wradlib/wradlib","labels_url":"https://api.github.com/repos/wradlib/wradlib/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/wradlib/wradlib/issues/117/comments","events_url":"https://api.github.com/repos/wradlib/wradlib/issues/117/events","html_url":"https://github.com/wradlib/wradlib/issues/117","id":185860307,"number":117,"title":"kdp_from_phidp sobel vs. convolution","user":{"login":"kmuehlbauer","id":5821660,"avatar_url":"https://avatars2.githubusercontent.com/u/5821660?v=4","gravatar_id":"","url":"https://api.github.com/users/kmuehlbauer","html_url":"https://github.com/kmuehlbauer","followers_url":"https://api.github.com/users/kmuehlbauer/followers","following_url":"https://api.github.com/users/kmuehlbauer/following{/other_user}","gists_url":"https://api.github.com/users/kmuehlbauer/gists{/gist_id}","starred_url":"https://api.github.com/users/kmuehlbauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmuehlbauer/subscriptions","organizations_url":"https://api.github.com/users/kmuehlbauer/orgs","repos_url":"https://api.github.com/users/kmuehlbauer/repos","events_url":"https://api.github.com/users/kmuehlbauer/events{/privacy}","received_events_url":"https://api.github.com/users/kmuehlbauer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-28T07:52:23Z","updated_at":"2018-03-14T14:48:13Z","closed_at":null,"author_association":"OWNER","body":"We have the mentioned  two kdp_from_phidp functions (`kdp_from_phidp_sobel`, `kdp_from_phidp_convolution`) which are obviously doing the same. \n\n`kdp_from_phidp_convolution` has two advantages:\n- using vectorized `convolve1d` on the whole array\n- calculate derivation filter only once\n\nBoth functions are using convolution with the same kernel in two different ways.  `kdp_from_phidp_sobel` convolutes the kernel with the data and handles the edge cases by handcrafted mirroring at the edge.  `kdp_from_phidp_convolution` convolutes the data with the reversed kernel and uses the standard 'reflect' mode for edge cases.\n\nFurther difference in handling of the edge cases: `kdp_from_phidp_sobel` handles ray start and end section in any case via linear regression, where `kdp_from_phidp_convolution` handles this only when invalid data (nan) is calculated.\n\nThe kernel used in both functions is most likely a derivative of an interpolation filter. This way we get the function derivative with just one convolution. \n\nThe kernel values can be calculated by this function:\n\ny = (12 \\* x) / (L^3 \\* L)\n\nwhere L is the kernel width and x runs from  -(L - 1.) / 2 to  (L - 1.) / 2 with steps of 1.\n\nThe python function would look something like this:\n\n```\ndef kernel(L):\n    N = (L - 1.) / 2.\n    x = np.linspace(-N, N, L)\n    window = x * 12. / (np.power(L, 3.) - L)\n    return window\n```\n\nIt does make sense to consolidate the two functions into one. We can also think about adding a bit more flexibility to the convolution part in terms of edge case handling and also interpolation and derivation. Just think about phidp data with different noise overlay (diff. frequency) etc. It would come in handy to create kernels with different interpolation schemes.\n\nLooking forward to the discussion.\n\nping @scollis who posted the sobel-filter on SO\n"},"comment":{"url":"https://api.github.com/repos/wradlib/wradlib/issues/comments/373047826","html_url":"https://github.com/wradlib/wradlib/issues/117#issuecomment-373047826","issue_url":"https://api.github.com/repos/wradlib/wradlib/issues/117","id":373047826,"user":{"login":"kmuehlbauer","id":5821660,"avatar_url":"https://avatars2.githubusercontent.com/u/5821660?v=4","gravatar_id":"","url":"https://api.github.com/users/kmuehlbauer","html_url":"https://github.com/kmuehlbauer","followers_url":"https://api.github.com/users/kmuehlbauer/followers","following_url":"https://api.github.com/users/kmuehlbauer/following{/other_user}","gists_url":"https://api.github.com/users/kmuehlbauer/gists{/gist_id}","starred_url":"https://api.github.com/users/kmuehlbauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmuehlbauer/subscriptions","organizations_url":"https://api.github.com/users/kmuehlbauer/orgs","repos_url":"https://api.github.com/users/kmuehlbauer/repos","events_url":"https://api.github.com/users/kmuehlbauer/events{/privacy}","received_events_url":"https://api.github.com/users/kmuehlbauer/received_events","type":"User","site_admin":false},"created_at":"2018-03-14T14:48:12Z","updated_at":"2018-03-14T14:48:12Z","author_association":"OWNER","body":"resolved with #241 "}}
{"actor":{"display_login":"kmuehlbauer"}}