X
48

Recommendations to configure and use envipyengine on Linux

This article lists some recommendations to configure and run ENVI Tasks or SARscape Tasks using envipyengine on Linux flavors.

Instructions to use envipyengine on Windows can be found in the link below. they need to be executed in a Python prompt:

https://envi-py-engine.readthedocs.io/en/latest/envipyengine_api.html#

 

  • Make sure envipyengine is installed with the version of Python you are using. In this example version 3.10 of Python is used and started using python3 alias
python3 -m pip list  

should output a line including envipyengine.

support@Ubuntu22:~$ python3 -m pip list
Package                Version
---------------------- -------------
[...]
duplicity              0.8.21
envipyengine           1.0.9
  • If not use the command below to install envipyengine:
python3 -m pip install envipyengine 
  • If you are using Visual Studio Code configured with Python extensions, it should detect the envipyengine package and should not underline it.

 

 

  • Start a python prompt using your python alias: pyhton3 in this example
support@Ubuntu22:~$ python3
Python 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
  •  Configure envipyengine engine with envitaskengine using the commands below
>>> import envipyengine
>>> import envipyengine.config
>>> envipyengine.config.set('engine','/usr/local/nv5/envi/bin/envitaskengine')

 

 

  • The Engine needs to be defined with an empty string '', instead of  ‘ENVI’ string:
>>> from envipyengine import Engine
>>> envi_engine = Engine ('')

 

  • The following commands should then execute as expected in Python and output the list of available ENVI tasks as well as the parameters of the GaussianStretchRaster task
>>> print(envi_engine.tasks())
>>> task1=envi_engine.task('GaussianStretchRaster')
>>> print(task1.parameters)

 

Output example for the parameters of GaussianStretchRaster task: 

>>> print(task1.parameters) 
[OrderedDict([('ALLOW_NULL', False), ('URI_PARAM', None), ('name', 'INPUT_RASTER'), ('description', 'Specify a raster on which to apply gaussian stretch.'), ('display_name', 'Input Raster'), ('required', True), ('type', 'ENVIRASTER'), ('direction', 'input')]), OrderedDict([('INCLUSIVE_MAX', True), ('INCLUSIVE_MIN', True), ('name', 'MIN'), ('description', 'Specify the minimum value to be considered, also known as the black point. If the array has one value, it applies to all bands, otherwise it must have the same number of elements as the input raster has bands.'), ('display_name', 'Minimum'), ('required', True), ('min', None), ('max', None), ('type', 'DOUBLE'), ('dimensions', '[*]'), ('direction', 'input')]), OrderedDict([('INCLUSIVE_MAX', True), ('INCLUSIVE_MIN', True), ('name', 'MAX'), ('description', 'Specify the maximum value to be considered, also known as the white point. If the array has one value, it applies to all bands, otherwise it must have the same number of elements as the input raster has bands.'), ('display_name', 'Maximum'), ('required', True), ('min', None), ('max', None), ('type', 'DOUBLE'), ('dimensions', '[*]'), ('direction', 'input')]), OrderedDict([('INCLUSIVE_MAX', True), ('INCLUSIVE_MIN', True), ('name', 'STDDEV'), ('description', 'Specify the standard deviation value for the Gaussian function. If the array has one value, it applies to all bands, otherwise it must have the same number of elements as the input raster has bands.'), ('display_name', 'Standard Deviation'), ('required', False), ('min', None), ('max', None), ('type', 'DOUBLE'), ('dimensions', '[*]'), ('direction', 'input'), ('default_value', [0.3])]), OrderedDict([('INCLUSIVE_MAX', True), ('INCLUSIVE_MIN', True), ('name', 'BRIGHTNESS'), ('description', 'Specify an integer value from 0 to 100, indicating the brightness level to display. If the array has one value, it applies to all bands, otherwise it must have the same number of elements as the input raster has bands.'), ('display_name', 'Brightness'), ('required', False), ('min', 0.0), ('max', 100.0), ('type', 'DOUBLE'), ('dimensions', '[*]'), ('direction', 'input')]), OrderedDict([('name', 'OUTPUT_RASTER_URI'), ('description', 'Specify a string with the fully qualified filename and path to export the associated OUTPUT_RASTER. If you set this property to an asterisk symbol (*), the output raster will be virtual and not written to disk. If you do not specify this property, or set it to an exclamation symbol (!), a temporary file will be created.'), ('display_name', 'Output Raster URI'), ('required', False), ('type', 'ENVIVIRTUALIZABLEURI'), ('direction', 'input'), ('fold_case', True), ('auto_extension', '.dat'), ('is_temporary', True), ('is_directory', False)]), OrderedDict([('ALLOW_NULL', False), ('URI_PARAM', 'OUTPUT_RASTER_URI'), ('name', 'OUTPUT_RASTER'), ('description', 'This is a reference to the output raster of filetype ENVI.'), ('display_name', 'Output Raster'), ('required', True), ('type', 'ENVIRASTER'), ('direction', 'output')])] >>>

 

---------------------------

created by BC on 1/9/2025

reviewed by MM on 1/9/2025