matplotlib / matplotlib/basemap
readshapefile fails on certain filenames
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 817
- Forks
- 395
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the readshapefile entry point and the reproduction in examples/hurrtracks.py. Rename the huralll020 shapefile components as described, run hurrtracks.py, and trace why the dotted filename fails. Done means the same shapefile can be read with a filename such as huralll020_0.1 while the existing example still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100