Commit 8e262215 authored by Mathis Rosenhauer's avatar Mathis Rosenhauer
Browse files

cmor: Only query history if global attrs exist

parent eee26034
......@@ -188,11 +188,16 @@ static void dump_global_attributes(struct kv **ht, int streamID)
static void dump_special_attributes(struct kv **ht, int streamID)
{
int vlistID = streamInqVlist(streamID);
/* Any new history will be appended to the existing history. */
int fileID = pstreamFileID(streamID);
size_t old_historysize = (size_t) streamInqHistorySize(fileID);
size_t old_historysize;
char *new_history = get_val(ht, "history", "");
size_t historysize;
int natts;
vlistInqNatts(vlistID, CDI_GLOBAL, &natts);
if ( natts > 0 )
old_historysize = (size_t) streamInqHistorySize(fileID);
else
old_historysize = 0;
if ( old_historysize )
{
......@@ -228,7 +233,6 @@ static void dump_special_attributes(struct kv **ht, int streamID)
const char *value = institutInqLongnamePtr(vlistInqVarInstitut(vlistID, 0));
if ( value ) hinsert(ht, "institution", value);
value = modelInqNamePtr(vlistInqVarModel(vlistID, 0));
if ( value ) hinsert(ht, "source", value);
}
......
Markdown is supported
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