[magics] 23/63: Fix python3 support: indentation errors in macro.py

Alastair McKinstry mckinstry at moszumanska.debian.org
Fri Mar 24 10:41:50 UTC 2017


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch debian/master
in repository magics.

commit 04247a83eada9f31500bd867a8d8e42877e02a70
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Tue Jul 5 16:07:55 2016 +0100

    Fix python3 support: indentation errors in macro.py
---
 debian/changelog             |    6 +
 debian/patches/python3.patch | 1425 ++++++++++++++++++++++++++++++++++++------
 2 files changed, 1238 insertions(+), 193 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index d0c68ba..0b05e2f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+magics++ (2.28.0-5) UNRELEASED; urgency=medium
+
+  * Fix python3 support: indentation errors in macro.py
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Tue, 05 Jul 2016 16:07:22 +0100
+
 magics++ (2.28.0-4) unstable; urgency=medium
 
   * Add missing license information to debian/copyright;
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
index fa44a7d..fb2db23 100644
--- a/debian/patches/python3.patch
+++ b/debian/patches/python3.patch
@@ -1,3 +1,8 @@
+Author: Alastair McKinstry <mckinstry at debian.org>
+Description: python2,3 compatability code
+Last-Updated: 2016-07-05
+Forwarded: no
+
 Index: magics++-2.28.0/tools/axis2doc.py
 ===================================================================
 --- magics++-2.28.0.orig/tools/axis2doc.py
@@ -550,195 +555,787 @@ Index: magics++-2.28.0/python/Magics/macro.py
 ===================================================================
 --- magics++-2.28.0.orig/python/Magics/macro.py
 +++ magics++-2.28.0/python/Magics/macro.py
-@@ -1,3 +1,4 @@
+@@ -1,361 +1,381 @@
 +from __future__ import print_function
++from six import iteritems
++
  import os
  import Magics
  import numpy
-@@ -61,7 +62,7 @@ class Action(object):
- 		return x
  
- 	def inspect(self):
++
+ class Context(object):
+-	def __init__(self):
+-		self.tmp = []
+-		pass
++    def __init__(self):
++        self.tmp = []
++        pass
+ 
+ global context
+-context  = Context()
+-
+-actions={
+-	"mobs": "pobs",
+-	"mcoast": "pcoast",
+-	"pcoast": "pcoast",
+-	"mtext": "ptext",
+-	"ptext": "ptext",
+-	"psymb": "psymb",
+-	"msymb": "psymb",
+-	"pcont": "pcont",
+-	"mcont": "pcont",
+-	"pgeo": "pgeo",
+-	"mgeojson": "pgeojson",
+-	"mgeo": "pgeo",
+-	"mlegend": "",
+-	"plegend": "",
+-	"mgrib": "pgrib",
+-	"pgrib": "pgrib",
+-	"mwind": "pwind",
+-	"pwind": "pwind",
+-	"mgraph": "pgraph",
+-	"pgraph": "pgraph",
+-	"maxis": "paxis",
+-	"paxis": "paxis",
+-	"minput": "pinput",
+-	"mtable": "ptable",
+-	"ptable": "ptable",
+-	"pboxplot": "pboxplot",
+-	"mboxplot": "pboxplot",
+-	"pinput": "pinput"
+-	}
+-
++context = Context()
+ 
++actions = {
++    "mobs": "pobs",
++    "mcoast": "pcoast",
++    "pcoast": "pcoast",
++    "mtext": "ptext",
++    "ptext": "ptext",
++    "psymb": "psymb",
++    "msymb": "psymb",
++    "pcont": "pcont",
++    "mcont": "pcont",
++    "pgeo": "pgeo",
++    "mgeojson": "pgeojson",
++    "mgeo": "pgeo",
++    "mlegend": "",
++    "plegend": "",
++    "mgrib": "pgrib",
++    "pgrib": "pgrib",
++    "mwind": "pwind",
++    "pwind": "pwind",
++    "mgraph": "pgraph",
++    "pgraph": "pgraph",
++    "maxis": "paxis",
++    "paxis": "paxis",
++    "minput": "pinput",
++    "mtable": "ptable",
++    "ptable": "ptable",
++    "pboxplot": "pboxplot",
++    "mboxplot": "pboxplot",
++    "pinput": "pinput"
++    }
+ 
+ 
+ class Action(object):
+-	def __init__(self, verb, action, html, args):
+-		self.verb = verb
+-		self.action = action
+-		self.args = args
+-		if ( html == "") :
+-			self.html = verb 
+-		else :			
+-			self.html = "<a href=/wiki/display/MAGP/%s target='_blank'>%s</a>" % (html, verb)  
+-
+-	def __repr__(self):
+-		x = ""
+-		for key in self.args.keys():
+-			x = x + " %s = '%s'\n" % (key, self.args[key])
+-		return x
+-
+-	def inspect(self):
 -		print self
-+		print (self)
- 
- 	def quote(self, v):
- 		return "\"" + v + "\""
-@@ -120,12 +121,12 @@ class Action(object):
- 				dim  = len(self.args[key].shape)
- 				if isinstance(self.args[key][0], int):
- 					if (dim == 2) :
+-
+-	def quote(self, v):
+-		return "\"" + v + "\""
+-
+-	def tohtml(self, file):
+-		sep=""
+-		val="%s("%self.html
+-
+-		for key in self.args.keys():
+-			if isinstance(self.args[key], str):
+-				if key == 'odb_data':
+-					Magics.setc('odb_filename', self.args[key])
+-				else:
+-					val+= '%s%s = "%s"'%(sep, key, self.args[key])
+-			elif isinstance(self.args[key], int):
+-				val +=  '%s%s = %d'%(sep, key, self.args[key])
+-			elif isinstance(self.args[key], float):
+-				val += '%s%s = %0.2f'%(sep, key, self.args[key])
+-			elif isinstance(self.args[key], list) :
+-				if isinstance (self.args[key][0], str):
+-				   vval = ""
+-				   vsep = ""
+-				   if (len(self.args[key]) < 5 ):
+-			   			for v in self.args[key]:
+-			   				vval += vsep + self.quote(v)
+-			   				vsep = ", "
+-				   else :
+-						vval = self.quote(self.args[key][0]) + ", " + self.quote(self.args[key][1]) + ",...," + self.quote(self.args[key][-2]) +  ", " + self.quote(self.args[key][-1]) 
+-				   vval += ""
+-				   val+= '%s%s = [%s]'%(sep, key, vval)
+-				elif isinstance(self.args[key][0], int):
+-				   vval = ""
+-				   vsep = ""
+-				   if (len(self.args[key]) < 5 ):
+-			   			for v in self.args[key]:
+-			   				vval += vsep + ("%df"%v)
+-			   				vsep = ", "
+-				   else :
+-							vval = ("%d"%self.args[key][0]) + ", " + ("%d"%self.args[key][1]) + ",...," + ("%d"%self.args[key][-2]) +  ", " + ("%d"%self.args[key][-1]) 
+-				   vval += ""
+-				   val+= '%s%s = %s'%(sep, key, vval)
+-				elif isinstance(self.args[key][0], float):
+-				   vval = ""
+-				   vsep = ""
+-				   if (len(self.args[key]) < 5 ):
+-			   			for v in self.args[key]:
+-			   				vval += vsep + ("%0.2f"%v)
+-			   				vsep = ", "
+-				   else :
+-						vval = ("%0.2f"%self.args[key][0]) + ", " + ("%0.2f"%self.args[key][1]) + ",...," + ("%0.2f"%self.args[key][-2]) +  ", " + ("%0.2f"%self.args[key][-1]) 
+-				
+-				   vval += ""
+-				   val+= '%s%s = [%s]'%(sep, key, vval)
+-			elif isinstance(self.args[key], numpy.ndarray) :
+-				type = self.args[key].dtype
+-				dim  = len(self.args[key].shape)
+-				if isinstance(self.args[key][0], int):
+-					if (dim == 2) :
 -				   		print "pset2i" 
-+				   		print ("pset2i")
- 					else :
+-					else :
 -				   		print "pset1i" 
-+				   		print ("pset1i")
- 				elif ( type == 'float64' or type == 'float32') :
- 					if (dim == 2) :
+-				elif ( type == 'float64' or type == 'float32') :
+-					if (dim == 2) :
 -				   		print "pset2r" 
-+				   		print ("pset2r")
- 					else :
- 				   		vval = ""
- 				   		vsep = ""
-@@ -138,10 +139,10 @@ class Action(object):
- 				   		vval += ""
- 				   		val+= '%s%s = [%s]'%(sep, key, vval)
- 				else :
+-					else :
+-				   		vval = ""
+-				   		vsep = ""
+-						if (len(self.args[key]) < 5 ):
+-				   			for v in self.args[key]:
+-				   				vval += vsep + ("%0.2f"%v)
+-				   				vsep = ", "
+-						else :
+-							vval = ("%0.2f"%self.args[key][0]) + ", " + ("%0.2f"%self.args[key][1]) + ",...," + ("%0.2f"%self.args[key][-2]) +  ", " + ("%0.2f"%self.args[key][-1]) 
+-				   		vval += ""
+-				   		val+= '%s%s = [%s]'%(sep, key, vval)
+-				else :
 -					print "type???->", key
-+					print ("type???->", key)
- 			sep=",\n\t"
- 				
+-			sep=",\n\t"
+-				
 -		print >>file, val + ")\n"
-+		print (val + ")\n", file=file)
- 
- 	def tomv4(self, file):
- 		sep="\t"
-@@ -167,20 +168,20 @@ class Action(object):
- 				   vval += "]"
- 				   val+= '%s%s = %s'%(sep, key.upper(), vval)
- 				elif isinstance(self.args[key][0], int):
+-
+-	def tomv4(self, file):
+-		sep="\t"
+-		val="%s,\n"%self.verb.upper()
+-
+-		for key in self.args.keys():
+-			if isinstance(self.args[key], str):
+-				if key == 'odb_data':
+-					Magics.setc('odb_filename', self.args[key])
+-				else:
+-					val+= '%s%s = %s'%(sep, key.upper(), self.args[key].upper())
+-			elif isinstance(self.args[key], int):
+-				val +=  '%s%s = %d'%(sep, key.upper(), self.args[key])
+-			elif isinstance(self.args[key], float):
+-				val += '%s%s = %0.2f'%(sep, key.upper(), self.args[key])
+-			elif isinstance(self.args[key], list) :
+-				if isinstance (self.args[key][0], str):
+-				   vval = "["
+-				   vsep = ""
+-				   for v in self.args[key]:
+-				   		vval += vsep + v
+-				   		vsep = ", "
+-				   vval += "]"
+-				   val+= '%s%s = %s'%(sep, key.upper(), vval)
+-				elif isinstance(self.args[key][0], int):
 -				   print "pset1i"
-+				   print ("pset1i")
- 				elif isinstance(self.args[key][0], float):
+-				elif isinstance(self.args[key][0], float):
 -				   print "pset1r" 
-+				   print ("pset1r") 
- 			elif isinstance(self.args[key], numpy.ndarray) :
- 				type = self.args[key].dtype
- 				dim  = len(self.args[key].shape)
- 				if isinstance(self.args[key][0], int):
- 					if (dim == 2) :
+-			elif isinstance(self.args[key], numpy.ndarray) :
+-				type = self.args[key].dtype
+-				dim  = len(self.args[key].shape)
+-				if isinstance(self.args[key][0], int):
+-					if (dim == 2) :
 -				   		print "pset2i" 
-+				   		print ("pset2i")
- 					else :
+-					else :
 -				   		print "pset1i" 
-+				   		print ("pset1i")
- 				elif ( type == 'float64' or type == 'float32') :
- 					if (dim == 2) :
+-				elif ( type == 'float64' or type == 'float32') :
+-					if (dim == 2) :
 -				   		print "pset2r" 
-+				   		print ("pset2r" )
- 					else :
- 				   		vval = "["
- 				   		vsep = ""
-@@ -191,10 +192,10 @@ class Action(object):
- 				   		val+= '%s%s = %s'%(sep, key.upper(), vval)
- 				   		
- 				else :
+-					else :
+-				   		vval = "["
+-				   		vsep = ""
+-				   		for v in self.args[key]:
+-				   				vval += vsep + ("%0.2f"%v)
+-				   				vsep = ", "
+-				   		vval += "]"
+-				   		val+= '%s%s = %s'%(sep, key.upper(), vval)
+-				   		
+-				else :
 -					print "type???->", key
-+					print ("type???->", key)
- 			sep=",\n\t"
- 				
+-			sep=",\n\t"
+-				
 -		print >> file, val + "\n"
-+		print (val + "\n", file=file)
- 
- 
- 
-@@ -202,18 +203,18 @@ class Action(object):
- 
- 	def tofortran(self, f):
- 		if self.action == Magics.new_page :
+-
+-
+-
+-
+-
+-	def tofortran(self, f):
+-		if self.action == Magics.new_page :
 -			print >> f, '\tcall pnew("page")'
-+			print ('\tcall pnew("page")', file=f)
- 			return
- 		for key in self.args.keys():
- 			if isinstance(self.args[key], str):
- 				if key == 'odb_data':
- 					Magics.setc('odb_filename', self.args[key])
- 				else:
+-			return
+-		for key in self.args.keys():
+-			if isinstance(self.args[key], str):
+-				if key == 'odb_data':
+-					Magics.setc('odb_filename', self.args[key])
+-				else:
 -					print >> f, '\tcall psetc("%s", "%s")'%(key, self.args[key])
-+					print('\tcall psetc("%s", "%s")'%(key, self.args[key]), file=f)
- 			elif isinstance(self.args[key], int):
+-			elif isinstance(self.args[key], int):
 -				print >>f, '\tcall pseti("%s", %d)'%(key, self.args[key])
-+				print ('\tcall pseti("%s", %d)'%(key, self.args[key]), file=f)
- 			elif isinstance(self.args[key], float):
+-			elif isinstance(self.args[key], float):
 -				print >> f, '\tcall psetr("%s", %0.2f)'%(key, self.args[key])
-+				print ('\tcall psetr("%s", %0.2f)'%(key, self.args[key]), file=f)
- 			elif isinstance(self.args[key], list) :
- 				if isinstance (self.args[key][0], str):
- 				   nb = 0
-@@ -230,9 +231,9 @@ class Action(object):
- 							sep = ",&\n\t\t"
- 							newline = newline + 70
- 				   val += "/)"
+-			elif isinstance(self.args[key], list) :
+-				if isinstance (self.args[key][0], str):
+-				   nb = 0
+-				   for v in self.args[key]:
+-				   		nb = max(nb, len(v))
+-				   	
+-				   val = "(/"
+-				   sep = ""
+-				   newline = 70
+-				   for v in self.args[key]:
+-				   		val += sep + self.quote(v.ljust(nb))
+-						sep = ", "
+-				   		if len(val) > newline  :
+-							sep = ",&\n\t\t"
+-							newline = newline + 70
+-				   val += "/)"
 -				   print >>f, '\tcall pset1c("%s", %s, %d)'%(key, val, len(self.args[key]))
-+				   print ('\tcall pset1c("%s", %s, %d)'%(key, val, len(self.args[key])), file=f)
- 				elif isinstance(self.args[key][0], int):
+-				elif isinstance(self.args[key][0], int):
 -				   print "pset1i"
-+				   print ("pset1i")
- 				elif isinstance(self.args[key][0], float):
- 				   	val = "(/"
- 				   	sep = ""
-@@ -240,18 +241,18 @@ class Action(object):
- 				   		val += sep + ("%0.2f" % v)
- 				   		sep = ", "
- 				   	val += "/)"
+-				elif isinstance(self.args[key][0], float):
+-				   	val = "(/"
+-				   	sep = ""
+-				   	for v in self.args[key]:
+-				   		val += sep + ("%0.2f" % v)
+-				   		sep = ", "
+-				   	val += "/)"
 -				   	print >>f, '\tcall pset1r("%s", %s, %d)'%(key, val, len(self.args[key]))
-+				   	print ('\tcall pset1r("%s", %s, %d)'%(key, val, len(self.args[key])), file=f)
- 			elif isinstance(self.args[key], numpy.ndarray) :
- 				type = self.args[key].dtype
- 				dim  = len(self.args[key].shape)
- 				if isinstance(self.args[key][0], int):
- 					if (dim == 2) :
+-			elif isinstance(self.args[key], numpy.ndarray) :
+-				type = self.args[key].dtype
+-				dim  = len(self.args[key].shape)
+-				if isinstance(self.args[key][0], int):
+-					if (dim == 2) :
 -				   		print "pset2i" 
-+				   		print ("pset2i")
- 					else :
+-					else :
 -				   		print "pset1i" 
-+				   		print ("pset1i")
- 				elif ( type == 'float64' or type == 'float32') :
- 					if (dim == 2) :
+-				elif ( type == 'float64' or type == 'float32') :
+-					if (dim == 2) :
 -				   		print "pset2r" 
-+				   		print ("pset2r")
- 					else :
- 				   		val = "(/"
- 				   		sep = ""
-@@ -259,20 +260,20 @@ class Action(object):
- 				   			val += sep + ("%0.2f" % v)
- 				   			sep = ", "
- 				   		val += "/)"
+-					else :
+-				   		val = "(/"
+-				   		sep = ""
+-				   		for v in self.args[key]:
+-				   			val += sep + ("%0.2f" % v)
+-				   			sep = ", "
+-				   		val += "/)"
 -				   		print >>f, '\tcall pset1r("%s", %s, %d)'%(key, val, len(self.args[key]))
-+				   		print ('\tcall pset1r("%s", %s, %d)'%(key, val, len(self.args[key])), file=f)
- 				elif isinstance(self.args[key][0], int):
+-				elif isinstance(self.args[key][0], int):
 -				   		print "pset1r" 
-+				   		print ("pset1r" )
- 				else :
+-				else :
 -					print "type???->", key
-+					print ("type???->", key)
- 
- 		if self.action != None and actions[self.verb] != "" and actions[self.verb] != "pinput":
+-
+-		if self.action != None and actions[self.verb] != "" and actions[self.verb] != "pinput":
 -			print >>f, "\tcall %s\n"%actions[self.verb] 
-+			print ("\tcall %s\n"%actions[self.verb] , file=f)
- 			for key in self.args.keys():
+-			for key in self.args.keys():
 -				print >>f, "\tcall preset('%s')"%key 
 -			print >>f, ""
-+				print ("\tcall preset('%s')"%key , file=f)
-+			print ("", file=f)
- 
- 		else:
+-
+-		else:
 -			print >>f, ""
-+			print ("", file=f)
- 
- 
- 	def clean_object(self, obj):
-@@ -291,8 +292,8 @@ class Action(object):
- 			for i,v in obj.iteritems():
- 				obj[i] = self.clean_object(v)
- 		else:
+-
+-
+-	def clean_object(self, obj):
+-
+-		if type(obj) in (int, float, str, bool, numpy.float64):
+-			return obj
+-		elif type(obj) == unicode:
+-			return str(obj)
+-		elif type(obj) in (list, tuple, set, numpy.ndarray):
+-			if type(obj[0]) != unicode:
+-				return obj
+-			obj = list(obj)
+-			for i,v in enumerate(obj):
+-				obj[i] = self.clean_object(v)
+-		elif type(obj) == dict:
+-			for i,v in obj.iteritems():
+-				obj[i] = self.clean_object(v)
+-		else:
 -			print "Invalid object in data, converting to string: " 
 -			print  type(obj)
-+			print ("Invalid object in data, converting to string: " )
-+			print ( type(obj))
- 			obj = str(obj) 
- 		return obj
- 
-@@ -332,7 +333,7 @@ class Action(object):
- 					else :
- 						Magics.set1r(key, self.args[key].copy())
- 				else :
+-			obj = str(obj) 
+-		return obj
+-
+-
+-	def execute(self):
+-
+-		if ( self.action != Magics.odb) :
+-		    self.args = self.clean_object(self.args)
+-		for key in self.args.keys():
+-			if isinstance(self.args[key], str):
+-				if key == 'odb_data':
+-					Magics.setc('odb_filename', self.args[key])
+-				else:
+-					Magics.setc(key, self.args[key])
+-			elif isinstance(self.args[key], int):
+-				Magics.seti(key, self.args[key])
+-			elif isinstance(self.args[key], float):
+-				Magics.setr(key, self.args[key])
+-			elif isinstance(self.args[key], list) :
+-				if isinstance(self.args[key][0], str):
+-				   Magics.set1c(key, self.args[key])
+-				elif isinstance(self.args[key][0], int):
+-				   Magics.set1i(key, numpy.array(self.args[key], dtype='i'))
+-				elif isinstance(self.args[key][0], float):
+-				   Magics.set1r(key, numpy.array(self.args[key]))
+-			elif isinstance(self.args[key], numpy.ndarray) :
+-				type = self.args[key].dtype
+-				dim  = len(self.args[key].shape)
+-				if isinstance(self.args[key][0], int):
+-					if (dim == 2) :
+-						Magics.set2i(key, self.args[key].copy())
+-					else :
+-						Magics.set1i(key, self.args[key].copy())
+-				elif ( type == 'float64' or type == 'float32') :
+-					if (dim == 2) :
+-						Magics.set2r(key, self.args[key].copy())
+-					else :
+-						Magics.set1r(key, self.args[key].copy())
+-				else :
 -					print "type???->", key
-+					print ("type???->", key)
+-
+-			else:
+-				self.args[key].execute(key)
+-
+-		if self.action != None :
+-			if self.action != Magics.new_page :
+-				if self.action == Magics.legend :
+-					Magics.setc("legend", "on")
+-				self.action()
+-				if self.action != Magics.obs and self.action != Magics.minput:
+-					for key in self.args.keys():
+-						Magics.reset(key)
+-			else:
+-				self.action("page")
++    def __init__(self, verb, action, html, args):
++        self.verb = verb
++        self.action = action
++        self.args = args
++        if html == "":
++            self.html = verb
++        else:
++            self.html = "<a href=/wiki/display/MAGP/%s target='_blank'>%s</a>"\
++                        % (html, verb)
++
++    def __repr__(self):
++        x = ""
++        for key in list(self.args.keys()):
++            x = x + " %s = '%s'\n" % (key, self.args[key])
++        return x
++
++    def inspect(self):
++        print(self)
++
++    def quote(self, v):
++        return "\"" + v + "\""
++
++    def tohtml(self, file):
++        sep = ""
++        val = "%s(" % self.html
++
++        for key in list(self.args.keys()):
++            if isinstance(self.args[key], str):
++                if key == 'odb_data':
++                    Magics.setc('odb_filename', self.args[key])
++                else:
++                    val += '%s%s = "%s"' % (sep, key, self.args[key])
++            elif isinstance(self.args[key], int):
++                val += '%s%s = %d' % (sep, key, self.args[key])
++            elif isinstance(self.args[key], float):
++                val += '%s%s = %0.2f' % (sep, key, self.args[key])
++            elif isinstance(self.args[key], list):
++                if isinstance(self.args[key][0], str):
++                    vval = ""
++                    vsep = ""
++                    if len(self.args[key]) < 5:
++                        for v in self.args[key]:
++                            vval += vsep + self.quote(v)
++                            vsep = ", "
++                    else:
++                        vval = self.quote(self.args[key][0]) + ", " + \
++                               self.quote(self.args[key][1]) + ",...," + \
++                               self.quote(self.args[key][-2]) + ", " + \
++                               self.quote(self.args[key][-1])
++                    vval += ""
++                    val += '%s%s = [%s]' % (sep, key, vval)
++                elif isinstance(self.args[key][0], int):
++                    vval = ""
++                    vsep = ""
++                    if len(self.args[key]) < 5:
++                        for v in self.args[key]:
++                            vval += vsep + ("%df" % v)
++                            vsep = ", "
++                    else:
++                        vval = ("%d" % self.args[key][0]) + ", " + \
++                               ("%d" % self.args[key][1]) + ",...," + \
++                               ("%d" % self.args[key][-2]) + ", " + \
++                               ("%d" % self.args[key][-1])
++                    vval += ""
++                    val += '%s%s = %s' % (sep, key, vval)
++                elif isinstance(self.args[key][0], float):
++                    vval = ""
++                    vsep = ""
++                    if len(self.args[key]) < 5:
++                        for v in self.args[key]:
++                            vval += vsep + ("%0.2f" % v)
++                            vsep = ", "
++                    else:
++                        vval = ("%0.2f" % self.args[key][0]) + ", " + \
++                               ("%0.2f" % self.args[key][1]) + ",...," + \
++                               ("%0.2f" % self.args[key][-2]) + ", " + \
++                               ("%0.2f" % self.args[key][-1])
++
++                    vval += ""
++                    val += '%s%s = [%s]' % (sep, key, vval)
++            elif isinstance(self.args[key], numpy.ndarray):
++                type = self.args[key].dtype
++                dim = len(self.args[key].shape)
++                if isinstance(self.args[key][0], int):
++                    if dim == 2:
++                        print("pset2i")
++                    else:
++                        print("pset1i")
++                elif (type == 'float64' or type == 'float32'):
++                    if dim == 2:
++                        print("pset2r")
++                    else:
++                        vval = ""
++                        vsep = ""
++                        if len(self.args[key]) < 5:
++                            for v in self.args[key]:
++                                vval += vsep + ("%0.2f" % v)
++                                vsep = ", "
++                        else:
++                            vval = ("%0.2f" % self.args[key][0]) + ", " + \
++                                   ("%0.2f" % self.args[key][1]) + ",...," + \
++                                   ("%0.2f" % self.args[key][-2]) + ", " + \
++                                   ("%0.2f" % self.args[key][-1])
++                        vval += ""
++                        val += '%s%s = [%s]' % (sep, key, vval)
++                else:
++                    print("type???->", key)
++            sep = ",\n\t"
++
++        print(val + ")\n", file=file)
++
++    def tomv4(self, file):
++        sep = "\t"
++        val = "%s,\n" % self.verb.upper()
++
++        for key in list(self.args.keys()):
++            if isinstance(self.args[key], str):
++                if key == 'odb_data':
++                    Magics.setc('odb_filename', self.args[key])
++                else:
++                    val += '%s%s = %s' % \
++                           (sep, key.upper(), self.args[key].upper())
++            elif isinstance(self.args[key], int):
++                val += '%s%s = %d' % (sep, key.upper(), self.args[key])
++            elif isinstance(self.args[key], float):
++                val += '%s%s = %0.2f' % (sep, key.upper(), self.args[key])
++            elif isinstance(self.args[key], list):
++                if isinstance(self.args[key][0], str):
++                    vval = "["
++                    vsep = ""
++                    for v in self.args[key]:
++                        vval += vsep + v
++                        vsep = ", "
++                    vval += "]"
++                    val += '%s%s = %s' % (sep, key.upper(), vval)
++                elif isinstance(self.args[key][0], int):
++                    print("pset1i")
++                elif isinstance(self.args[key][0], float):
++                    print("pset1r")
++            elif isinstance(self.args[key], numpy.ndarray):
++                type = self.args[key].dtype
++                dim = len(self.args[key].shape)
++                if isinstance(self.args[key][0], int):
++                    if dim == 2:
++                        print("pset2i")
++                    else:
++                        print("pset1i")
++                elif (type == 'float64' or type == 'float32'):
++                    if dim == 2:
++                        print("pset2r")
++                    else:
++                        vval = "["
++                        vsep = ""
++                        for v in self.args[key]:
++                            vval += vsep + ("%0.2f" % v)
++                            vsep = ", "
++                        vval += "]"
++                        val += '%s%s = %s' % (sep, key.upper(), vval)
++
++                else:
++                    print("type???->", key)
++            sep = ",\n\t"
++
++        print(val + "\n", file=file)
++
++    def tofortran(self, f):
++        if self.action == Magics.new_page:
++            print('\tcall pnew("page")', file=f)
++            return
++        for key in list(self.args.keys()):
++            if isinstance(self.args[key], str):
++                if key == 'odb_data':
++                    Magics.setc('odb_filename', self.args[key])
++                else:
++                    print('\tcall psetc("%s", "%s")' % (key, self.args[key]),
++                          file=f)
++            elif isinstance(self.args[key], int):
++                print('\tcall pseti("%s", %d)' % (key, self.args[key]),
++                      file=f)
++            elif isinstance(self.args[key], float):
++                print('\tcall psetr("%s", %0.2f)' % (key, self.args[key]),
++                      file=f)
++            elif isinstance(self.args[key], list):
++                if isinstance(self.args[key][0], str):
++                    nb = 0
++                    for v in self.args[key]:
++                        nb = max(nb, len(v))
++                    val = "(/"
++                    sep = ""
++                    newline = 70
++                    for v in self.args[key]:
++                        val += sep + self.quote(v.ljust(nb))
++                        sep = ", "
++                        if len(val) > newline:
++                            sep = ",&\n\t\t"
++                            newline = newline + 70
++                    val += "/)"
++                    print('\tcall pset1c("%s", %s, %d)' %
++                          (key, val, len(self.args[key])),
++                          file=f)
++                elif isinstance(self.args[key][0], int):
++                    print("pset1i")
++                elif isinstance(self.args[key][0], float):
++                    val = "(/"
++                    sep = ""
++                    for v in self.args[key]:
++                        val += sep + ("%0.2f" % v)
++                        sep = ", "
++                    val += "/)"
++                    print('\tcall pset1r("%s", %s, %d)' %
++                          (key, val, len(self.args[key])),
++                          file=f)
++            elif isinstance(self.args[key], numpy.ndarray):
++                type = self.args[key].dtype
++                dim = len(self.args[key].shape)
++                if isinstance(self.args[key][0], int):
++                    if dim == 2:
++                        print("pset2i")
++                    else:
++                        print("pset1i")
++                elif (type == 'float64' or type == 'float32'):
++                    if dim == 2:
++                        print("pset2r")
++                    else:
++                        val = "(/"
++                        sep = ""
++                        for v in self.args[key]:
++                            val += sep + ("%0.2f" % v)
++                            sep = ", "
++                        val += "/)"
++                        print('\tcall pset1r("%s", %s, %d)' %
++                              (key, val, len(self.args[key])),
++                              file=f)
++                elif isinstance(self.args[key][0], int):
++                    print("pset1r")
++                else:
++                    print("type???->", key)
++
++        if (self.action is not None) and (actions[self.verb] != "") and \
++           (actions[self.verb] != "pinput"):
++            print("\tcall %s\n" % actions[self.verb], file=f)
++            for key in list(self.args.keys()):
++                print("\tcall preset('%s')" % key, file=f)
++            print("", file=f)
++
++        else:
++            print("", file=f)
++
++    def clean_object(self, obj):
++
++        if type(obj) in (int, float, str, bool, numpy.float64):
++            return obj
++        elif type(obj) == unicode:
++            return str(obj)
++        elif type(obj) in (list, tuple, set, numpy.ndarray):
++            if (type(obj[0]) != unicode) and (type(obj[0]) != str):
++                return obj
++            obj = list(obj)
++            for i, v in enumerate(obj):
++                obj[i] = self.clean_object(v)
++        elif type(obj) == dict:
++            for i, v in iteritems(obj):
++                obj[i] = self.clean_object(v)
++        else:
++            print("Invalid object in data, converting to string: ")
++            print(type(obj))
++            obj = str(obj)
++        return obj
++
++    def execute(self):
++
++        if self.action != Magics.odb:
++            self.args = self.clean_object(self.args)
++        for key in list(self.args.keys()):
++            if isinstance(self.args[key], str):
++                if key == 'odb_data':
++                    Magics.setc('odb_filename', self.args[key])
++                else:
++                    Magics.setc(key, self.args[key])
++            elif isinstance(self.args[key], int):
++                Magics.seti(key, self.args[key])
++            elif isinstance(self.args[key], float):
++                Magics.setr(key, self.args[key])
++            elif isinstance(self.args[key], list):
++                if isinstance(self.args[key][0], str):
++                    Magics.set1c(key, self.args[key])
++                elif isinstance(self.args[key][0], int):
++                    Magics.set1i(key, numpy.array(self.args[key], dtype='i'))
++                elif isinstance(self.args[key][0], float):
++                    Magics.set1r(key, numpy.array(self.args[key]))
++            elif isinstance(self.args[key], numpy.ndarray):
++                type = self.args[key].dtype
++                dim = len(self.args[key].shape)
++                if isinstance(self.args[key][0], int):
++                    if dim == 2:
++                        Magics.set2i(key, self.args[key].copy())
++                    else:
++                        Magics.set1i(key, self.args[key].copy())
++                elif (type == 'float64' or type == 'float32'):
++                    if dim == 2:
++                        Magics.set2r(key, self.args[key].copy())
++                    else:
++                        Magics.set1r(key, self.args[key].copy())
++                else:
++                    print("type???->", key)
++
++            else:
++                self.args[key].execute(key)
++
++        if self.action is not None:
++            if self.action != Magics.new_page:
++                if self.action == Magics.legend:
++                    Magics.setc("legend", "on")
++                self.action()
++                if self.action != Magics.obs and self.action != Magics.minput:
++                    for key in list(self.args.keys()):
++                        Magics.reset(key)
++            else:
++                self.action("page")
++
  
- 			else:
- 				self.args[key].execute(key)
-@@ -443,26 +444,26 @@ def plot(*args):
+ def make_action(verb, action, html=""):
+-	def f(_m = None,**kw):
+-		args = {}
+-		if _m is not None: 
+-			args.update(_m)
+-		args.update(kw)
+-		return Action(verb, action, html, args)
+-	return f
++    def f(_m=None, **kw):
++        args = {}
++        if _m is not None:
++            args.update(_m)
++        args.update(kw)
++        return Action(verb, action, html, args)
++    return f
+ 
+ mcoast = make_action("mcoast", Magics.coast, "Coastlines")
+ pcoast = make_action("pcoast", Magics.coast)
+@@ -377,7 +397,7 @@ mmapgen = make_action("mmapgen", Magics.
+ pnetcdf = make_action("pnetcdf", Magics.netcdf)
+ mnetcdf = make_action("mnetcdf", Magics.netcdf)
+ odb_geopoints = make_action("odb_geopoints", Magics.odb, "Odbviewer")
+-odb_geovectors = make_action("odb_geovectors", Magics.odb,"Odbviewer" )
++odb_geovectors = make_action("odb_geovectors", Magics.odb, "Odbviewer")
+ odb_xypoints = make_action("odb_xypoints", Magics.odb, "Odbviewer")
+ odb_xyvectors = make_action("odb_xyvectors", Magics.odb, "Odbviewer")
+ pmap = make_action("pmap", None, "Subpage")
+@@ -418,75 +438,82 @@ mtephi = make_action("mtephi", Magics.te
+ mmetgraph = make_action("mmetgraph", Magics.mmetgraph)
+ mmetbufr = make_action("mmetbufr", Magics.mmetbufr)
+ 
++
+ def examine(*args):
+-	for n in args:
+-		try :
+-			n.inspect()
+-		except:
+-			break
++    for n in args:
++        try:
++            n.inspect()
++        except:
++            break
+ 
+ 
+ def plot(*args):
+-	Magics.init()
+-	for n in args:
+-		if isinstance(n, list):
+-			for nn in n:
+-				nn.execute()
+-		else:
+-				n.execute()
+-	
+-	#Collect the drivers!
+-	Magics.finalize()
+-	for f in context.tmp:
+-		if os.path.exists(f):
+-			os.remove(f)
++    Magics.init()
++    for n in args:
++        if isinstance(n, list):
++            for nn in n:
++                nn.execute()
++        else:
++                n.execute()
++
++    # Collect the drivers!
++    Magics.finalize()
++    for f in context.tmp:
++        if os.path.exists(f):
++            os.remove(f)
  
  
  def tofortran(file, *args):
@@ -746,15 +1343,16 @@ Index: magics++-2.28.0/python/Magics/macro.py
 -	print >>f, "\tprogram magics\n"
 -	print >>f, "\tcall popen\n"
 -	for n in args:
-+	with open(file+".f90",'w') as f:
-+	    print ("\tprogram magics\n", file=f)
-+	    print ("\tcall popen\n", file=f)
-+	    for n in args:
- 		n.tofortran(f)
+-		n.tofortran(f)
 -	print >>f, "\tcall pclose\n"
 -	print >>f, "\tend"
-+	    print  ("\tcall pclose\n", file=f)
-+	    print  ("\tend", file=f)
++    f = open(file+".f90", 'w')
++    print("\tprogram magics\n", file=f)
++    print("\tcall popen\n", file=f)
++    for n in args:
++        n.tofortran(f)
++    print("\tcall pclose\n", file=f)
++    print("\tend", file=f)
  
  
  def tohtml(file, *args):
@@ -763,44 +1361,79 @@ Index: magics++-2.28.0/python/Magics/macro.py
 -	for n in args:
 -		n.tohtml(f)
 -	print >>f, "</html>"
-+	with open(file+".html",'w') as f:
-+	    print ("<html>", file=f)
-+	    for n in args:
-+	        n.tohtml(f)
-+	    print ("</html>", file=f)
++    f = open(file+".html", 'w')
++    print("<html>", file=f)
++    for n in args:
++        n.tohtml(f)
++    print("</html>", file=f)
++
  
  def tomv4(file, *args):
 -	f = open(file+".mv4",'w')
 -	for n in args:
 -		n.tomv4(f)
-+        with open(file+".mv4",'w') as f:
-+	    for n in args:
-+	        n.tomv4(f)
- 
- class  odb_filter(object):
- 	def __init__(self, _m = None,**kw):
-@@ -476,17 +477,17 @@ class  odb_filter(object):
- 		odb = "%s.odb" % file 
- 		context.tmp.append(odb)
- 		cmd = "odbsql -q \"" + self.args["query"] + "\" -i " + self.args["path"] + " -f newodb -o " + odb
+-
+-class  odb_filter(object):
+-	def __init__(self, _m = None,**kw):
+-		args = {}
+-		self.verb = "odbfilter"
+-		if _m is not None:
+-			args.update(_m)
+-		self.args = args
+-	def execute(self, key):
+-		file = "data%d" % numpy.random.randint(1,1000)
+-		odb = "%s.odb" % file 
+-		context.tmp.append(odb)
+-		cmd = "odbsql -q \"" + self.args["query"] + "\" -i " + self.args["path"] + " -f newodb -o " + odb
 -		print cmd 
-+		print (cmd)
- 		if (os.system(cmd)) :
+-		if (os.system(cmd)) :
 -			print "Error in filtering ODB data... Aborting"
-+			print ("Error in filtering ODB data... Aborting")
- 			os.abort();
- 		Magics.setc('odb_filename', odb)
- 	def inspect(self):
- 		cmd = "odbsql -q \"" + self.args["query"] + "\" -i " + self.args["path"] + " -o data.ascii"
- 		if (os.system(cmd)) :
+-			os.abort();
+-		Magics.setc('odb_filename', odb)
+-	def inspect(self):
+-		cmd = "odbsql -q \"" + self.args["query"] + "\" -i " + self.args["path"] + " -o data.ascii"
+-		if (os.system(cmd)) :
 -			print "Error in filtering ODB data... Aborting"
-+			print ("Error in filtering ODB data... Aborting")
- 			os.abort();
- 		cmd =  os.environ['ODB_REPORTER'] + " %s" % "data.ascii"
- 		if (os.system(cmd)) :
+-			os.abort();
+-		cmd =  os.environ['ODB_REPORTER'] + " %s" % "data.ascii"
+-		if (os.system(cmd)) :
 -			print "Error in viewing ODB data... Aborting"
-+			print ("Error in viewing ODB data... Aborting")
- 			os.abort();
+-			os.abort();
++    f = open(file+".mv4", 'w')
++    for n in args:
++        n.tomv4(f)
++
++
++class odb_filter(object):
++    def __init__(self, _m=None, **kw):
++        args = {}
++        self.verb = "odbfilter"
++        if _m is not None:
++            args.update(_m)
++        self.args = args
++
++    def execute(self, key):
++        file = "data%d" % numpy.random.randint(1, 1000)
++        odb = "%s.odb" % file
++        context.tmp.append(odb)
++        cmd = "odbsql -q \"" + self.args["query"] + "\" -i " + \
++              self.args["path"] + " -f newodb -o " + odb
++        print(cmd)
++        if (os.system(cmd)):
++            print("Error in filtering ODB data... Aborting")
++            os.abort()
++        Magics.setc('odb_filename', odb)
++
++    def inspect(self):
++        cmd = "odbsql -q \"" + self.args["query"] + "\" -i " + \
++              self.args["path"] + " -o data.ascii"
++        if os.system(cmd):
++            print("Error in filtering ODB data... Aborting")
++            os.abort()
++        cmd = os.environ['ODB_REPORTER'] + " %s" % "data.ascii"
++        if os.system(cmd):
++            print("Error in viewing ODB data... Aborting")
++            os.abort()
 Index: magics++-2.28.0/python/Magics/metgram.py
 ===================================================================
 --- magics++-2.28.0.orig/python/Magics/metgram.py
@@ -810,15 +1443,421 @@ Index: magics++-2.28.0/python/Magics/metgram.py
  import simplejson
  import tempfile
  import os
-@@ -309,7 +310,7 @@ def metgram(*args):
- 
- 	error = os.system(cmd)
- 	if (error != 0):
+@@ -21,10 +22,10 @@ magics["drivers"] = drivers
+ 
+ definition = []
+ definition.append( {
+-	"id" : "haxis",
+-	"class" : "horizontal_axis",
+-	"axis_type" : "date",
+-	"axis_tick_label": "off",
++    "id" : "haxis",
++    "class" : "horizontal_axis",
++    "axis_type" : "date",
++    "axis_tick_label": "off",
+     "axis_tick_colour": "kelly_green" ,
+     "axis_line_colour":"kelly_green" ,
+     "axis_grid":"on",
+@@ -33,7 +34,7 @@ definition.append( {
+ })
+ 
+ definition.append({
+-	"class" : "horizontal_axis",
++    "class" : "horizontal_axis",
+     "id" : "haxis_last",
+     "axis_type" : "date",
+     "axis_tick_label": "on",
+@@ -56,9 +57,9 @@ definition.append({
+ 
+ 
+ definition.append({
+-	"class": "vertical_axis",
+-	"id" : "vaxis",
+-	"axis_line":"on", 
++    "class": "vertical_axis",
++    "id" : "vaxis",
++    "axis_line":"on", 
+     "axis_grid":"on", 
+     "axis_line_colour":"kelly_green" ,
+     "axis_tick_label_colour":"kelly_green",
+@@ -72,37 +73,37 @@ pages = []
+ 
+ header = {  "height" : "12%" }
+ def page():
+-	page = { "height" : "15%",
+-	"map" : {
+-		"cartesian":
++    page = { "height" : "15%",
++    "map" : {
++        "cartesian":
+         {
+           "x_date": { "automatic":"on" },
+           "y_regular": { "automatic":"on" }
+         },
+-		"text" : {
+-			"left": "0%",
+-			"height": "10%",
+-			"bottom": "90%",
+-			"text_justification": "left",
+-			"text_font_size": "0.4",
+-			"text_font_style": "bold",
+-			"text_font": "sansserif",
+-			"text_colour": "navy",
+-			"text_border": "off"
+-		},
+-		"horizontal_axis": { "use_id" : "haxis" },
+-		"vertical_axis": { "use_id" : "vaxis" }
++        "text" : {
++            "left": "0%",
++            "height": "10%",
++            "bottom": "90%",
++            "text_justification": "left",
++            "text_font_size": "0.4",
++            "text_font_style": "bold",
++            "text_font": "sansserif",
++            "text_colour": "navy",
++            "text_border": "off"
++        },
++        "horizontal_axis": { "use_id" : "haxis" },
++        "vertical_axis": { "use_id" : "vaxis" }
+ 
+-		
+-	}
++        
++    }
+ 
+-	}
+-	return page
++    }
++    return page
+ 
+ class humidity(object):
+-	
+-	def execute(self):
+-		humi =  {
++    
++    def execute(self):
++        humi =  {
+             "epsbufr":
+             {
+                 "epsbufr_parameter_descriptor":"13003",
+@@ -112,43 +113,43 @@ class humidity(object):
+             "metgraph": { "curve": { } }
+         }
+ 
+-		map = page()
+-		humi["epsbufr"]["epsbufr_information"] = magics["info"]
+-		magics["info"] = "off"
+-		map["map"]["cartesian"] = {
++        map = page()
++        humi["epsbufr"]["epsbufr_information"] = magics["info"]
++        magics["info"] = "off"
++        map["map"]["cartesian"] = {
+           "x_date": { "automatic":"on" },
+           "y_regular": { "y_min":"0", "y_max":"100" }
+-		  }
+-		map["map"]["plot"] = humi
+-		magics["page"].append(map)
+-		return map
++          }
++        map["map"]["plot"] = humi
++        magics["page"].append(map)
++        return map
+ 
+ class msl(object):
+-	
+-	def execute(self):
+-		msl =  {
++    
++    def execute(self):
++        msl =  {
+             "epsbufr":
+             {
+                 "epsbufr_parameter_descriptor":"10051",
+                 "epsbufr_parameter_title":"MSL Pressure (hPa)",
+-				"epsbufr_parameter_scaling_factor": "0.01",
++                "epsbufr_parameter_scaling_factor": "0.01",
+                 "use_id":"station"
+             },
+             "metgraph": { "curve": { } }
+         }
+ 
+-		map = page()
+-		msl["epsbufr"]["epsbufr_information"] = magics["info"]
+-		magics["info"] = "off"
+-		map["map"]["plot"] = msl
+-		magics["page"].append(map)
+-		return map
++        map = page()
++        msl["epsbufr"]["epsbufr_information"] = magics["info"]
++        magics["info"] = "off"
++        map["map"]["plot"] = msl
++        magics["page"].append(map)
++        return map
+ 
+ 
+ class cloud(object):
+-	
+-	def execute(self):
+-		cloud =  {
++    
++    def execute(self):
++        cloud =  {
+             "epsbufr":
+             {
+                 "epsbufr_parameter_descriptor":"20010",
+@@ -158,21 +159,21 @@ class cloud(object):
+             "metgraph": { "bar": { } }
+         }
+ 
+-		map = page()
+-		cloud["epsbufr"]["epsbufr_information"] = magics["info"]
+-		magics["info"] = "off"
+-		map["map"]["cartesian"] = {
++        map = page()
++        cloud["epsbufr"]["epsbufr_information"] = magics["info"]
++        magics["info"] = "off"
++        map["map"]["cartesian"] = {
+           "x_date": { "automatic":"on" },
+           "y_regular": { "y_min":"0", "y_max":"100" }
+-		  }
+-		map["map"]["plot"] = cloud
+-		magics["page"].append(map)
+-		return map
++          }
++        map["map"]["plot"] = cloud
++        magics["page"].append(map)
++        return map
+ 
+ class precip(object):
+-	
+-	def execute(self):
+-		precip =  {
++    
++    def execute(self):
++        precip =  {
+             "epsbufr":
+             {
+                 "epsbufr_parameter_descriptor":"13011",
+@@ -182,17 +183,17 @@ class precip(object):
+             },
+             "metgraph": { "bar": { } }
+         }
+-		precip["epsbufr"]["epsbufr_information"] = magics["info"]
+-		magics["info"] = "off"
+-		map = page()
+-		map["map"]["plot"] = precip
+-		magics["page"].append(map)
+-		return map
++        precip["epsbufr"]["epsbufr_information"] = magics["info"]
++        magics["info"] = "off"
++        map = page()
++        map["map"]["plot"] = precip
++        magics["page"].append(map)
++        return map
+ 
+ class wind(object):
+-	
+-	def execute(self):
+-		wind =  {
++    
++    def execute(self):
++        wind =  {
+             "epsbufr":
+             {
+                 "epsbufr_parameter_descriptor":"11003",
+@@ -202,116 +203,116 @@ class wind(object):
+             },
+             "metgraph": { "flags": { } }
+         }
+-		wind["epsbufr"]["epsbufr_information"] = magics["info"]
+-		magics["info"] = "off"
+-		map = page()
+-		map["map"]["plot"] = wind
+-		map["height"] = "10%"
+-		map["map"]["height"] = "80%"
+-		map["map"]["text"]["bottom"] = "70%"
+-		map["map"]["vertical_axis"]["axis_tick_label"] = "off"
+-		map["map"]["vertical_axis"]["axis_grid"] = "off"
+-		map["map"]["vertical_axis"]["axis_tick"] = "off"
+-		map["map"]["cartesian"] = {
++        wind["epsbufr"]["epsbufr_information"] = magics["info"]
++        magics["info"] = "off"
++        map = page()
++        map["map"]["plot"] = wind
++        map["height"] = "10%"
++        map["map"]["height"] = "80%"
++        map["map"]["text"]["bottom"] = "70%"
++        map["map"]["vertical_axis"]["axis_tick_label"] = "off"
++        map["map"]["vertical_axis"]["axis_grid"] = "off"
++        map["map"]["vertical_axis"]["axis_tick"] = "off"
++        map["map"]["cartesian"] = {
+           "x_date": { "automatic":"on" },
+           "y_regular": { "y_min":"-1", "y_max":"1" }
+-		}
+-		magics["page"].append(map)
+-		return map
++        }
++        magics["page"].append(map)
++        return map
+ 
+ class tempe(object):
+-	
+-	def execute(self):
+-		t850 =  {
++    
++    def execute(self):
++        t850 =  {
+             "epsbufr":
+             {
+                 "epsbufr_parameter_descriptor":"12001",
+                 "epsbufr_parameter_title":"Temperature (C)",
+-				"epsbufr_parameter_offset_factor": "-273.15",
++                "epsbufr_parameter_offset_factor": "-273.15",
+                 "use_id":"station"
+             },
+             "metgraph": { 
+-				"metgram_plot_style":"curve",
+-				"metgram_curve_colour":"blue"
+-				}
++                "metgram_plot_style":"curve",
++                "metgram_curve_colour":"blue"
++                }
+         }
+-		t850["epsbufr"]["epsbufr_information"] = magics["info"]
+-		tempe =  {
++        t850["epsbufr"]["epsbufr_information"] = magics["info"]
++        tempe =  {
+             "epsbufr":
+             {
+                 "epsbufr_parameter_descriptor":"12004",
+                 "epsbufr_short_title":"off",
+-				"epsbufr_information":"off",
+-				"epsbufr_parameter_offset_factor": "-273.15",
++                "epsbufr_information":"off",
++                "epsbufr_parameter_offset_factor": "-273.15",
+                 "use_id":"station"
+             },
+             "metgraph": { 
+-				"metgram_plot_style":"curve",
+-				"metgram_curve_colour":"red"
+-				}
++                "metgram_plot_style":"curve",
++                "metgram_curve_colour":"red"
++                }
+         }
+-		t850["epsbufr"]["epsbufr_information"] = magics["info"]
+-		magics["info"] = "off"
+-		map = page()
+-		map["map"]["plot"] = [ t850, tempe]
+-		magics["page"].append(map)
+-		return map
++        t850["epsbufr"]["epsbufr_information"] = magics["info"]
++        magics["info"] = "off"
++        map = page()
++        map["map"]["plot"] = [ t850, tempe]
++        magics["page"].append(map)
++        return map
+ 
+ 
+ 
+ 
+ 
+ class station(object):
+-	def __init__(self, args):	
+-		self.definition = args
+-		self.definition["id"]= "station"
+-		self.definition["class"]= "epsbufr"
+-	def execute(self):
+-		magics["definition"].append(self.definition)
+-		return page()
++    def __init__(self, args):    
++        self.definition = args
++        self.definition["id"]= "station"
++        self.definition["class"]= "epsbufr"
++    def execute(self):
++        magics["definition"].append(self.definition)
++        return page()
+ 
+-	
++    
+ class ps(object):
+-	def __init__(self, args):	
+-		self.definition = args
+-		self.definition["format"]= "ps"
+-	def execute(self):
+-		if (magics["drivers"] == None) :
+-			magics["drivers"]=[]
+-		magics["drivers"].append(self.definition)
+-		return page()
++    def __init__(self, args):    
++        self.definition = args
++        self.definition["format"]= "ps"
++    def execute(self):
++        if (magics["drivers"] == None) :
++            magics["drivers"]=[]
++        magics["drivers"].append(self.definition)
++        return page()
+ 
+-	
++    
+ 
+ 
+ 
+ 
+ def metgram(*args):
+ 
+-	magics["page"].append(header)
+-	nb = len(args)
+-	i = 0
+-	haxis="haxis"
+-	for n in args:
+-		map = n.execute()
+-		i += 1
+-		if (i == nb) :
+-			haxis="haxis_last"
+-		map["map"]["horizontal_axis"]["use_id"] = haxis
+-		
+-			
+-	s = simplejson.dumps(magics, indent=4 * ' ')
+-	f = tempfile.NamedTemporaryFile()
+-	f.write(s)
+-	f.flush()
+-
+-	cmd = "magjson %s" % (f.name)
+-
+-	error = os.system(cmd)
+-	if (error != 0):
 -		print "Error found"
-+		print ("Error found")
- 	f.close
- 	
+-	f.close
+-	
++    magics["page"].append(header)
++    nb = len(args)
++    i = 0
++    haxis="haxis"
++    for n in args:
++        map = n.execute()
++        i += 1
++        if (i == nb) :
++            haxis="haxis_last"
++        map["map"]["horizontal_axis"]["use_id"] = haxis
++        
++            
++    s = simplejson.dumps(magics, indent=4 * ' ')
++    f = tempfile.NamedTemporaryFile()
++    f.write(s)
++    f.flush()
++
++    cmd = "magjson %s" % (f.name)
++
++    error = os.system(cmd)
++    if (error != 0):
++        print ("Error found")
++    f.close
++
  
+ cloud = cloud()
+ humidity = humidity()
 Index: magics++-2.28.0/python/Magics/CMakeLists.txt
 ===================================================================
 --- magics++-2.28.0.orig/python/Magics/CMakeLists.txt

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/magics.git



More information about the debian-science-commits mailing list