Python Interface to MAPL: Difference between revisions

Line 59: Line 59:


In this example, the '''GEOSgcs''' component is implemented in Python, with its children, components '''ANA''' and '''GCM''', implemented in Fortran.
In this example, the '''GEOSgcs''' component is implemented in Python, with its children, components '''ANA''' and '''GCM''', implemented in Fortran.
Notice that every component should be subclass of '''MAPL_GridComp'''.


  import MAPL
  import MAPL
   
   
  class GridComp(MAPL.GridComp):
  class GridComp(MAPL.GridComp):
     """Implements the GEOSgcs component by subclassing MAPL.GridComp"""
     """
    Implements the GEOSgcs component by subclassing MAPL.GridComp.
    """
   
   
     def SetServices(self):
     def SetServices(self):
Line 87: Line 90:
  #      ------------------------------
  #      ------------------------------
         MAPL.GridComp.__SetServices__(self)
         MAPL.GridComp.__SetServices__(self)
Notice that the standard '''Initialize()''', '''Run()''' and '''Finalize()''' methods are inherited from the base class '''MAPL.GridComp'''.