-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eacb579
commit fc053b0
Showing
9 changed files
with
119 additions
and
9 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
library(data.table) | ||
library(lattice) | ||
library(latticeExtra) | ||
library(hexbin) | ||
library(tactile) | ||
|
||
x <- fread(file = 'mu-polygon-complexity.txt.gz', header = FALSE, showProgress = TRUE, stringsAsFactors = FALSE, verbose = TRUE) | ||
|
||
head(x) | ||
names(x) <- c('areasymbol', 'ogc_fid', 'mukey', 'fd', "log_sq_m", "n_pts", "invesintens", "coryear", "projectscale") | ||
|
||
|
||
## TODO: develop better filters for figures | ||
## -> what are the extreme values all about? | ||
## -> very small polygons, very large FD, negative FD ! | ||
## -> consider filtering on vertex count | ||
summary(x) | ||
|
||
|
||
## flag wacky polygons | ||
|
||
# | ||
|
||
|
||
## save links back to source data | ||
|
||
|
||
## export as points / polygons / links | ||
|
||
|
||
|
||
|
||
.fy <- '2024' | ||
|
||
|
||
|
||
# figure elements and style | ||
.title <- sprintf('FY%s SSURGO', .fy) | ||
.cp <- hcl.colors(100, 'zissou1') | ||
.cpf <- colorRampPalette(.cp) | ||
|
||
## TODO: convert area to acres | ||
|
||
options(scipen = 20) | ||
|
||
p.1 <- hexbinplot( | ||
fd ~ n_pts, | ||
data = x, | ||
xbins = 50, | ||
main = .title, | ||
xlab = 'Polygon Vertex Count', | ||
ylab = 'Fractal Dimension', | ||
trans = log, | ||
inv = exp, | ||
asp = 1, | ||
colramp = .cpf, | ||
type = 'g', | ||
subset = log_sq_m > 0 & fd < 2, | ||
scales = list(x = list(log = 10)), | ||
xscale.components = xscale.components.log10ticks, | ||
colorkey = FALSE, | ||
par.settings = tactile.theme() | ||
) | ||
|
||
p.2 <- hexbinplot( | ||
fd ~ log_sq_m, | ||
data = x, | ||
xbins = 50, | ||
main = .title, | ||
xlab = 'Log10 Polygon Area (sq.m)', | ||
ylab = 'Fractal Dimension', | ||
trans = log, | ||
inv = exp, | ||
asp = 1, | ||
colramp = .cpf, | ||
type = 'g', | ||
subset = log_sq_m > 0 & fd < 2, | ||
colorkey = FALSE, | ||
par.settings = tactile.theme() | ||
) | ||
|
||
p.3 <- hexbinplot( | ||
log_sq_m ~ n_pts, | ||
data = x, | ||
xbins = 50, | ||
main = .title, | ||
xlab = 'Polygon Vertex Count', | ||
ylab = 'Log10 Polygon Area (sq.m)', | ||
trans = log, | ||
inv = exp, | ||
asp = 1, | ||
colramp = .cpf, | ||
type = 'g', | ||
subset = log_sq_m > 0 & fd < 2, | ||
scales = list(x = list(log = 10)), | ||
xscale.components = xscale.components.log10ticks, | ||
colorkey = FALSE, | ||
par.settings = tactile.theme() | ||
) | ||
|
||
.file <- sprintf("FD-summary-FY%s-full.png", .fy) | ||
ragg::agg_png(file = .file, width = 1250, height = 500, scaling = 1.5) | ||
|
||
print(p.3, split = c(1, 1, 3, 1), more = TRUE) | ||
print(p.1, split = c(2, 1, 3, 1), more = TRUE) | ||
print(p.2, split = c(3, 1, 3, 1), more = FALSE) | ||
|
||
dev.off() |