|
|
|
| [:arrow_left: Go to Part 4: Upload processor](upload processor) |
|
|
|
|
| :---------- |
|
|
|
|
|
|
|
|
# A more complex processor
|
|
|
|
|
|
|
|
In this chapter we explain how to process products from the catalogue. The example will be the "water mask" processor which creates a binary land/water mask. For this part we will need to use an Ubuntu console, as explained in the [Interactive Application](ias) tutorial. In the Ubuntu console, open a terminal (applications menu) and copy `/shared/CTEP-TUTORIAL/water_mask.py` in your user Basket. Check that you have execution rights on this file and `chmod +x` if necessary.
|
|
|
|
|
|
|
|
<center><img src="https://gitlab.acri-cwa.fr/coastal-tep/tutorial/raw/master/images/part5/im1.png" width="80%"></center>
|
|
|
|
|
|
|
|
Let's have a look at this file. You may install your favorite editor for this. For instance `apt-get install gedit`, then `gedit water_mask.py &`. The python script can be run directly on the CTEP, if it starts with `#!/bin/python`. Many python libraries are already installed on the CTEP system, contact us if you need something else. Here we use the `sys.argv` command to retrieve the input data.
|
|
|
|
|
|
|
|
<img src="https://gitlab.acri-cwa.fr/coastal-tep/tutorial/raw/master/images/part5/im2.png" width="80%" style="float:center;">
|
|
|
|
|
|
|
|
The script ends with the creation of the water mask in Geotiff format. The CTEP will automatically recognize Geotiff files created by your processor and propose them for visualization. The file shall be created in the `CTEP_OUTPUT_DIR` folder whose value can be retrieved with a `os.getenv` command. The default value `.` ensures that the script will also run normally outside of the CTEP environment.
|
|
|
|
|
|
|
|
<center><img src="https://gitlab.acri-cwa.fr/coastal-tep/tutorial/raw/master/images/part5/screenshot.jpg" ></center>
|
|
|
|
|
|
|
|
We will now upload the processor from within the Ubuntu console. Open a browser in your ubuntu session and log-in again to the CTEP geobrowser. From the Processor Integration page, you can define a new processor. The input product shall have the type "file". This specific type activates the connection with the Input Data clipboard.
|
|
|
|
|
|
|
|
<center><img src="https://gitlab.acri-cwa.fr/coastal-tep/tutorial/raw/master/images/part5/screenshot2.jpg" ></center>
|
|
|
|
|
|
|
|
Once you have defined the inputs, specify the processor command (`water_mask.py`) in the Execution tab. Then upload the tar.gz file with the processor. After integration, the processor is available in the processor list.
|
|
|
|
|
|
|
|
<img src="https://gitlab.acri-cwa.fr/coastal-tep/tutorial/raw/master/images/part5/screenshot-wm.jpg">
|
|
|
|
|
|
|
|
After execution, the new geotiff file can be published on the browser ("menu" icon beside the job result). Remember that you can check the output log by clicking on the info menu ("i" icon).
|
|
|
|
|
|
|
|
<img src="https://gitlab.acri-cwa.fr/coastal-tep/tutorial/raw/master/images/part5/publish_layer.jpg" width="50%" style:"float:left;"><img src="https://gitlab.acri-cwa.fr/coastal-tep/tutorial/raw/master/images/part5/venice_mask.jpg" width="50%" style:"float:right;">
|
|
|
|
|
|
|
|
# Accessing files
|
|
|
|
|
|
|
|
All input files will be placed by the CTEP in the working directory before execution. If needed, the path to this directory can be accessed with the environment variable `CTEP_WORK_DIR`.
|
|
|
|
|
|
|
|
The files of the processor package are installed in `/usr/local/ctep-user-processor/`. Use this path to read configuration files for instance.
|
|
|
|
|
|
|
|
| [:arrow_left: Go to Part 4: Upload and run your own processor](Upload processor) | [Go to Part 6: User Activity Manager :arrow_right:](User Activity manager) |
|
|
|
|
| :------ |-----:| |
|
|
|
\ No newline at end of file |