mkcms / gpx-mode

Major mode for viewing GPX (GPS Exchange Format) files
GNU General Public License v3.0
6 stars 1 forks source link

Multiple failures when ploting elevation data #1

Open orontee opened 1 month ago

orontee commented 1 month ago

From *Messages* buffer:

gpx-show-map-gpx2html: /home/matthias/.config/emacs/elpa/gpx-20240513.1737/gpx2html.py failed for /home/matthias/Téléchargements/15_05_24.gpx 0 0

Executing this command in a shell shows that plot_track_elevation.py file isn't executable:

(🐍) matthias@peitho:~ 
↳ /home/matthias/.config/emacs/elpa/gpx-20240513.1737/plot_track_elevation.py failed for /home/matthias/Téléchargements/15_05_24.gpx 0 0
bash: /home/matthias/.config/emacs/elpa/gpx-20240513.1737/plot_track_elevation.py: Permission non accordée

I fixed this but now in *gpx script error*:

Traceback (most recent call last):
  File "/home/matthias/.config/emacs/elpa/gpx-20240513.1737/plot_track_elevation.py", line 30, in <module>
    plt.fill_between(distance_travelled, elevation)
  File "/home/matthias/.local/share/venv/🐍/lib/python3.11/site-packages/matplotlib/pyplot.py", line 3229, in fill_between
    return gca().fill_between(
           ^^^^^^^^^^^^^^^^^^^
  File "/home/matthias/.local/share/venv/🐍/lib/python3.11/site-packages/matplotlib/__init__.py", line 1473, in inner
    return func(
           ^^^^^
  File "/home/matthias/.local/share/venv/🐍/lib/python3.11/site-packages/matplotlib/axes/_axes.py", line 5648, in fill_between
    return self._fill_between_x_or_y(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matthias/.local/share/venv/🐍/lib/python3.11/site-packages/matplotlib/axes/_axes.py", line 5548, in _fill_between_x_or_y
    ind, dep1, dep2 = map(
    ^^^^^^^^^^^^^^^
  File "/home/matthias/.local/share/venv/🐍/lib/python3.11/site-packages/numpy/ma/core.py", line 2360, in masked_invalid
    res = masked_where(~(np.isfinite(a)), a, copy=copy)
                         ^^^^^^^^^^^^^^
TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Environment

I am running a Debian Bookworm. When the user logs, a virtual environment is activated. Installed packages:

(🐍) matthias@peitho:~ 
↳ python -m pip freeze
branca==0.7.2
certifi==2024.2.2
charset-normalizer==3.3.2
contourpy==1.2.1
cycler==0.12.1
folium==0.16.0
fonttools==4.51.0
gpxpy==1.6.2
idna==3.7
Jinja2==3.1.4
kiwisolver==1.4.5
MarkupSafe==2.1.5
matplotlib==3.9.0
numpy==1.26.4
packaging==24.0
pillow==10.3.0
pyparsing==3.1.2
python-dateutil==2.9.0.post0
requests==2.32.2
six==1.16.0
urllib3==2.2.1
xyzservices==2024.4.0
orontee commented 1 month ago

Hum... tried with another GPX file and it works now that permissions are set. I guess the first GPX file is corrupted.

Looks like the script fails when ele elements are empty: image

mkcms commented 1 month ago

Hi, thanks for the report.

Executing this command in a shell shows that plot_track_elevation.py file isn't executable:

Hmm, this is a Python script. I don't think that being unexecutable matters, as the elisp functions here invoke the script by passing it as an argument to the Python interpreter. Just to confirm, you fixed the problem by setting the executable permission on the Python scripts? Btw. is it the plot_track_elevation.py script, or gpx2html? Your log message says the error happened in gpx-show-map-gpx2html

Hum... tried with another GPX file and it works now that permissions are set. I guess the first GPX file is corrupted.

Nice find. The file is missing elevation data. For such files, you won't be able to show elevation.. I just pushed 62169ee8623b20e06098e8c8ddba68d9b5d585d4 which ensures that the script does not fail, and shows an empty image in this case. If you've got another suggestion, let me know.

orontee commented 1 month ago

Oh my bad I didn't realize the script is called through the python interpreter. I thought it use a shebang. I'll double check from a clean install.