Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
apps:python:start [2021/11/02 20:02] – [Using Python] enviadmin | apps:python:start [2023/03/12 22:00] – [Make sure all required packages and modules are existing and matching] enviadmin | ||
---|---|---|---|
Line 7: | Line 7: | ||
From the perspecitve of ENVI-met, there are numerous ways we can benefit form the Python developements: | From the perspecitve of ENVI-met, there are numerous ways we can benefit form the Python developements: | ||
- | * Processing, Analysis and Visiulaisation | + | * Processing, Analysis and Visualisation |
* Controlling and scripting the behaviour of ENVI-met applicatons | * Controlling and scripting the behaviour of ENVI-met applicatons | ||
* Extending the data interfaces of applications using Python libraries and packages | * Extending the data interfaces of applications using Python libraries and packages | ||
Line 13: | Line 13: | ||
This page relates to the general aspects of using the Python system in ENVI-met. | This page relates to the general aspects of using the Python system in ENVI-met. | ||
+ | ===== General aspects ====== | ||
- | ===== Using Python ===== | ||
- | ENVI-met ships with a small Python distribution ensuring that minimal requirements and software dependencies are satisfied. However, in almost all cases, you will need to install | + | ==== Using the internal Python distribution ==== |
+ | |||
+ | ENVI-met ships with a small 64Bit Python distribution ensuring that minimal requirements and software dependencies are satisfied. However, in almost all cases, you will need to install | ||
[[wp> | [[wp> | ||
These packages need to be installed into the ENVI-met Python distribution after installing ENVI-met itelf to use most of the scripts related to ENVI-met. | These packages need to be installed into the ENVI-met Python distribution after installing ENVI-met itelf to use most of the scripts related to ENVI-met. | ||
- | The ENVI-met Python distribution is completly | + | The ENVI-met Python distribution is completely |
+ | |||
+ | ENVI-met DataStudio will support you in an automated install of the most required packages for ENVI-met. If DataStudio recognizes that e.g. Pandas is missing, if will prompt you to enter a quick install routine to add the missing modules (Internet access required) | ||
- | The DataStudio will support you in an automated install of the most required packages for ENVI-met. If DataStudio recognizes that e.g. Pandas is missing, if will promt you to enter a quick install routine to add the missing modules (Internet access requird) | ||
==== Using my own Python distribution ==== | ==== Using my own Python distribution ==== | ||
+ | |||
Many users already do have a working Python installation on their computers including all the packages and libraries they need for their daily work. | Many users already do have a working Python installation on their computers including all the packages and libraries they need for their daily work. | ||
There is no need to double a Python distribution. Using the Workspace Manager, you can direct ENVI-met any time to use your personal installed Python distribution instesd of using and manage the embedded ENVI-met Python version. | There is no need to double a Python distribution. Using the Workspace Manager, you can direct ENVI-met any time to use your personal installed Python distribution instesd of using and manage the embedded ENVI-met Python version. | ||
+ | |||
+ | ==== Make sure all required packages and modules are existing and matching ==== | ||
+ | |||
+ | Well, that's not possible. | ||
+ | Any script can use its own set of required modules and libraries and the libs between each other may have dependencies, | ||
+ | This is a issue related to programming in Python (or to programming in general) and it cannot be solved by ENVI-met. | ||
+ | |||
+ | With BETA 3, you can add a list of required special modules in the script header and DataStudio will check, if they exists. If not (-and if selected as option-) DataStudio will automatically launch PIP and tries to install the missing modules and packages. We labelled these modules as //Special Modules// because modules which are not basically a part of Python, but are so basic that they need to exist on any system (such as NumPy or Pandas) will probably not be extra-listed in the Required Modules section. | ||
+ | |||
+ | However, there is no guarantee, that this install will be successful or that ALL of the required special modules have been listed in the header and that their versions will work together. If in doubt, you need to check the script in detail and go back to its sources to find out, what is missing. | ||
+ | |||
+ | |||
+ | |||
+ | ==== Scripting ENVI-met apps in Python ==== | ||
+ | |||
+ | All ENVI-met applications that support an interaction with Python include the **DataStudio** Module ([[apps: | ||
+ | |||
+ | For example, the DataStudio integrated into LEONARDO will allow you to access almost all objects and modules related to the LEONARDO software plus those available in all instances of DataStudio. However, scripts making use of these LEONARDO specific objects can only be run in LEONARDO. | ||
+ | |||
+ | The same applies for example for DataStudio for Monde: These scripts will not run in other DataStudio Versions if they use Monde objects. Therefore the script management of ENVI-met is very strict concerning the usage scope of a script. As a consequence it is (-at the moment-) not possible to create a script that calls e.g. Monde and LEONARDO functionalities at the same time (these scripts would also be hard to mange so most likely we will implement some kind of subroutine calls in the next versions) | ||
+ | |||
+ | In addition, ENVI-met related objects are only available inside the ENVI-met DataStudio biotope. In the future we will also provide standalone packages for accessing fundamental operations such as reading and analysing EDX fies from other Python environments, | ||
+ | |||
+ | =====How to import python scripts (from the website) ===== | ||
+ | |||
+ | Python scripts for ENVI-met are normal Python scripts, but use the ending .enpy in most cases. Only for libraries, the ending .py must be kept in order to work with Python. | ||
+ | |||
+ | ==== Add scripts automatically ==== | ||
+ | |||
+ | * Just double-click the downloaded '' | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | ==== Launch ScriptCatcher manually ==== | ||
+ | |||
+ | Click on the Control icon top left in DataStudio and select "Run ScriptCatcher" | ||
+ | |||
+ | ==== Add scripts manually ==== | ||
+ | |||
+ | If you want to manage several scripts in one go, a direct copy might be the quickest option. | ||
+ | |||
+ | * Download the script | ||
+ | * Switch to your download folder and copy/cut the script | ||
+ | * Navigate to your personal script folder | ||
+ | * Paste the script there | ||
+ | * Reload the script library | ||
+ | * The imported script should now appear in your DataStudio (you might need to click "All Scripts" | ||
+ | |||
+ | Note: If you are not sure where your personal script folder is located, navigate to the Project Manager (Start Headquarter, | ||
+ | |||
+ | |||
+ | |||