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

Check area slices for correct step #275

Merged
merged 2 commits into from
May 13, 2020
Merged

Conversation

pnuu
Copy link
Member

@pnuu pnuu commented May 7, 2020

This PR makes sure that the slice(start, stop, step) has correct sign for the step argument when start > stop when slicing the area.

@pnuu pnuu added the bug label May 7, 2020
@pnuu pnuu requested a review from mraspaud May 7, 2020 11:10
@pnuu pnuu self-assigned this May 7, 2020
@coveralls
Copy link

coveralls commented May 7, 2020

Coverage Status

Coverage increased (+0.04%) to 91.991% when pulling 5db5ae8 on pnuu:bugfix-get_area_slices into f661cf9 on pytroll:master.

@codecov
Copy link

codecov bot commented May 7, 2020

Codecov Report

Merging #275 into master will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #275      +/-   ##
==========================================
+ Coverage   91.97%   92.01%   +0.04%     
==========================================
  Files          42       42              
  Lines        8208     8228      +20     
==========================================
+ Hits         7549     7571      +22     
+ Misses        659      657       -2     
Impacted Files Coverage Δ
pyresample/geometry.py 82.65% <100.00%> (+0.12%) ⬆️
pyresample/test/test_utils.py 97.50% <100.00%> (+0.13%) ⬆️
pyresample/utils/__init__.py 83.90% <100.00%> (+1.19%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f661cf9...5db5ae8. Read the comment docs.

@gerritholl
Copy link
Member

I still get a segfault when trying to use this with pytroll/satpy#1188 when loading the area definition from the yaml file, but not when defining it inline. I'm trying to figure out what's going on.

@gerritholl
Copy link
Member

My previous comment was a lie. It does also fail when defining it inline; I still had the reduce_data=False flag active.

Specifically, this still segfaults:

from satpy import Scene
from satpy.utils import debug_on
from pyresample import create_area_def
debug_on()
from glob import glob
area = create_area_def("fci_0deg_2km",
        {"proj": "geos", "lon_0": 0, "h": 35786400, "x_0": 0, "y_0": 0, "ellps": "WGS84"},
        units="m",
        shape=(5568, 5568),
        area_extent=(-5567999.994206558, -5567999.994200589,
            5567999.994206558, 5567999.994200589))
sc = Scene(glob("/media/nas/x21308/2020_04_MTG_unofficial_Testdata/20130804_RC72/W_XX-EUMETSAT-Darmstadt,IMG+SAT,MTI1+FCI-1C-RRAD-FDHSI-FD--CHK-BODY--L2P-NC4E_C_EU*.nc"), reader="fci_l1c_fdhsi")                                                                                                                           
sc.load(["ir_123"])
nsc = sc.resample(area)
nsc.save_dataset("ir_123", "/tmp/ir_123.tif")

Meanwhile, this completes successfully (previously AssertionError):

from satpy import Scene
from satpy.utils import debug_on
from pyresample import create_area_def
debug_on()
from glob import glob
area = create_area_def("fci_0deg_2km",
        {"proj": "geos", "lon_0": 0, "h": 35786400, "x_0": 0, "y_0": 0, "ellps": "WGS84"},
        units="m",
        shape=(5568//10, 5568//10),
        area_extent=(-5567999.994206558/10, -5567999.994200589/10,
            5567999.994206558/10, 5567999.994200589/10))
sc = Scene(glob("/media/nas/x21308/2020_04_MTG_unofficial_Testdata/20130804_RC72/W_XX-EUMETSAT-Darmstadt,IMG+SAT,MTI1+FCI-1C-RRAD-FDHSI-FD--CHK-BODY--L2P-NC4E_C_EU*.nc"), reader="fci_l1c_fdhsi")                                                                                                                           
sc.load(["ir_123"])
nsc = sc.resample(area)
nsc.save_dataset("ir_123", "/tmp/ir_123.tif")

ir_123

@gerritholl
Copy link
Member

After the segmentation fault, the last line in dmesg is:

[9527227.302060] python[13518]: segfault at 564456e99e40 ip 00007fcaba50b033 sp 00007fcaa6ffc098 error 4 in kdtree.cpython-38-x86_64-linux-gnu.so[7fcaba4fa000+13000]

Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

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

LGTM. An explanation of what problem was solved in the description of the PR would be nice :)

@pnuu
Copy link
Member Author

pnuu commented May 13, 2020

Added explanation, and merging.

@pnuu pnuu merged commit b453994 into pytroll:master May 13, 2020
@pnuu pnuu deleted the bugfix-get_area_slices branch May 13, 2020 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants