Skip to content

Dewberry/v2r

Repository files navigation

v2r

Vector to Raster Interpolation Routines

Features

v2r contains two algorithms with an associated testing suite.

  • Inverse Distance Weighting (IDW)
  • Cleaner

IDW

idw-sample
The interpolation becomes more drastic as p increases.

Equation

$z_p= \frac{\displaystyle\sum_{i=1}^{n} (\frac {z_i}{d_i^p}) } {\displaystyle\sum_{i=1}^{n} (\frac {1}{d_i^p})}$

Read from txt file
./v2r idw -f [FILEPATH]

Read from geopackage
./v2r idw -f [FILEPATH] -g --layer [LAYERNAME] --field [FIELDNAME]

Default usage for one exponent
./v2r idw -f [FILEPATH] -g --layer [LAYERNAME] --field [FIELDNAME] --es [EXPONENT]

Usage for range of exponents
./v2r idw -f [FILEPATH] -g --layer [LAYERNAME] --field [FIELDNAME] --es [START] --ee [END] --ei [INCREMENT]

Flags

Shorthand Full Name Type Default Description
-c --concurrent bool false Run concurrently?
--cx int 200 Set chunk size in x-direction
--cy int 200 Set chunk size in y-direction
--ee float Set end for exponent (exclusive)
--ei float 1.5 Set exponential increment for calculations between start and end
--epsg int 2284 Set EPSG
--es float 0.5 Set start for exponent (inclusive)
--excel bool false Perform an additional write to excel spreadsheet?
--field string Set name of field in geopackage file
-f --file string required File to run
-g --gpkg bool false Read from gpkg (true) or txt file (false)?
--layer string Set name of layer in geopackage file
--outPath string data/idw Set outfile directory
--sx float 100.0 Set step size in x-direction
--sy float 100.0 Set step size in y-direction

Notes

  • txt file input requires special formatting (example idw_in.txt)
  • cx, cy only used if --concurrent=true
  • invalid chunk sizes are converted to 1/4 of respective direction (~16 subprocesses)
  • epsg only used if --gpkg=false
  • field, layer required if --gpkg=true
  • not recommended to run ascii or excel prints for large datasets

Cleaner

cleaner_before_after

This program cleans islands (dry spots) and voids (wet spots) that do not meet the tolerance thresholds.

Usage
./v2r clean -f [FILEPATH]

Flags

Shorthand Full Name Type Default Description
-a --adjacent int 8 Set adjacency type to include ordinal directions [4 | 8]
-c --concurrent bool false Run concurrently?
--cx int 2560 Set chunk size in x-direction
--cy int 2560 Set chunk size in y-direction
-f --file string required File to run
--ti float 40,000.0 Set tolerance level for islands (sq. footage)
--tv float 22,500.0 Set tolerance level for voids (sq. footage)

Notes

  • monitor memory usage (process can use up to 80% of free memory)
  • cx, cy only used if --concurrent=true
  • cx, cy number of columns, rows to partition file into for subprocess calculations
  • invalid chunk sizes are converted to 1/4 of respective direction (~16 subprocesses)

Testing Suite

Usage
go test ./...

Run Specific Test
go test ./features/idw

Test Locations

  • features/idw
    • subtest name: "{ Serial | Conc }_step{ 1-1 | 2-2 }"
  • features/cleaner
    • subtest name: "{ Serial | Conc }_T{ 4 | 9 }_A{ 4 | 8 }"
    • "T" is for tolerance island threshold
    • "A" is for adjacency type
  • tools/processing
    • subtest name: "{ data | proj | xInfo | yInfo }"
    • tests geopackage reader

Notes

  • outputs ascii files to compare against correct outputs

Logging

By default, logs are sent to Stdout at the INFO level.

Flags

Shorthand Full Name Type Default Description
-d --debug bool false Set logging level to DEBUG
-e --error bool false Set logging level to ERROR
-l --log bool false Log outputs to separate file

Notes

  • output logs written to logs/
  • sample log filename: 2022-24-06_22:06:25.txt
  • if -d or -e are not passed, level=INFO used

About

Vector to Raster interpolation routines

Resources

License

Stars

Watchers

Forks

Packages

No packages published