OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
ncattredit.py File Reference

Go to the source code of this file.

Namespaces

 ncattredit
 

Variables

string callseq = sys.argv[0] + ' file ' + 'attr-file'
 
 inFile = sys.argv[1]
 
 attrFile = sys.argv[2]
 
 rootgrp = nc.Dataset(inFile, 'a')
 
 processtime = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%dT%H:%M:%S')
 
string history = nc.Dataset.getncattr(rootgrp,'history').rstrip() + '\n'+'['+processtime+'] '+os.path.basename(sys.argv[0])+ ' ' + sys.argv[1] + ' ' + sys.argv[2]
 
 attrs = open(attrFile,'r')
 
 attrName = parts.pop()
 
 attrValue = attrValue.rstrip()
 
 group = rootgrp
 
 parts = attrName.split('/')
 
string attrGroup = '/'.join(parts).strip()
 
 attrValueExisting = nc.Dataset.getncattr(group,attrName)
 
 partsStr = attrValue.split(',')