Project

General

Profile

BASH example (by MoviePlotter)

The python plugin for the MoviePlotter (movieplotter.py):

import os

from evaluation_system.api import plugin, parameters

class MoviePlotter(plugin.PluginAbstract):
    tool_developer = {'name':'Christopher Kadow', 'email':'christopher.kadow@met.fu-berlin.de'}
    __short_description__ = "Plots 2D lon/lat movies in GIF format" 
    __version__ = (0,0,1)
    __parameters__ = parameters.ParameterDictionary(
                                parameters.File(name='input', mandatory=True, help='The NetCDF file to be plotted'), 
                                parameters.Directory(name='outputdir', default='$USER_OUTPUT_DIR', mandatory=True, help='The default output directory of the MiKlip Evaluation System'))
                                          # SHORTENED OPTIONS FOR BETTER OVERVIEW

    def runTool(self, config_dict=None):
        input = config_dict['input']
        outputdir = config_dict['outputdir']

        result= self.call('%s/movie_plotter.sh %s %s' % (self.getClassBaseDir(),input,outputdir))
        print result[0]

The BASH script (movie_plotter.sh) which is called by the framework through the plugin (movieplotter.py)

#!/bin/bash
#set -x                          # UNSET HASHMARK FOR DEBUGGING 
# MOVIE PLOTTER (GIF-Format)
# this application plots 2D maps along the time axes in a file with the
# structure (TIME/LAT/LON, e.g. surface variables like tas,uas,tos, etc.). 
# Therefore every variable in a file gets a movie in a GIF format.
# Just for NetCDF Format!

#######################
# CONFIGURATION 

# LOAD FROM PYTHON
INPUT1=$1                        # GET INPUT AND OUTPUTDIR FROM PYTHON FRAMEWORK
OUTPUTDIR=$2

########################
# MAKE DIRECTORY AND SET CACHE # NOT NECESSARY ANYMORE, DONE BY THE FRANEWORK!
#CACHE=$OUTPUTDIR/.cache
#mkdir -p $OUTPUTDIR 
#mkdir -p $CACHE

########################
# LOAD MODULES
module purge                  # JUST TO MAKE SURE NOTHING IS LOADED
module load ncl
module load cdo

################
# MAIN PROGRAM
###############

# ... SHORTNED FOR BETTER OVERVIEW, NOW THE MAIN PART BEGINS AND CONFIGURATION IS FINISHED

For detailed informations on the tool and its linkage, check out the the GIT repository
/work/bmx828/miklip-ces/misc4freva/repos4freva/