Retrieve new code from my old refactor class tree branch
I started to integrate some of the code I added in my abandoned refac class tree branch (began with #37).
It's a big diff since I moved functions from App to otbObject, and reorder some special methods def so they are grouped.
No changes in the exec logic, all test passed with release 8.1.
Changelog :
- Find OTB lib during module init or die
- Raise SystemExit if no applications were found (print message to set `OTB_APPLICATION_PATH`)
- Small enhancements (style and variable names)
- Smaller apps.py (avoid duplicated OTBTF app class def)
- Break backward compat to conform to camel case : `logicalOperation` => `LogicalOperation` | `otbObject` => `OTBObject`
- Operation and Slicer are OTBObject subclasses, see attached class tree
- Keep function def order logical : init, properties, public methods, private methods, special (dunder) methods
- Move more code from App to OTBObject. App should only be used for UI specific functions. All the app init logic is now in OTBObject
- Move App class def to apps.py
- Add `OTBObject.flush` to control the WriteOutput / ExecuteAndWriteOutput logic
- Remove OTBObject's `preserve_dtype` init arg, move it to `write()`
- Make `OTBObject.propagate_dtype()` public
- Add OTBObject functions and properties to ease app settings :
- store all parameters names in `OTBObject.parameters_keys`
- store output param keys in `OTBObject.out_param_keys`
- store output type (raster, vector, file) of each output param in `OTBObject.out_param_types`
- `app.key_input`, `OTBObject.key_input_image`, `OTBObject.key_output_image` to easily find parameter keys (replace old app.output_param)
- thanks to `OTBObject.key_input`, it is now possible to pass most input parameters without key, as we do for `in` or `il` (for example `io.in` or `ingeom` should work)
- Add attributes and functions to ease data exchange with numpy / rasterio :
- store exported numpy arrays in `OTBObject.exports_dict`, thus we can avoid exporting arrays multiple times, ExportImage() is only called once for each key
- add `app.transform` property (see #54)
- Move boilerplate code out of OTBObject because it's way too big (utils and static methods : is_key_list, is_key_image_list, get_out_param_types, parse_pixel_type, etc.). It also allow us to re-use these, no reason to keep them private.
Before :

After:

Fix #37
issue