Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanbeaudette committed Jan 30, 2024
1 parent b8b3213 commit eacb579
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
Binary file modified SSA-complexity/FD-summary-FY2024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified SSA-complexity/fractal-dimension-test.csv.gz
Binary file not shown.
24 changes: 21 additions & 3 deletions SSA-complexity/notes.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ library(tactile)
library(terra)
library(soilDB)

## too complex to run interactively

# SDA top 10 offenders
# via Phil Anzel
.sql <- "SELECT TOP 10 MAX (m.vertex_count) AS max_vertex_count, m.mukey
FROM (SELECT SUM(mupolygongeo.STNumPoints()) AS vertex_count, mupolygon.mukey
FROM mupolygon
INNER JOIN mapunit ON mapunit.mukey = mupolygon.mukey
INNER JOIN legend ON mapunit.lkey = legend.lkey AND legend.areasymbol <> 'US'
GROUP BY mupolygon.mukey) AS m
GROUP BY m.vertex_count, m.mukey
ORDER BY m.vertex_count, m.mukey ;
"
# x <- SDA_query(.sql)



x <- read.csv('fractal-dimension-test.csv.gz')
head(x)
nrow(x)
Expand Down Expand Up @@ -71,13 +88,14 @@ plot(p, add = TRUE, pch = 16, col = 2)
.thresh <- 1.9

# figure elements and style
.title <- sprintf('FY%s SSURGO\n100k Samples', .fy)
.nsamples <- round(nrow(x), -3) / 1000
.title <- sprintf('FY%s SSURGO\n%sk Samples', .fy, .nsamples)
.cp <- hcl.colors(100, 'zissou1')
.cpf <- colorRampPalette(.cp)

## TODO: convert area to acres


options(scipen = 20)

p.1 <- hexbinplot(
fd ~ n_pts,
Expand Down Expand Up @@ -248,6 +266,6 @@ ecdf(x$fd)(1.48329949700171)
ecdf(x$fd)(1.29691553046904)


x[x$fd > 1.9, ]
x[x$fd > 1.6, ]


2 changes: 1 addition & 1 deletion SSA-complexity/ssurgo-polygon-complexity.sql
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ coryear, projectscale
FROM
-- random sampling from a table
-- https://stackoverflow.com/questions/5297396/quick-random-row-selection-in-postgres/32023533
ssurgo.mapunit_poly TABLESAMPLE SYSTEM_ROWS(100000)
ssurgo.mapunit_poly TABLESAMPLE SYSTEM_ROWS(200000)
JOIN ssurgo.mapunit USING (mukey)
-- must make case insensitive
JOIN soilweb.ssurgo_status ON mapunit.areasymbol::citext = ssurgo_status.areasymbol ;
Expand Down

0 comments on commit eacb579

Please sign in to comment.