Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let the user provide custom weight into pyresample #12

Open
mraspaud opened this issue Sep 16, 2014 · 4 comments
Open

Let the user provide custom weight into pyresample #12

mraspaud opened this issue Sep 16, 2014 · 4 comments

Comments

@mraspaud
Copy link
Member

From lavergne...@gmail.com on November 25, 2013 14:15:49

Hei pyresample team,

I am seating at the pytroll workshop, and would like a new feature:

Users could specify an array of weights (same dimension as lat/lon/data), and this weight would multiply the weight computed from distance (through the fov function, either _custom() or _gauss()).

Two use cases:

  1. the weight could be given as 1./var(data) : the inverse of the uncertainty in each data point (as variance);
  2. the weight could be computed on fov observation time, with more weight towards 12utc than at 0utc and 23:59utc. A resulting daily composite image would then be "sharpened towards 12utc", wrt to a daily composite without any weighting.

I'll start implementing right now :)
Thomas

Original issue: http://code.google.com/p/pyresample/issues/detail?id=12

@mraspaud
Copy link
Member Author

From lavergne...@gmail.com on November 26, 2013 00:41:37

OK. I have a version I would like to share with you, Esben. Can you take a look?

I implemented this as an extra keyword parameter custom_weight=None to resample_gauss() and resample_custom(). This new feature should have no impact for resample_nn(). If custom_weight is None (default), I checked that the testsuite runs smoothly. I have also created 2 test cases for the new feature, and will add more today.

Please find attached kd_tree.py with the new feature, and test_kd_tree.py. This version is tentatively named 1.1.1.

I also attach an animated gif that cycles between 3 images of the "average sensing time" (0-24 hours) when doing a daily composite of SSM/I swath data in the Arctic. That uses resample_gauss(). The loop is going through "pyresample-1.1.0", "pyresample-1.1.1_withCustomWeight", and "pyresample-1.1.1_withoutCustomWeight".

In that case, the custom_weight I use is a "hat" function that gives a weight of 1 at sensing_time 12utc, and a weight of 0 at sensing_time 00utc and 24utc. The idea is to get a daily averaged image that is sharpened towards 12utc.

So we see that "pyresample-1.1.0" is the same as "pyresample-1.1.1_withoutCusomWeights" (frame 1 and 3), whille pyresample-1.1.1_withCustomWeights (frame 2) does what we want (gives less weight to the late 22utc swath).

What do you think, how do we proceed from here?

Thomas

Attachment: kd_tree.py test_kd_tree.py

@mraspaud
Copy link
Member Author

From lavergne...@gmail.com on November 26, 2013 00:50:48

Posting the 3 frames separately, since animated gif didn't pass.

Attachment: test_pr111_times_frame1.png test_pr111_times_frame2.png test_pr111_times_frame3.png

@mraspaud
Copy link
Member Author

@TomLav Is this implemented now ?

@TomLav
Copy link
Contributor

TomLav commented Apr 24, 2018

Short answer: no.
Longer answer: maybe. I have been thinking lately that pyresample has maybe all what is needed to achieve this feature without touching the code. I must give it a try.

pnuu pushed a commit to pnuu/pyresample that referenced this issue Nov 29, 2018
Yaml jpss1
Tests are passing and coverage has not decreased. Now also RTD builds fine, so ready to merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants