matplotlib / matplotlib/basemap
readshapefile fails on certain filenames
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 817
- Forks
- 395
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Hi,
(Tested with basemap 1.0.6)
This works:
m.readshapefile('foo.shp', 'my_shape')
while this fails:
m.readshapefile('bar_0.1.shp', 'my_shape')
raise IOError('error reading shapefile %s.shp' % shapefile)
fields = shf.fields
coords = []; attributes = []
IOError: error reading shapefile bar_0.1.shp
Note that foo.shp and bar_0.1.shp are exactly the same file except for the filename. So it seems that the additional . causes the problem. Minimal example to reproduce behavior:
Rename huralll020.{shp,dfb,shx} to huralll020_0.1.{shp,dbf,shx} and change filename in examples/hurrtracks.py accordingly. Run hurrtracks.py.
Of course the obvious workaround is not to use . in filenames. But this is somewhat impracticable as I have a large number or files and would like keeping the filenames consistent accross filetypes (netCDF, shapfiles, pngs, etc).
Is there an easy fix?
Thanks very much,
Andy
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem Einstiegspunkt readshapefile und der Reproduktion in examples/hurrtracks.py. Benenne die Shapefile-Komponenten von huralll020 wie beschrieben um, führe hurrtracks.py aus und verfolge, warum der Dateiname mit Punkt fehlschlägt. Erledigt ist die Aufgabe, wenn dasselbe Shapefile mit einem Dateinamen wie huralll020_0.1 gelesen werden kann und das bestehende Beispiel weiterhin funktioniert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- data
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100