def _handler(self, request, response): # build esgf search constraints constraints = dict( model=request.inputs['model'][0].data, experiment=request.inputs['experiment'][0].data, time_frequency='mon', cmor_table='Amon', ensemble=request.inputs['ensemble'][0].data, ) # run diag result = runner.diag( 'mydiag', constraints=constraints, start_year=request.inputs['start_year'][0].data, end_year=request.inputs['end_year'][0].data, output_format='pdf') # namelist output response.outputs['namelist'].output_format = FORMATS.TEXT response.outputs['namelist'].file = result['namelist'] # log output response.outputs['log'].output_format = FORMATS.TEXT response.outputs['log'].file = result['logfile'] # find result plot # response.outputs['output'].output_format = FORMATS.PDF response.outputs['output'].file = result['output'] return response
def execute(self): self.show_status("starting", 0) constraints = runner.build_constraints( project="CMIP5", models=self.getInputValues(identifier='model'), variable=self.variable.getValue(), cmor_table=self.cmor_table.getValue(), experiment=self.experiment.getValue(), ensemble=self.ensemble.getValue()) out, namelist, log_file, reference = runner.diag( name="anncycle", credentials=self.credentials.getValue(), constraints=constraints, start_year=self.start_year.getValue(), end_year=self.end_year.getValue(), output_format=self.output_format.getValue(), monitor=self.show_status) self.show_status("done", 100) self.output.setValue(out) self.namelist.setValue(namelist) self.log.setValue(log_file) self.reference.setValue(reference)