Skip to content

Revert to original skew method and filter out striping artifacts - #18

Merged
jomey merged 5 commits into
mainfrom
scipy-median-filter-horizon
May 22, 2026
Merged

jomey merged 5 commits into
mainfrom
scipy-median-filter-horizon

Conversation

@brentwilder

@brentwilder brentwilder commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor

This looks to address #16 by ensuring interpolation only occurs on the striping artifacts. In this PR the skew() method is returned to the same transformation as carried out in the ARS repo.

This update leverages scipy.ndimage's median_filter method . To determine if it's a line I use a somewhat arbitrary value of 3pix, passed twice (vertically, horizontally) through median filter.

horizon_cos = horizon_cos - median_filter(horizon_cos - median_filter(
                             horizon_cos, size=(3, 1)), size=(1, 3))

dx=50m
image


Changing the size parameter above dramatically impacts the amount filtered by the method. Eyeballing it between the Lakes test and also Kings Canyon Topo file I have locally, this appeared to give the most stable results (size of 3x1 then 1x3).

This is a nice middle ground, as yes maybe there are still some small striping present, but it's also not interpolating heavily.

dx=100m
Screenshot 2026-03-18 at 18 57 08

@brentwilder
brentwilder requested a review from jomey March 19, 2026 00:00
@brentwilder

Copy link
Copy Markdown
Contributor Author

Note to self: if this works we will need to update the test data.

Comment thread topocalc/horizon.py Resolved
Comment thread topocalc/horizon.py Resolved

@jomey jomey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I say go ahead with the test updates. Then we will tackle the ones in SMRF and AWSM

Comment thread topocalc/horizon.py Resolved
Comment thread pyproject.toml Resolved
Comment thread pyproject.toml Resolved
@brentwilder

Copy link
Copy Markdown
Contributor Author

Discussing this with Joe, there is a small slowdown due to the image filtering technique here. However, in the context of iSnobal domain for a given day this only add about ~0.3 seconds to total run time per day.

Raw numbers for Kings Canyon domain (dx=100m)

  • with filter : 0.0345 sec/azimuth 
  • no filter:  0.0215 sec/azimuth

@jomey
jomey enabled auto-merge March 20, 2026 22:36

@jomey jomey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to update the pyproject.toml. See the "unresolved comments"

Comment thread pyproject.toml Resolved
@brentwilder

brentwilder commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Huh, I already pinned scipy (and removed from build)... I must have did something strange when trying to resolve your comments @jomey ?

@jomey
jomey merged commit 29a0792 into main May 22, 2026
2 checks passed
@jomey
jomey deleted the scipy-median-filter-horizon branch May 22, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants