Loading [MathJax]/extensions/tex2jax.js
Python script preDataCheck
See also
python.workflows.preDataCheck

Aim of module

Performs a point cloud data check to secure validity and plausibility of input files.

General description

When processing large amounts of point cloud data it can be useful to assess the quality of the data beforehand. PreDataCheck aims to find possibly corrupt files using different approaches, making use of the overview-matrices (pcount and z), generated by opalsInfo.

An indicator for corrupt/faulty point cloud files is the amount of validpixels in the boundingbox of the overview-matrices. The default threshold of which is set to 5% but the user can control this value using the validpixels parameter. Some corrupt files show unrealistic z-values, if the user knows the approximate z-range of the area of interest, they can do so using the zlim parameter. By default it is set to the earthly possible z-limits. In the same way the user can specify an xylim bounding-box for the area in question to check if the points are all within the expected area.

The result of the script are tables, stored in the opalsLog, giving a statistic of the processed files and the result of each of the checks. Furthermore, two matrices of all the point cloud files are generated, for the pcount as well as for the z-values. This is stored in a QGis file together with bounding shape files of all the input files. An example of a QGis result, generated by the processing of two input files can be seen in Figure 1.

Figure 1: From left to right: QGis project layers, bounding shape files, mosaic z-values, mosaic pcount

More details to come

See also
Script documentation

Parameter description

-xylim input 2D limits for x and y)
Type : Floating-point number
Remark : optional
Description: If the user knows the coordinates of the bounding box (x and y limits) roughly containing the area of interest (i.e. a country or a state), it can be provided in the format [ymin,xmin,ymax,xmax], where Y is the abscissa and X the ordinate.
possible inputcomment
s, a, v, e, s, , t, h, e, , a, r, e, a, , o, f, , t, h, e, , f, o, o, t, p, r, i, n, t, , a, s, , a, t, t, r, i, b, u, t, e, , [, i, n, , s, q, ., m, ., ]area
s, a, v, e, s, , t, h, e, , s, e, m, i, m, a, j, o, r, , a, x, i, s, , [, i, n, , m, ]semimajor
s, a, v, e, s, , t, h, e, , s, e, m, i, m, i, n, o, r, , a, x, i, s, , [, i, n, , m, ]semiminor
s, a, v, e, s, , b, o, t, h, , a, x, e, s, , [, i, n, , m, ]axes
s, a, v, e, s, , t, h, e, , a, n, g, l, e, , o, f, , i, n, c, i, d, e, n, c, e, , [, i, n, , r, a, d, ]incidence
s, a, v, e, s, , t, h, e, , i, d, , o, f, , t, h, e, , o, r, i, g, i, n, a, t, i, n, g, , p, o, i, n, tpointid
s, a, v, e, s, , t, h, e, , X, /, Y, /, Z, , c, o, m, p, o, n, e, n, t, s, , o, f, , t, h, e, , b, e, a, m, , v, e, c, t, o, rbeamvector
s, a, v, e, s, , t, h, e, , X, /, Y, /, Z, , c, o, m, p, o, n, e, n, t, s, , o, f, , t, h, e, , n, o, r, m, a, l, , v, e, c, t, o, rnormalvector
-zlim input 2D limits for x and y)
Type : Floating-point number
Remark : optional, default: (-200, 9000)
Description: If the user knows the coordinates of the bounding box (x and y limits) roughly containing the area of interest (i.e. a country or a state), it can be provided in the format [ymin,xmin,ymax,xmax], where Y is the abscissa and X the ordinate.
-validpixels input valid pixel threshold
Type : Floating-point number
Remark : optional, default: 0.05
Description: After a bounding box is created, the share of valid pixels are checked. If they are below the threshold set, the input file is rejected. Values should be between 0 and 1.
-mosaic if True, mosaics are created
Type : Boolean
Remark : optional, default: True
Description: create mosaics
possible inputevaluates to
1, true, yes, Boolean(True), TrueBoolean(True)
0, false, no, Boolean(False), FalseBoolean(False)
-qgisProject path to qgis project file, if one should be written. A QGIS installation is required.
Type : Path
Remark : optional
-enduranceMode Controls, whether or not script keeps running
Type : Boolean
Remark : optional, default: False
Description: If True, script keeps running after encountering an error.
possible inputevaluates to
1, true, yes, Boolean(True), TrueBoolean(True)
0, false, no, Boolean(False), FalseBoolean(False)
Common Package/Script Options
Settings concerning the general options for (package) scripts.
-infile input text file, directory or strip file
Type : Path
Remark : mandatory
Description: As input either the name of an ASCII file (extension .txt) containing the names of the data files (one file per line) or an expression using wildcards to specify the respective data sets are accepted.
-outfile output directory or settings file (.txt)
Type : Path
Remark : optional
Description: Specifies the directory where the final results are stored. If not specified, the results are created in the current working directory.
-tempdir temporary directory
Type : Path
Remark : optional, default: current directory
Description: Specifies the directory where all intermediate results are stored. If not specified, a TEMP subdirectory is created in the current working directory. Additional subdirectories (one per involved module) are created.
-cfg Path to configuration file
Type : Path
Remark : optional, default: $OPALS_ROOT/cfg/preDataCheck.cfg
Description: The name of a configuration file containing all relevant calculation parameters is expected. If not specified, the default cfg files as provided by the OPALS distribution are used.
-projectDir project directory
Type : Path
Remark : optional, default: current directory
Description: The default project directory is the current working directory, but can be easily changed by this parameter. All path parameters, if not specified as absolute paths, are interpreted relative to the project directory.
-skipIfExists skip processing if result already exists
Type : Boolean
Remark : optional, default: True
Description: Skip processing if result already exists. In order to re-run current script it is useful to repeat the processing only if the respective output does not already exist. This allows for incremental processing of large projects.
possible inputevaluates to
1, true, yes, Boolean(True), TrueBoolean(True)
0, false, no, Boolean(False), FalseBoolean(False)
-distribute determine how many local processes should be used
Type : String
Remark : optional
Description: according to the number chosen as the value, independent processes are being started to parallelise (parts of) the program and therefore enhance the runtime.
Logging Options
Settings concerning the verbosity level of logging.
-fileLogLevel Log level in the logfile
Type : LogLevel
Remark : optional, default: info
-screenLogLevel Log level on screen
Type : LogLevel
Remark : optional, default: info
-logger Logger
Type : Logger
Remark : optional
Description: Logger is usually provided by the opals framework.The user may provide their own logger object, but it has to function in the same way as the opals Logger.

Examples

Figure 2 shows an example of a result table of two non corrupt files. The inconsistent header error is raised by opalsInfo if the header information does not correspond with the bounding box that was extracted (also a sign of a corrupt file). The unspecific Error is raised if an error occured that is not covered by the other errors.

Figure 2: Result example

Example 1

In this first example we use a wildcard (*) to use strip11.laz and strip12.laz as input parameters. The z-range for these two point cloud files is known so we can specify it using the zlim parameter. The more diagonal a point cloud strip is, the less validpixels the overview-matrix has. We know that the two files in question are rectangular with the two sides being parallel to the coordinate axes, therefore we can set the validpixels parameter to a higher amount.

preDataCheck -inf strip*.laz -zlim 150 350 -validpixels 0.5

None of the errors were raised, the resulting table in the opalsLog can be seen in Figure 2.

Example 2

In Example 2 we want to purposefully trigger the zlim error, so we set the zlim to [300, 350] which does not cover the z-range of the point clouds.

preDataCheck -inf strip*.laz -zlim 300 350 -validpixels 0.5

Now that at least one error is raised, a second table is shown in the opalsLog, the Detailed Error Log, showing which files raised which specific errors.

Figure 3: Result of Example 2

Example 3

In this third example, we take the same input files, but use opalsTranslate before processing them to turn them into diagonal strips. The bounding shape files of those can be seen in Figure 1. The resulting pointcloud files are non corrupt files, yet due to the diagonal shape of the strips, the validpixel amount is reduced significantly.

opalsTranslate -inFile strip11.laz -filter "region[529569.680 5338750.526 529587.347 5338768.478 529761.168 5338605.485 529739.512 5338589.812]" -outFile strip11_diag.laz
opalsTranslate -inFile strip12.laz -filter "region[529594.680 5338750.526 529587.347 5338793.478 529761.168 5338630.485 529739.512 5338589.812]" -outFile strip12_diag.laz
preDataCheck -inf strip*_diag.laz -zlim 300 350 -validpixels 0.5

As we can see in Figure 4, the threshold for the validpixels is now too high and the script raises an error. The validpixels parameter is to be set with caution.

Figure 4: Result of Example 3
opalsTranslate is the executable file of Module Translate
Definition: ModuleExecutables.hpp:238
@ strip
strip ID of an image (opalsStripAdjust)
@ filter
string to be parsed in construction of DM::IFilter (various modules)