CoastColour BEAM Workshop Lisbon, October 21, 2011
1. Use BEAM’s command-line tools o from a command-line shell o from shell scripts o from Python, IDL, MATLAB,... using dedicated system 2. Use the BEAM Java API to call BEAM functions o from your Java program o from your Phython program Sept. 27, 2011WaterRadiance, Progress Meeting 6, 2 Options
Have a look into the ${BEAM-HOME}/bin directory gpt –Used to execute various “BEAM operators” and chains of operators. pconvert – Used to convert product files into other data and images formats (will become a gpt opertaor) binning meris-smac – Envisat MERIS smile correction meris-cloud – Envisat MERIS cloud screening flhmci – Envisat MERIS/AATSR FLH/MCI processors aatsr-sst – ATSR/AATSR SST processor mosaic – deprecated, use gpt Reproject mapproj – deprecated, use gpt Mosaic Sept. 27, 2011WaterRadiance, Progress Meeting 6, 3 BEAM Command-Line Tools
Most important BEAM batch-mode tool Other command-line tools will become BEAM operators in the future Usage gpt | [options] [...] Which operators are available? gpt –h Note that list of operators may vary depending on the installed BEAM plug-ins Sept. 27, 2011WaterRadiance, Progress Meeting 6, 4 BEAM gpt
Refer to gpt documentation in BEAM VISAT help Operator index lists only standard operators Sept. 27, 2011WaterRadiance, Progress Meeting 6, 5 BEAM gpt Operator Index
Many of the BEAM gpt operators and command- line tools have a counterpart in the VISAT tools menu You can save a parameter file from an operator’s GUI in VISAT and use it with BEAM gpt on the command-line Sept. 27, 2011WaterRadiance, Progress Meeting 6, 6 BEAM gpt Parameterisation
input-path='~/eodata/MER_RR__1P.N1' gpt.sh Reproject -Pcrs=AUTO: f NetCDF $input-path Sept. 27, 2011WaterRadiance, Progress Meeting 6, 7 Calling BEAM gpt from Shell Scripts
Sept. 27, 2011WaterRadiance, Progress Meeting 6, 8 Calling BEAM gpt from Python import subprocess gpt = '~/software/beam-4.9/bin/gpt.sh' operator = 'Reproject' parameters = '-Pcrs=AUTO: f NetCDF' input_path = '~/eodata/MER_RR__1P.N1' process = subprocess.Popen(gpt + ' ' + operator \ + ' ' + parameters + ' '+ input_path,\ shell=True, \ bufsize=1,\ stdout=subprocess.PIPE, \ stderr=subprocess.STDOUT) trace = open('gpt.stdout', 'w') for line in process.stdout: trace.write(line) trace.flush() trace.close() process.stdout.close() code = process.wait()
Advantages: no intermediate files written, no I/O overhead reusability of processing chains simple and comprehensive operator configuration reusability of operator configurations Usage example gpt iop-graph.xml Sept. 27, 2011WaterRadiance, Progress Meeting 6, 9 Processing chains: Using gpt Graphs
Single operator = single node: Sept. 27, 2011WaterRadiance, Progress Meeting 6, 10 BEAM gpt Graph XML Example 1
Two operator chain: (1) IOP, (2) subset Sept. 27, 2011WaterRadiance, Progress Meeting 6, 11 BEAM gpt Graph XML Example 2
Using gpt gpt –h In BEAM VISAT Help Topics: Graph Processing Framework (GPF) Setting up a gpt processing chain: wiki/display/BEAM/Creating+a+GPF+Graph Sept. 27, 2011WaterRadiance, Progress Meeting 6, 12 Getting Help – Command-line
BEAM Java API Documentation: consult.de/beam/doc/apidocs/index.html BEAM home page / downloads BEAM Java Programming: wiki/display/BEAM/Development Sept. 27, 2011WaterRadiance, Progress Meeting 6, 13 Getting Help - Java
Call the BEAM API from C-Python with JPipe: Use the BEAM API with Jython: Sept. 27, 2011WaterRadiance, Progress Meeting 6, 14 Integrating BEAM code in Python