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

Worldview-2 data: i.fusion.hpf crash with "ValueError: 9 is not in list" #14

Open
neteler opened this issue Oct 27, 2019 · 6 comments
Open

Comments

@neteler
Copy link
Contributor

neteler commented Oct 27, 2019

Applying the i.fusion.hpf version in https://github.com/OSGeo/grass-addons/tree/master/grass7/imagery/i.fusion.hpf leads to a crash when using it on Worldview-2 data:

# input data
GRASS 7.9.dev (mexico_UTM11): >

PAN=wv2_17OCT08182034_P2AS_058891334010_01_P001
COLORPREFIX=wv2_17OCT08182034_M2AS_058891334010_01_P001

g.list raster pattern="$COLORPREFIX.?" 
wv2_17OCT08182034_M2AS_058891334010_01_P001.1
wv2_17OCT08182034_M2AS_058891334010_01_P001.2
wv2_17OCT08182034_M2AS_058891334010_01_P001.3
wv2_17OCT08182034_M2AS_058891334010_01_P001.4
wv2_17OCT08182034_M2AS_058891334010_01_P001.5
wv2_17OCT08182034_M2AS_058891334010_01_P001.6
wv2_17OCT08182034_M2AS_058891334010_01_P001.7
wv2_17OCT08182034_M2AS_058891334010_01_P001.8

g.list raster pattern="$PAN"
wv2_17OCT08182034_P2AS_058891334010_01_P001

Attempt to pan-sharpen:

i.fusion.hpf pan=$PAN msx=$(g.list raster pattern="$COLORPREFIX.?" sep=comma)
|! Region's resolution matched to Pan's (0.5)

Processing image: wv2_17OCT08182034_M2AS_058891334010_01_P001.1

|1 Determining ratio of low to high resolution
> Retrieving image resolutions
>> Resolution ratio low (2.000) to high (0.500): 4.0

|2 High Pass Filtering the Panchromatic Image
Traceback (most recent call last):
  File "/root/.grass7/addons/scripts/i.fusion.hpf", line 575, in <module>
    sys.exit(main())
  File "/root/.grass7/addons/scripts/i.fusion.hpf", line 378, in main
    hpf = get_high_pass_filter(ratio, center)
  File "/root/.grass7/addons/etc/i.fusion.hpf/high_pass_filter.py", line 140, in get_high_pass_filter
    kernel = get_kernel(size, level)
  File "/root/.grass7/addons/etc/i.fusion.hpf/high_pass_filter.py", line 116, in get_kernel
    center = get_center_cell(level, size)
  File "/root/.grass7/addons/etc/i.fusion.hpf/high_pass_filter.py", line 28, in get_center_cell
    kernel_size_idx = [k for ((lo, hi), k) in MATRIX_PROPERTIES].index(kernel_size)
ValueError: 9 is not in list
WARNING: No data base element files found
@neteler
Copy link
Contributor Author

neteler commented Oct 27, 2019

I think that I got it fixed in OSGeo/grass-addons#49

@NikosAlexandris
Copy link
Owner

NikosAlexandris commented Oct 27, 2019

Thank you Markus. I would like to test this too. Can I have a small sample data set? Like 100x100 pixels maybe or similar.

@NikosAlexandris
Copy link
Owner

NikosAlexandris commented Oct 28, 2019

Value 9 in the iterator derived by zip() gets consumed and it doesn't exist anymore when a sub-sequent call requests for it. I want to try with your data to confirm how this comes in to play.

@neteler
Copy link
Contributor Author

neteler commented Oct 28, 2019

I have sent a private link to you with sample data.

@NikosAlexandris
Copy link
Owner

zip() returns a list of tuples in Python 2 and an iterator in Python 3. Thanks for the fix Markus.
See also:

@neteler
Copy link
Contributor Author

neteler commented Oct 28, 2019

I have now merged OSGeo/grass-addons#49 .

Note: Perhaps this version should be sync'ed to that in grass-addons.

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

No branches or pull requests

2 participants