As in the examples above, p is still our source Product. We recommend to completely set up your target product in your script before computation starts. The methods readPixels() and writePixels() help you to retrieve the necessary for the computation and save the result. Using an implemented Operator might not be enough in cases where you aim to implement your own computation. Option B: Process a product using custom data computations in Python As said, operators can be executed from the command-line, or invoked from the SNAP Desktop GUI, and be used as nodes in processing XML graphs.A more comprehensive guideline how to set up such plugins can be found at What to consider when writing an Operator in Python. In this way, Python can be used to extend SNAP by new raster data processor plugins, i.e. GPF.writeProduct(target_product, File(), write_format, incremental, pm) Instead of the NULL progress monitor, you can use a different monitor if you like to receive progress messages on the command line. GPF.writeProduct(target_product, File(), write_format, incremental, ProgressMonitor.NULL) Incremental = false # most writer don't support the incremental writing mode (update exsiting file), except BEAM-DIMAP. # Alternative solution: Computations are faster when using GPF to write the product instead of ProductIO: ProductIO.writeProduct(target_product, , write_format) Write_format = 'BEAM-DIMAP' # in this case write as BEAM-DIMAP Target_product = GPF.createProduct(operator_name, parameters, p) The parameters must be named exactly with the String parameter name provided in GPT.įrom esa_snappy import ProductIO # package to be imported is now esa_snappy instead of snappy This parameter is a Java Hashmap, an object that is equivalent to a Python dictionary. In snappy, we provide the parameters through the second parameter of GPF.createProduct(). If you have added GPT to your environment variables, you may call GPT from cmd in order to check out the available Operators, their description and parameters. Its first parameter is a String denoting the name of the Operator as denoted in the Engine and available via GPT. SNAP Operators are available in snappy via GPF.createProduct(). Option A: Process a product using a SNAP Engine Operator and write the target product Option B is suited when you aim at doing custom computations for which you need to read data into Python numpy arrays.īoth options can, of course, occur in one workflow. Option A is suited when you aim at using only SNAP Engine Operators. Snappy generally offers to ways how to process data: You need to use a standard Python (CPython) interpreter installed on your computer (SNAP does not include a CPython interpreter.) The supported versions are Python 2.7, 3.3 to 3.10 64-bit (Linux + Darwin) and both 32-bit and 64-bit (Windows) as well as Anaconda distributions. With the standard Python approach extension of SNAP is currently limited to raster data processor ( Operator) plugins.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |