Commit 91e207b9 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added Option -H to do not append to netCDF history global attribute

parent a9b5a8f8
......@@ -3,6 +3,10 @@
* using CDI library version 1.6.4
* Version 1.6.4 released
2014-03-10 Uwe Schulzweida
* added Option -H to do not append to netCDF "history" global attribute
2014-03-03 Uwe Schulzweida
* Zonstat: bug fix if input stream contains only zonal data
......
CDO NEWS
--------
Version 1.6.4 (20 May 2014):
New features:
* Option -H: Do not append to netCDF "history" global attribute
Version 1.6.3 (18 February 2014):
New features:
......
......@@ -87,6 +87,7 @@ int cdoCheckDatarange = FALSE;
int cdoColor = FALSE;
int cdoDiag = FALSE;
int cdoAppendHistory = TRUE;
int cdoDisableHistory = FALSE;
int cdoCompType = COMPRESS_NONE; // compression type
int cdoCompLevel = 0; // compression level
......@@ -201,6 +202,7 @@ void cdo_usage(void)
fprintf(stderr, " -g <grid> Set default grid name or file. Available grids: \n");
fprintf(stderr, " n<N>, t<RES>, tl<RES>, global_<DXY>, r<NX>x<NY>, g<NX>x<NY>, gme<NI>, lon=<LON>/lat=<LAT>\n");
fprintf(stderr, " -h Help information for the operators\n");
fprintf(stderr, " -H Do not append to netCDF \"history\" global attribute\n");
/*
fprintf(stderr, " -i <inst> Institution name/file\n");
fprintf(stderr, " Predefined instituts: ");
......@@ -1085,7 +1087,7 @@ void parse_options(int argc, char *argv[])
{
int c;
while ( (c = cdoGetopt(argc, argv, "f:b:e:P:p:g:i:k:l:m:n:t:D:z:aBCcdhLMOQRrsSTuVvWXZ")) != -1 )
while ( (c = cdoGetopt(argc, argv, "f:b:e:P:p:g:i:k:l:m:n:t:D:z:aBCcdhHLMOQRrsSTuVvWXZ")) != -1 )
{
switch (c)
{
......@@ -1137,6 +1139,9 @@ void parse_options(int argc, char *argv[])
case 'h':
Help = 1;
break;
case 'H':
cdoAppendHistory = FALSE;
break;
case 'i':
defineInstitution(cdoOptarg);
break;
......
......@@ -77,29 +77,40 @@ void cdoInqHistory(int fileID)
}
void cdoDefHistory(int fileID, char *histstring)
void cdoDefHistory(int fileID, char* histstring)
{
char *history = NULL;
char* strtimeptr = NULL;
char* history = NULL;
size_t historysize = 0;
char *strtimeptr;
extern int cdoAppendHistory;
extern int cdoDisableHistory;
strtimeptr = get_strtimeptr();
historysize = ghistorysize+strlen(strtimeptr)+strlen(histstring)+2;
history = malloc(historysize);
if ( !cdoDisableHistory ) historysize += ghistorysize;
if ( cdoAppendHistory )
{
strtimeptr = get_strtimeptr();
historysize += strlen(strtimeptr)+strlen(histstring)+2;
}
if ( historysize ) history = malloc(historysize);
strcpy(history, strtimeptr);
strcat(history, histstring);
if ( cdoAppendHistory )
{
strcpy(history, strtimeptr);
strcat(history, histstring);
}
if ( cdoDisableHistory == FALSE )
if ( !cdoDisableHistory )
if ( ghistory )
{
strcat(history, "\n");
if ( cdoAppendHistory ) strcat(history, "\n");
strcat(history, ghistory);
}
streamDefHistory(fileID, strlen(history), history);
free(history);
if ( historysize )
{
streamDefHistory(fileID, strlen(history), history);
free(history);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment