[gdal-dev] how to save history of gdal commands in metadata?

Etienne Tourigny etourigny.dev at gmail.com
Wed Oct 5 19:08:11 EDT 2011


Hi all,

I am adding support for the netcdf history attribute (which keeps
track of all commands done on an netcdf file), I am trying to see how
to include as much possible information as possible in the
NCDFCreateCopy() function.

Firstly, is there a way to access to the current command line which
generated a GDALCreateCopy()?  All I have access to is what is passed
to the NCDFCreateCopy() function, such as filename, input dataset,
driver options.

Secondly, would there be interest in introducing this sort of feature
into the GDAL framework?  I would see it as an optional string which
could be passed from the calling script to the Create() and
CreateCopy() methods, or perhaps a global variable which drivers would
be free to use or not.
As Geotiff supports metadata, it would be a nice addition to it.

Here is an example of netcdf history metadata:
As you can see there is not much information from the GDAL command yet.

{{{
		:history = "Wed Oct 05 19:59:26 2011: GDAL NCDFCreateCopy(
trmm-cp51.nc, ... )\n",
			"Wed Sep 07 22:33:59 2011: cdo sellonlatbox,-80,-70,-20,-10
tmp4-noc.nc tmp5.nc\n",
			"Wed Sep  7 22:33:53 2011: ncatted -a Conventions,global,d,,
tmp4.nc tmp4-noc.nc\n",
			"Wed Aug 24 12:59:04 2011: ncatted -D 10 -a
CoreMetadata.0,global,d,, -a ArchiveMetadata.0,global,d,, tmp3.nc
tmp4.nc\n",
			"Tue Aug 23 21:04:45 2011: cdo seltimestep,1 tmp2.nc tmp3.nc\n",
			"Tue Aug 23 19:19:18 2011: cdo selvar,pcp tmp1.nc tmp2.nc\n",
			"Tue May 17 19:34:24 2011: cdo
sellonlatbox,-85.25,-29.625,15.25,-50 3B43.2011.nc tmp1.nc\n",
			"Tue May 17 19:26:31 2011: cdo mergetime 3B43.110101.6A.nc
3B43.110201.6A.nc 3B43.110301.6A.nc 3B43.110401.6A.nc 3B43.2011.nc" ;
}}}

Regards,
Etienne


More information about the gdal-dev mailing list