Strip history field from netCDF file
|Target version:||Candidate for next bugfix release|
I need to remove (maybe edit) the command history attribute from a GMT-generated netCDF file. This should probably be an extension to grdedit. One way would be to extend the
-D option. But empty strings are considered "leave as is" by
-D. So should we introduce a new option for that or modify the
-D behavior? The latter could break backwards compatibility. Any thoughts?
#1 Updated by Paul almost 4 years ago
- Status changed from New to Feedback
Given it is a netCDF file, are there generic tools that can do this? Otherwise, I can think of two ways to handle this in grdedit:
- Let the hyphen, if given to the xname, yname, zname, title and remark strings mean "reset to blank".
- Add a new option -T to changes the "leave as is" mode to "reset to blank" if empty strings are given.
The second scheme should be fully backwards compatible whereas the first would torment fools who wish to assign a hyphen to any of those strings...
#6 Updated by Florian almost 4 years ago
I guess a change to grdedit would benefit all grid format where history etc are stored and not just netcdf. So perhaps this is a good solution (i.e., option 1)?
Btw, I like the history append feature of NCO: http://nco.sourceforge.net/nco.html#History-Attribute We should add this to the wish list as well.
#8 Updated by Paul almost 4 years ago
- Assignee set to Paul
- Target version set to Candidate for next bugfix release
I realized that the history is not one of the items in -D; it is instead automatically added as the current command. So doing things with -D will not make any changes. We would need a special option to remove it. So here the suggestion might be -C for "clean history". BTW, the netcdf machinery checks if title and remark are blank and only if they are not does it update the attributes in the file. So while -D can set remark to blank (via -) we would need to change the writing part as well. Note that the native grids have no such check so I would think this is a bug (that we are not allowed to set remark and title to blank. Agree?