Index: sm/trunk-jpl/src/py3/contrib/bamg/YamsCall.py.bak
===================================================================
--- /issm/trunk-jpl/src/py3/contrib/bamg/YamsCall.py.bak	(revision 23677)
+++ 	(revision )
@@ -1,123 +1,0 @@
-import numpy
-import time
-import subprocess
-import os
-from ComputeHessian import ComputeHessian
-from ComputeMetric import ComputeMetric
-
-def YamsCall(md,field,hmin,hmax,gradation,epsilon):
-	"""
-	YAMSCALL - call yams
-
-	   build a metric using the Hessian of the given field
-	   call Yams and the output mesh is plugged onto the model
-	   -hmin = minimum edge length (m)
-	   -hmax = maximum edge length (m)
-	   -gradation = maximum edge length gradation between 2 elements
-	   -epsilon = average error on each element (m/yr)
-
-	   Usage:
-	      md=YamsCall(md,field,hmin,hmax,gradation,epsilon);
-
-	   Example:
-	      md=YamsCall(md,md.inversion.vel_obs,1500,10^8,1.3,0.9);
-	"""
-
-	#2d geometric parameter (do not change)
-	scale=2./9.
-
-	#Compute Hessian
-	t1=time.time()
-	print "%s" % '      computing Hessian...'
-	hessian=ComputeHessian(md.mesh.elements,md.mesh.x,md.mesh.y,field,'node')
-	t2=time.time()
-	print "%s%d%s\n" % (' done (',t2-t1,' seconds)')
-
-	#Compute metric
-	t1=time.time()
-	print "%s" % '      computing metric...'
-	metric=ComputeMetric(hessian,scale,epsilon,hmin,hmax,numpy.empty(0,int))
-	t2=time.time()
-	print "%s%d%s\n" % (' done (',t2-t1,' seconds)')
-
-	#write files
-	t1=time.time()
-	print "%s" % '      writing initial mesh files...'
-	numpy.savetxt('carre0.met',metric)
-
-	f=open('carre0.mesh','w')
-
-	#initialiation
-	f.write("\n%s\n%i\n" % ('MeshVersionFormatted',1))
-
-	#dimension
-	f.write("\n%s\n%i\n" % ('Dimension',2))
-
-	#Vertices
-	f.write("\n%s\n%i\n\n" % ('Vertices',md.mesh.numberofvertices))
-	for i in xrange(0,md.mesh.numberofvertices):
-		f.write("%8g %8g %i\n" % (md.mesh.x[i],md.mesh.y[i],0))
-
-	#Triangles
-	f.write("\n\n%s\n%i\n\n" % ('Triangles',md.mesh.numberofelements))
-	for i in xrange(0,md.mesh.numberofelements):
-		f.write("%i %i %i %i\n" % (md.mesh.elements[i,0],md.mesh.elements[i,1],md.mesh.elements[i,2],0))
-	numberofelements1=md.mesh.numberofelements
-
-	#Deal with rifts
-	if numpy.any(not numpy.isnan(md.rifts.riftstruct)):
-
-		#we have the list of triangles that make up the rift. keep those triangles around during refinement.
-		triangles=numpy.empty(0,int)
-		for riftstruct in md.rifts.riftstruct:
-			triangles=numpy.concatenate((triangles,riftstruct.segments[:,2]))
-
-		f.write("\n\n%s\n%i\n\n" % ('RequiredTriangles',numpy.size(triangles)))
-		for triangle in triangles:
-			f.write("%i\n" % triangle)
-
-	#close
-	f.close()
-	t2=time.time()
-	print "%s%d%s\n" % (' done (',t2-t1,' seconds)')
-
-	#call yams
-	print "%s\n" % '      call Yams...'
-	if   m.ispc():
-		#windows
-		subprocess.call('yams2-win -O 1 -v -0 -ecp -hgrad %g carre0 carre1' % gradation,shell=True)
-	elif ismac():
-		#Macosx
-		subprocess.call('yams2-osx -O 1 -v -0 -ecp -hgrad %g carre0 carre1' % gradation,shell=True)
-	else:
-		#Linux
-		subprocess.call('yams2-linux -O 1 -v -0 -ecp -hgrad %g carre0 carre1' % gradation,shell=True)
-
-	#plug new mesh
-	t1=time.time()
-	print "\n%s" % '      reading final mesh files...'
-	Tria=numpy.loadtxt('carre1.tria',int)
-	Coor=numpy.loadtxt('carre1.coor',float)
-	md.mesh.x=Coor[:,0]
-	md.mesh.y=Coor[:,1]
-	md.mesh.z=numpy.zeros((numpy.size(Coor,axis=0),1))
-	md.mesh.elements=Tria
-	md.mesh.numberofvertices=numpy.size(Coor,axis=0)
-	md.mesh.numberofelements=numpy.size(Tria,axis=0)
-	numberofelements2=md.mesh.numberofelements
-	t2=time.time()
-	print "%s%d%s\n\n" % (' done (',t2-t1,' seconds)')
-
-	#display number of elements
-	print "\n%s %i" % ('      inital number of elements:',numberofelements1)
-	print "\n%s %i\n\n" % ('      new    number of elements:',numberofelements2)
-
-	#clean up:
-	os.remove('carre0.mesh')
-	os.remove('carre0.met')
-	os.remove('carre1.tria')
-	os.remove('carre1.coor')
-	os.remove('carre1.meshb')
-
-	return md
-
Index: sm/trunk-jpl/src/py3/contrib/netCDF/ClassTry.py.bak
===================================================================
--- /issm/trunk-jpl/src/py3/contrib/netCDF/ClassTry.py.bak	(revision 23677)
+++ 	(revision )
@@ -1,122 +1,0 @@
-#module imports {{{
-from netCDF4 import Dataset
-import time
-import collections
-from os import path, remove
-#}}}
-
-				
-class truc(object):
-	#properties
-	def __init__(self,*filename):#{{{
-
-		def netCDFread(filename):
-			def walktree(data):
-				keys = data.groups.keys()
-				yield keys
-				for key in keys:
-					for children in walktree(data.groups[str(key)]):
-						yield children
-
-			if path.exists(filename):
-				print ('Opening {} for reading '.format(filename))
-				NCData=Dataset(filename, 'r')
-				class_dict={}
-				
-				for children in walktree(NCData):
-					for child in children:
-						class_dict[str(child)]=str(getattr(NCData.groups[str(child)],'classtype'))
-
-				return class_dict
-
-		if filename:		
-			classtype=netCDFread(filename[0])
-		else:
-			classtype=self.default_prop()
-			
-		module=map(__import__,dict.values(classtype))
-
-		for i,mod in enumerate(dict.keys(classtype)):
-			self.__dict__[mod] = getattr(module[i],str(classtype[str(mod)]))()
-			
-		#}}}
-	def default_prop(self):    # {{{
-		# ordered list of properties since vars(self) is random
-		return {'mesh':'mesh2d',\
-		        'mask':'mask',\
-		        'geometry':'geometry',\
-		        'constants':'constants',\
-		        'smb':'SMB',\
-		        'basalforcings':'basalforcings',\
-		        'materials':'matice',\
-		        'damage':'damage',\
-		        'friction':'friction',\
-		        'flowequation':'flowequation',\
-		        'timestepping':'timestepping',\
-		        'initialization':'initialization',\
-		        'rifts':'rifts',\
-		        'debug':'debug',\
-		        'verbose':'verbose',\
-		        'settings':'settings',\
-		        'toolkits':'toolkits',\
-		        'cluster':'generic',\
-		        'balancethickness':'balancethickness',\
-		        'stressbalance':'stressbalance',\
-		        'groundingline':'groundingline',\
-		        'hydrology':'hydrologyshreve',\
-		        'masstransport':'masstransport',\
-		        'thermal':'thermal',\
-		        'steadystate':'steadystate',\
-		        'transient':'transient',\
-		        'calving':'calving',\
-						'gia':'gia',\
-		        'autodiff':'autodiff',\
-		        'flaim':'flaim',\
-		        'inversion':'inversion',\
-		        'qmu':'qmu',\
-		        'outputdefinition':'outputdefinition',\
-		        'results':'results',\
-		        'radaroverlay':'radaroverlay',\
-		        'miscellaneous':'miscellaneous',\
-		        'private':'private'}
-	# }}}
-		
-	def __repr__(obj): #{{{
-		#print "Here %s the number: %d" % ("is", 37)
-		string="%19s: %-22s -- %s" % ("mesh","[%s,%s]" % ("1x1",obj.mesh.__class__.__name__),"mesh properties")
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("mask","[%s,%s]" % ("1x1",obj.mask.__class__.__name__),"defines grounded and floating elements"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("geometry","[%s,%s]" % ("1x1",obj.geometry.__class__.__name__),"surface elevation, bedrock topography, ice thickness,..."))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("constants","[%s,%s]" % ("1x1",obj.constants.__class__.__name__),"physical constants"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("smb","[%s,%s]" % ("1x1",obj.smb.__class__.__name__),"surface forcings"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("basalforcings","[%s,%s]" % ("1x1",obj.basalforcings.__class__.__name__),"bed forcings"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("materials","[%s,%s]" % ("1x1",obj.materials.__class__.__name__),"material properties"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("damage","[%s,%s]" % ("1x1",obj.damage.__class__.__name__),"damage propagation laws"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("friction","[%s,%s]" % ("1x1",obj.friction.__class__.__name__),"basal friction/drag properties"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("flowequation","[%s,%s]" % ("1x1",obj.flowequation.__class__.__name__),"flow equations"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("timestepping","[%s,%s]" % ("1x1",obj.timestepping.__class__.__name__),"time stepping for transient models"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("initialization","[%s,%s]" % ("1x1",obj.initialization.__class__.__name__),"initial guess/state"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("rifts","[%s,%s]" % ("1x1",obj.rifts.__class__.__name__),"rifts properties"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("debug","[%s,%s]" % ("1x1",obj.debug.__class__.__name__),"debugging tools (valgrind, gprof)"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("verbose","[%s,%s]" % ("1x1",obj.verbose.__class__.__name__),"verbosity level in solve"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("settings","[%s,%s]" % ("1x1",obj.settings.__class__.__name__),"settings properties"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("toolkits","[%s,%s]" % ("1x1",obj.toolkits.__class__.__name__),"PETSc options for each solution"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("cluster","[%s,%s]" % ("1x1",obj.cluster.__class__.__name__),"cluster parameters (number of cpus...)"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("balancethickness","[%s,%s]" % ("1x1",obj.balancethickness.__class__.__name__),"parameters for balancethickness solution"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("stressbalance","[%s,%s]" % ("1x1",obj.stressbalance.__class__.__name__),"parameters for stressbalance solution"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("groundingline","[%s,%s]" % ("1x1",obj.groundingline.__class__.__name__),"parameters for groundingline solution"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("hydrology","[%s,%s]" % ("1x1",obj.hydrology.__class__.__name__),"parameters for hydrology solution"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("masstransport","[%s,%s]" % ("1x1",obj.masstransport.__class__.__name__),"parameters for masstransport solution"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("thermal","[%s,%s]" % ("1x1",obj.thermal.__class__.__name__),"parameters for thermal solution"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("steadystate","[%s,%s]" % ("1x1",obj.steadystate.__class__.__name__),"parameters for steadystate solution"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("transient","[%s,%s]" % ("1x1",obj.transient.__class__.__name__),"parameters for transient solution"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("calving","[%s,%s]" % ("1x1",obj.calving.__class__.__name__),"parameters for calving"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("autodiff","[%s,%s]" % ("1x1",obj.autodiff.__class__.__name__),"automatic differentiation parameters"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("flaim","[%s,%s]" % ("1x1",obj.flaim.__class__.__name__),"flaim parameters"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("inversion","[%s,%s]" % ("1x1",obj.inversion.__class__.__name__),"parameters for inverse methods"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("qmu","[%s,%s]" % ("1x1",obj.qmu.__class__.__name__),"dakota properties"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("outputdefinition","[%s,%s]" % ("1x1",obj.outputdefinition.__class__.__name__),"output definition"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("results","[%s,%s]" % ("1x1",obj.results.__class__.__name__),"model results"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("radaroverlay","[%s,%s]" % ("1x1",obj.radaroverlay.__class__.__name__),"radar image for plot overlay"))
-		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("miscellaneous","[%s,%s]" % ("1x1",obj.miscellaneous.__class__.__name__),"miscellaneous fields"))
-		return string
-	# }}}
Index: sm/trunk-jpl/src/py3/contrib/netCDF/export_netCDF.py.bak
===================================================================
--- /issm/trunk-jpl/src/py3/contrib/netCDF/export_netCDF.py.bak	(revision 23677)
+++ 	(revision )
@@ -1,218 +1,0 @@
-from netCDF4 import Dataset, stringtochar
-import numpy
-import time
-import collections
-from mesh2d import *
-from mesh3dprisms import *
-from results import *
-from os import path, remove
-
-def export_netCDF(md,filename):
-	#Now going on Real treatment
-	if path.exists(filename):
-		print ('File {} allready exist'.format(filename))
-		newname=raw_input('Give a new name or "delete" to replace: ')
-		if newname=='delete':
-			remove(filename)
-		else:
-			print ('New file name is {}'.format(newname))
-			filename=newname
-			
-	NCData=Dataset(filename, 'w', format='NETCDF4')
-	NCData.description = 'Results for run' + md.miscellaneous.name
-	NCData.history = 'Created ' + time.ctime(time.time())
-
-	#gather geometry and timestepping as dimensions
-	Duration=md.timestepping.final_time-md.timestepping.start_time
-	if Duration>0 and md.timestepping.time_step*md.settings.output_frequency>0:
-		StepNum=Duration/(md.timestepping.time_step*md.settings.output_frequency)
-	else:
-		StepNum=1
-		
-	Dimension1=NCData.createDimension('Dimension1',md.mesh.numberofelements)
-	Dimension2=NCData.createDimension('Dimension2',md.mesh.numberofvertices)
-	Dimension3=NCData.createDimension('Dimension3',numpy.shape(md.mesh.elements)[1])
-	Dimension4=NCData.createDimension('Dimension4',StepNum)
-	Dimension5=NCData.createDimension('Dimension5',40)
-	Dimension6=NCData.createDimension('Dimension6',2) 
-
-	DimDict = {len(Dimension1):'Dimension1',
-						 len(Dimension2):'Dimension2',
-						 len(Dimension3):'Dimension3',
-						 len(Dimension4):'Dimension4',
-						 len(Dimension5):'Dimension5',
-						 len(Dimension6):'Dimension6'}
-
-	#get all model classes and create respective groups
-	groups=dict.keys(md.__dict__)
-	for group in groups:
-		NCgroup=NCData.createGroup(str(group))
-		#In each group gather the fields of the class
-		fields=dict.keys(md.__dict__[group].__dict__)
-
-		#Special treatment for the results
-		if str(group)=='results':
-			for supfield in fields:#looping on the different solutions
-				NCgroup.__setattr__('classtype', "results")
-				Subgroup=NCgroup.createGroup(str(supfield))
-				Subgroup.__setattr__('classtype',str(supfield))
-				if type(md.results.__dict__[supfield])==list:#the solution have several timestep
-					#get last timesteps and output frequency
-					last_step = numpy.size(md.results.__dict__[supfield])
-					step_freq = md.settings.output_frequency
-					#grab first time step
-					subfields=dict.keys(md.results.__dict__[supfield].__getitem__(0).__dict__)
-					for field in subfields:
-						if str(field)!='errlog' and str(field)!='outlog' and str(field)!='SolutionType':
-							Var=md.results.__dict__[supfield].__getitem__(0).__dict__[field]
-							DimDict=CreateVar(NCData,Var,field,Subgroup,DimDict,True,last_step,step_freq,md,supfield)
-					
-				elif type(md.results.__dict__[supfield])==results:#only one timestep
-					subfields=dict.keys(md.results.__dict__[supfield].__dict__)
-					for field in subfields:
-						if str(field)!='errlog' and str(field)!='outlog' and str(field)!='SolutionType':
-							print 'Treating '+str(group)+'.'+str(supfield)+'.'+str(field)
-							Var=md.results.__dict__[supfield].__dict__[field]
-							DimDict=CreateVar(NCData,Var,field,NCgroup,DimDict,False)
-				else:
-					print 'Result format not suported'
-		else:
-			
-			for field in fields:
-				print 'Treating ' +str(group)+'.'+str(field)
-				NCgroup.__setattr__('classtype', md.__dict__[group].__class__.__name__)
-				Var=md.__dict__[group].__dict__[field]
-				DimDict=CreateVar(NCData,Var,field,NCgroup,DimDict,False)
-	NCData.close()
-
-#============================================================================
-#Define the variables
-def CreateVar(NCData,var,field,Group,DimDict,istime,*step_args):
-	#grab type
-	try:
-		val_type=str(var.dtype)
-	except AttributeError:
-		val_type=type(var)
-		#grab dimension
-	try:
-		val_shape=dict.keys(var)
-	except TypeError:
-		val_shape=numpy.shape(var)
-
-
-	TypeDict = {float:'f8',
-							'float64':'f8',
-							int:'i8',
-							'int64':'i8'}
-		
-	val_dim=numpy.shape(val_shape)[0]
-	#Now define and fill up variable
-	#treating scalar string or bool as atribute
-	if val_type==str or val_type==bool:
-		Group.__setattr__(str(field), str(var))
-
-	#treating list as string table
-	#matlab does not recognise strings so we have to settle down with char arrays
-	elif val_type==list:
-		dimensions,DimDict=GetDim(NCData,var,val_shape,DimDict,val_dim,istime)
-		ncvar = Group.createVariable(str(field),'S1',dimensions,zlib=True)
-		charvar=stringtochar(numpy.array(var))
-		print charvar
-		print charvar.shape
-		for elt in range(0,val_dim):
-			try:
-				ncvar[elt] = charvar[elt]
-			except IndexError:
-				ncvar[0]= " "
-				#treating bool tables as string tables
-	elif val_type=='bool':
-		dimensions,DimDict=GetDim(NCData,var,val_shape,DimDict,val_dim,istime)
-		ncvar = Group.createVariable(str(field),'S1',dimensions,zlib=True)
-		for elt in range(0,val_shape[0]):
-			ncvar[elt] = str(var[elt])
-			#treating dictionaries as string tables of dim 2
-	elif val_type==collections.OrderedDict:
-		dimensions,DimDict=GetDim(NCData,var,val_shape,DimDict,val_dim,istime)
-		ncvar = Group.createVariable(str(field),'S1',dimensions,zlib=True)
-		for elt in range(0,val_dim):
-			ncvar[elt,0]=dict.keys(var)[elt]
-			ncvar[elt,1]=str(dict.values(var)[elt]) #converting to str to avoid potential problems
-			#Now dealing with numeric variables
-	else:
-		dimensions,DimDict=GetDim(NCData,var,val_shape,DimDict,val_dim,istime)
-		ncvar = Group.createVariable(str(field),TypeDict[val_type],dimensions,zlib=True)
-		
-		if istime:
-			last=step_args[0]
-			freq=step_args[1]
-			md=step_args[2]
-			supfield=step_args[3]
-			vartab=var
-			for time in range(freq-1,last,freq):
-				if time!=0:
-					timevar=md.results.__dict__[supfield].__getitem__(time).__dict__[field]
-					print 'Treating results.'+str(supfield)+'.'+str(field)+' for time '+str(time)
-					vartab=numpy.column_stack((vartab,timevar))
-			print numpy.shape(vartab)
-			try:
-				ncvar[:,:]=vartab[:,:]
-			except ValueError:
-				ncvar[:]=vartab.T[:]
-		else:
-			try:
-				nan_val=numpy.isnan(var)
-				if nan_val.all():
-					ncvar [:] = 'NaN'
-				else:
-					ncvar[:] = var
-			except TypeError: #type does not accept nan, get vallue of the variable
-				ncvar[:] = var
-	return DimDict
-
-#============================================================================
-#retriev the dimension tuple from a dictionnary
-def GetDim(NCData,var,shape,DimDict,i,istime):
-	output=[]
-	#grab type
-	try:
-		val_type=str(var.dtype)
-	except AttributeError:
-		val_type=type(var)
-	#grab dimension
-	for dim in range(0,i): #loop on the dimensions
-		if type(shape[0])==int: 
-			try:
-				output=output+[str(DimDict[shape[dim]])] #test if the dimension allready exist
-			except KeyError: #if not create it
-				if (shape[dim])>1:
-					index=len(DimDict)+1
-					NewDim=NCData.createDimension('Dimension'+str(index),(shape[dim]))
-					DimDict[len(NewDim)]='Dimension'+str(index)
-					output=output+[str(DimDict[shape[dim]])]
-					print 'Defining dimension ' +'Dimension'+str(index)
-		elif type(shape[0])==str:#dealling with a dictionnary
-			try:
-				output=[str(DimDict[numpy.shape(shape)[0]])]+['DictDim']
-			except KeyError:
-				index=len(DimDict)+1
-				NewDim=NCData.createDimension('Dimension'+str(index),numpy.shape(shape)[0])
-				DimDict[len(NewDim)]='Dimension'+str(index)
-				output=[str(DimDict[numpy.shape(dict.keys(var))[0]])]+['Dimension6']
-				print 'Defining dimension ' +'Dimension'+str(index)
-			break
-	if istime:
-		output=output+['Dimension4']
-	#dealing with char and not string as we should so we need to had a string length
-	if val_type=='bool' or val_type==collections.OrderedDict or val_type==list:
-		charvar=stringtochar(numpy.array(var))
-		stringlength=charvar.shape[charvar.ndim-1]
-		try:
-			output=output+[str(DimDict[stringlength])] #test if the dimension allready exist
-		except KeyError: #if not create it
-			if (shape[dim])>1:
-				index=len(DimDict)+1
-				NewDim=NCData.createDimension('Dimension'+str(index),(stringlength))
-				DimDict[len(NewDim)]='Dimension'+str(index)
-				output=output+[str(DimDict[stringlength])]
-				print 'Defining dimension ' +'Dimension'+str(index)
-	return tuple(output), DimDict
Index: sm/trunk-jpl/src/py3/contrib/netCDF/read_netCDF.py.bak
===================================================================
--- /issm/trunk-jpl/src/py3/contrib/netCDF/read_netCDF.py.bak	(revision 23677)
+++ 	(revision )
@@ -1,25 +1,0 @@
-from netCDF4 import Dataset
-import time
-import collections
-from os import path, remove
-
-def netCDFRead(filename):
-	
-	def walktree(data):
-		keys = data.groups.keys()
-		yield keys
-		for key in keys:
-			for children in walktree(data.groups[str(key)]):
-				yield children
-				
-	if path.exists(filename):
-		print ('Opening {} for reading '.format(filename))
-		NCData=Dataset(filename, 'r')
-		class_dict={}
-		
-		for children in walktree(NCData):
-			for child in children:
-				class_dict[str(child)]=str(getattr(NCData.groups[str(child)],'classtype')+'()')
-
-		print class_dict
-				
Index: sm/trunk-jpl/src/py3/contrib/paraview/exportVTK.py.bak
===================================================================
--- /issm/trunk-jpl/src/py3/contrib/paraview/exportVTK.py.bak	(revision 23677)
+++ 	(revision )
@@ -1,163 +1,0 @@
-import numpy
-import os
-import model
-import glob
-def exportVTK(filename,model,*args):
-	'''
-	vtk export
-	function exportVTK(filename,model)
-	creates a directory with the vtk files for displays in paraview
-	(only work for triangle and wedges based on their number of nodes)
-	
-	Give only the results for nw but could be extended to geometry, mask... 
-	
-	input: filename   destination 
-	(string)
-	------------------------------------------------------------------
-model      this is md 
-	------------------------------------------------------------------
-	By default only the results are exported, you can add whichever
-	field you need as a string:
-	add 'geometry' to export md.geometry
-
-	Basile de Fleurian:
-	'''
-	Dir=os.path.basename(filename)
-	Path=filename[:-len(Dir)]
-
-	if os.path.exists(filename):
-		print ('File {} allready exist'.format(filename))
-		newname=raw_input('Give a new name or "delete" to replace: ')
-		if newname=='delete':
-			filelist = glob.glob(filename+'/*')
-			for oldfile in filelist:
-				os.remove(oldfile)
-		else:
-			print ('New file name is {}'.format(newname))
-			filename=newname
-			os.mkdir(filename)
-	else:
-		os.mkdir(filename)
-
-	#get the element related variables
-	if 'z' in dict.keys(model.mesh.__dict__):
-		points=numpy.column_stack((model.mesh.x,model.mesh.y,model.mesh.z))
-		dim=3
-	else:
-		points=numpy.column_stack((model.mesh.x,model.mesh.y,numpy.zeros(numpy.shape(model.mesh.x))))
-		dim=2
-
-	num_of_points=numpy.size(model.mesh.x)
-	num_of_elt=numpy.shape(model.mesh.elements)[0]
-	point_per_elt=numpy.shape(model.mesh.elements)[1]
-		
-	#Select the type of element function of the number of nodes per elements
-	if point_per_elt==3:
-		celltype=5 #triangles
-	elif point_per_elt==6:
-		celltype=13 #wedges
-	else:
-		error('Your Element definition is not taken into account \n')
-
-	#this is the result structure
-	res_struct=model.results
-	if (len(res_struct.__dict__)>0):
-		#Getting all the solutions of the model
-		solnames=(dict.keys(res_struct.__dict__))
-		num_of_sols=len(solnames)
-		num_of_timesteps=1
-		out_freq=model.settings.output_frequency
-		#%building solutionstructure 
-		for solution in solnames:
-			#looking for multiple time steps
-			if (numpy.size(res_struct.__dict__[solution])>num_of_timesteps):
-				num_of_timesteps=numpy.size(res_struct.__dict__[solution])
-				num_of_timesteps=int(num_of_timesteps/out_freq)+1
-	else:
-		num_of_timesteps=1
-
-	for step in range(0,num_of_timesteps):
-		timestep=step
-		fid=open((filename +'/Timestep.vtk'+str(timestep)+'.vtk'),'w+')
-		fid.write('# vtk DataFile Version 2.0 \n')
-		fid.write('Data for run %s \n' % model.miscellaneous.name)
-		fid.write('ASCII \n')
-		fid.write('DATASET UNSTRUCTURED_GRID \n')
-		fid.write('POINTS %d float\n' % num_of_points)
-		if(dim==3):
-			for point in points:
-				fid.write('%f %f %f \n'%(point[0], point[1], point[2]))
-		elif(dim==2):
-			for point in points:
-				fid.write('%f %f %f \n'%(point[0], point[1], point[2]))
-			
-		fid.write('CELLS %d %d\n' %(num_of_elt, num_of_elt*(point_per_elt+1)))
-		
-		if point_per_elt==3:
-			for elt in range(0, num_of_elt):
-				fid.write('3 %d %d %d\n' %(model.mesh.elements[elt,0]-1,model.mesh.elements[elt,1]-1,model.mesh.elements[elt,2]-1))
-		elif point_per_elt==6:
-			for elt in range(0, num_of_elt):
-				fid.write('6 %d %d %d %d %d %d\n' %(model.mesh.elements[elt,0]-1,model.mesh.elements[elt,1]-1,model.mesh.elements[elt,2]-1,model.mesh.elements[elt,3]-1,model.mesh.elements[elt,4]-1,model.mesh.elements[elt,5]-1))
-		else:
-			print 'Number of nodes per element not supported'
-
-		fid.write('CELL_TYPES %d\n' %num_of_elt)
-		for elt in range(0, num_of_elt):
-			fid.write('%d\n' %celltype)
-
-		fid.write('POINT_DATA %s \n' %str(num_of_points))
-	
-		#loop over the different solution structures
-		if 'solnames' in locals():
-			for sol in solnames:
-				#dealing with results on different timesteps
-				if(numpy.size(res_struct.__dict__[sol])>timestep):
-					timestep = step
-				else:
-					timestep = numpy.size(res_struct.__dict__[sol])
-				
-				#getting the  fields in the solution
-				if(numpy.size(res_struct.__dict__[sol])>1):
-					fieldnames=dict.keys(res_struct.__dict__[sol].__getitem__(timestep*out_freq-1).__dict__)
-				else:
-					fieldnames=dict.keys(res_struct.__dict__[sol].__dict__)
-				#check which field is a real result and print
-				for field in fieldnames:
-					if(numpy.size(res_struct.__dict__[sol])>1):
-						fieldstruct=res_struct.__dict__[sol].__getitem__(timestep*out_freq-1).__dict__[field]
-					else:
-						fieldstruct=res_struct.__dict__[sol].__dict__[field]
-
-					if ((numpy.size(fieldstruct))==num_of_points):
-						fid.write('SCALARS %s float 1 \n' % field)
-						fid.write('LOOKUP_TABLE default\n')
-						for node in range(0,num_of_points):
-							#paraview does not like NaN, replacing
-							if numpy.isnan(fieldstruct[node]):
-								fid.write('%e\n' % -9999.9999)
-							#also checking for verry small value that mess up
-							elif (abs(fieldstruct[node])<1.0e-20):
-								fid.write('%e\n' % 0.0)
-							else:
-								fid.write('%e\n' % fieldstruct[node])
-					
-		#loop on arguments, if something other than result is asked, do
-		#it now
-		for other in args:
-			other_struct=model.__dict__[other]
-			othernames=(dict.keys(other_struct.__dict__))
-			for field in othernames:
-				if ((numpy.size(other_struct.__dict__[field]))==num_of_points):
-					fid.write('SCALARS %s float 1 \n' % field)
-					fid.write('LOOKUP_TABLE default\n')
-					for node in range(0,num_of_points):
-						#paraview does not like NaN, replacing
-						if numpy.isnan(other_struct.__dict__[field][node]):
-							fid.write('%e\n' % -9999.9999)
-						#also checking for verry small value that mess up
-						elif (abs(other_struct.__dict__[field][node])<1.0e-20):
-							fid.write('%e\n' % 0.0)
-						else:
-							fid.write('%e\n' % other_struct.__dict__[field][node])
-	fid.close();
