Here is an (unsupported) script that should help you
from NanoLanguage import *
from NL.IO.NLSaveUtilities import nlinspect
import tempfile
def nlremove(input_filename,output_filename,id_to_remove):
if input_filename==output_filename:
print 'Input and output NC files must be different'
print 'Exiting'
return
file_contents = nlinspect(input_filename)
print "Contents of ", input_filename
print "ID\tObject"
print "----------------------"
for ix in range(len(file_contents)):
print file_contents[ix][1],'\t',file_contents[ix][0]
print
all_objects = nlread(input_filename)
for ix in range(len(file_contents)):
if file_contents[ix][1]!=id_to_remove:
print 'Writing object with ID %s to %s' % (file_contents[ix][1],output_filename)
nlsave(output_filename,all_objects[ix],object_id=file_contents[ix][1])
else:
print 'Skipping object with ID %s' % (file_contents[ix][1])
in_filename = 'gaas.nc'
out_filename = 'gaas_.nc'
ID_to_remove = 'gID1'
nlremove(in_filename,out_filename,ID_to_remove)