Index: ../trunk-jpl/src/m/plot/writejsfile.py
===================================================================
--- ../trunk-jpl/src/m/plot/writejsfile.py	(revision 19044)
+++ ../trunk-jpl/src/m/plot/writejsfile.py	(revision 19045)
@@ -1,3 +1,4 @@
+import numpy
 from writejsfield import writejsfield
 def writejsfile(filename,model,keyname):
 #WRITEJSFILE - write model file to javascript database
@@ -46,7 +47,7 @@
 		fid.write('result["label"]="{0}";\n'.format(results[i].label))
 		fid.write('result["shortlabel"]="{0}";\n'.format(results[i].shortlabel))
 		fid.write('result["unit"]="{0}";\n'.format(results[i].unit))
-		if len(results[i].data[2])>1:
+		if type(results[i].data)==numpy.float64:
 			fid.write('result["time_range"]=[{0},{1}];\n'.format(results[i].time_range[0],results[i].time_range[1]))
 		fid.write('results["{0}"]=result;\n'.format(i))
 		fid.write('<!--}}}-->\n')
Index: ../trunk-jpl/src/m/plot/writejsfield.py
===================================================================
--- ../trunk-jpl/src/m/plot/writejsfield.py	(revision 19044)
+++ ../trunk-jpl/src/m/plot/writejsfield.py	(revision 19045)
@@ -1,3 +1,4 @@
+import numpy
 def writejsfield(fid,name,variable,nods):
 #WRITEJSFIELD - write variable to javascript file 
 #
@@ -6,7 +7,7 @@
 #
 	#write array:
 	#if not isinstance(variable, list):
-	if True:
+	if type(variable[0])==numpy.float64:
 		fid.write('<!-- {0}{{{{{{-->\n'.format(name))
 		fid.write('{0}=['.format(name))
 		for i in xrange(1, nods-1):
Index: ../trunk-jpl/src/m/plot/export_gl.py
===================================================================
--- ../trunk-jpl/src/m/plot/export_gl.py	(revision 19044)
+++ ../trunk-jpl/src/m/plot/export_gl.py	(revision 19045)
@@ -9,6 +9,7 @@
 	class ResultObj(object):
 	    def __getattr__(self, attr):
 		return self.__dict__.get(attr)
+
 	print ('getting options')
 	templist=plotoptions(varargin); 
 	optionslist=templist.list;
@@ -19,7 +20,7 @@
 	print ('setting directory')
 	directory=options.getfieldvalue('directory','./');
 	databasename=options.getfieldvalue('database','Pig');
-	print(directory +databasename)	
+	
 	#scaling factor: 
 	print ('setting scaling factor')
 	scaling_factor=options.getfieldvalue('scaling_factor',50);
@@ -48,29 +49,21 @@
 	R1=6371000*np.ones(len(contour_surface1))+scaling_factor*contour_surface1;
 	R2=6371000*np.ones(len(contour_surface2))+scaling_factor*contour_surface2;
 
-	contourx1 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.cos(math.radians(long)), R1, contour_lat1, contour_long1);
-	contoury1 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.sin(math.radians(long)), R1, contour_lat1, contour_long1);
-	contourz1 = map(lambda r, lat: r * math.sin(math.radians(lat)), R1, contour_lat1);
+	model.contourx1 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.cos(math.radians(long)), R1, contour_lat1, contour_long1);
+	model.contoury1 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.sin(math.radians(long)), R1, contour_lat1, contour_long1);
+	model.contourz1 = map(lambda r, lat: r * math.sin(math.radians(lat)), R1, contour_lat1);
 	
-	contourx2 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.cos(math.radians(long)), R2, contour_lat2, contour_long2);
-	contoury2 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.sin(math.radians(long)), R2, contour_lat2, contour_long2);
-	contourz2 = map(lambda r, lat: r * math.sin(math.radians(lat)), R2, contour_lat2);
+	model.contourx2 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.cos(math.radians(long)), R2, contour_lat2, contour_long2);
+	model.contoury2 = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.sin(math.radians(long)), R2, contour_lat2, contour_long2);
+	model.contourz2 = map(lambda r, lat: r * math.sin(math.radians(lat)), R2, contour_lat2);
 
-	model.contourx1=contourx1;
-	model.contoury1=contoury1;
-	model.contourz1=contourz1;
-	model.contourx2=contourx2;
-	model.contoury2=contoury2;
-	model.contourz2=contourz2;
-
-
 	#}}}
 	#Deal with mesh and results {{{
 	print ('getting mesh')
-	surface=md.geometry.surface;
+	surface=md.geometry.surface.flatten();
 	numberofelements=md.mesh.numberofelements;
 	numberofvertices=md.mesh.numberofvertices;
-	R=6371000*np.ones(len(md.mesh.lat))+scaling_factor*surface.flatten();
+	R=6371000*np.ones(len(md.mesh.lat))+scaling_factor*surface;
 	
 	x = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.cos(math.radians(long)), R, md.mesh.lat,md.mesh.long);
 	y = map(lambda r, lat, long: r * math.cos(math.radians(lat)) * math.sin(math.radians(long)), R, md.mesh.lat,md.mesh.long);
@@ -91,7 +84,7 @@
 	for i in xrange(1,len(optionslist)):
 		options=optionslist[i]; 
 		options=checkplotoptions(md,options);
-		data=options.getfieldvalue('data');
+		data=options.getfieldvalue('data').flatten();
 		results.append(ResultObj())
 		results[i].data=data;
 		results[i].caxis=options.getfieldvalue('caxis',[min(data), max(data)]);
