#5820 closed defect (fixed)
gdal_edit.py: fix -unsetstats with other metadata items
Reported by: | Mike Taves | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 2.0.0 |
Component: | Utilities | Version: | svn-trunk |
Severity: | normal | Keywords: | |
Cc: |
Description
If there is another metadata item for a raster band, an error NameError: global name 'mt_out' is not defined
is raised, otherwise statistics are only deleted if all keys start with "STATISTICS_".
The attached patch only deletes metadata items that start with "STATISTICS_", and preserves other items.
Attachments (1)
Change History (5)
by , 9 years ago
Attachment: | unsetstats.diff added |
---|
comment:1 by , 9 years ago
The change seems larger than needed. It is just a typo. You could probably replace mt_out by md_out and it should work, no ? That said your version is OK too...
comment:2 by , 9 years ago
Yes, correcting the typo fixes the core issue too. The other changes deletes only the statistics tags and preserving others in place, rather than rewriting all metadata tags using a Python dict. It's your call on what is most appropriate.
comment:3 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Drivers are supposed to behave the same whereas you replace all metadata or nullify items, although I suspect some might have problems clearing existing metadata with one or the other way, but that would be driver bugs. The GTiff one is fine for that at least.
trunk r28344 "gdal_edit.py: fix -unsetstats when band metadata has items that don't begin with STATISTICS_ (patch by mwtoews, #5820)"
git diff --no-prefix > unsetstats.diff