Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,22 @@ height missing two digits arrives, so it is gated on the band and not on `disput
every excluded roll-height carries the reason that actually fired — no page, rows that
disagree, a row not read are three states, and an earlier draft folded them into one.
Spacing separates readings ~1.6× apart and no closer, so it cannot tell ×10 from ×10.764;
the logbook can. The control roll `bc78065` suggests #54's own factor is ×10 on pre-2000
rolls (fly#71), and half the r ≈ 2 mass is a wrong scale, not a mislabelled lens (fly#72).
Do not change `fly_height_slip_factor()` from this; read `inst/notes/terrain-correction.md`
the logbook can. Half the r ≈ 2 mass is a wrong scale, not a mislabelled lens (fly#72). Read
`inst/notes/terrain-correction.md`

- **#54's slipped frames are ÷10 wherever a logbook reads them, tabled where spacing
agrees, and ÷10.764 stays for the rest** (fly#71) — the same logbooks, read blind against the 1,589, put the crew's height
at the catalogue's divided by 10 on every slipped roll a page covers bar a one-frame typo
(`bc78065`, `bc78078`, `bc79027`, `bc79103`, `bcc00085`), 6.7-7.6% above ÷10.764 on each. So 6
roll-heights (299 frames) ride `flying_height_rolls.csv` at factor **0.1**, and both tables carry a
`tail` column. **`fly_height_slip_factor()` was deliberately not changed**: the six 2003/2005
rolls have no logbook link (the 2003 ones carry measured per-frame heights and fit 10.764 better;
`bcc05001` lands on round feet under ÷10 and is undecided), so they and
three stragglers (1,290 frames) stay on it, each listed in `_excluded.csv` with a reason saying
so. The roll-table gate in `fly_footprint()` is `tab_factor != 1`, never `> 1`: `> 1` silently
handed a 0.1 row back to #54's repair. `bc79027` reads ÷10 but spacing rejects it, because its page
logs 80% overlap against the ~60% window. `bcb98013` frame 52 is a leading-digit typo that no
factor recovers. Neither case moved the rule

## Gotchas

Expand Down
55 changes: 40 additions & 15 deletions R/fly_footprint.R
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,17 @@ fly_dem_coverage_min <- function() 0.95
# Dividing by it puts all 1,589 frames between 0.80 and 1.32 of the height their own scale
# implies. Reading the value as plain feet instead leaves them at 3.0 to 4.7 times it, and
# not one of the 1,589 inside the band.
#
# That the band accepts it does not make it the defect on every roll (fly#71). x10 and
# x10.764 are 7.6% apart and both land all 1,589 inside the band, so the terrain cannot
# choose between them. The logbooks can: on five of the six rolls before 2003 whose
# slipped frames a page covers, the crew's height is the catalogue's divided by 10, to 0.9%
# (the sixth is a one-frame typo no factor fits), and the roll-heights that also pass the
# spacing check are carried in `flying_height_rolls.csv`, which is consulted first. What
# reaches this factor is the 2003-2005 rolls, which have no logbook (the 2003 ones carry
# measured per-frame heights and fit 10.764 better; `bcc05001` is undecided), plus 19
# older frames the table does not reach, each listed with its reason in
# `flying_height_rolls_excluded.csv`.
fly_height_slip_factor <- function() 3.28084^2

# How far a frame's height above ground may sit from `scale x focal_length` before the DEM
Expand Down Expand Up @@ -238,20 +249,24 @@ fly_flying_height_max <- function() 16000
# spacing between frames adjacent by number, which must imply the ~60% forward overlap the
# flight was designed to. `factor` names the defect: 10 or 100 where digits were dropped (a
# logbook "20.0", thousands of feet, catalogued as 2,000 ft), 1 where the logbook confirms
# the height and the SCALE is the wrong field. `height_m` is the height used — the logbook's,
# the height and the SCALE is the wrong field, and 0.1 where the height is ten times too
# LARGE. That last case is fly#71: rolls flown before 2003 that #54 divides by 10.764. `tail` records
# which side of the band the roll-height came from. `height_m` is the height used — the logbook's,
# converted, since the catalogue's rounding survives multiplying by the factor.
#
# Keyed on roll, height, lens and scale together, so the table reaches only the frames it
# was measured on. Every lower-tail roll-height it does not correct is listed with its
# reason in `flying_height_rolls_excluded.csv`: an unlisted roll is unmeasured, not clean.
# was measured on. Every lower-tail roll-height it does not correct, and every #54-slipped one
# it does not reach, is listed with its reason in `flying_height_rolls_excluded.csv`: an
# unlisted roll is unmeasured, not clean.
# Produced by `data-raw/height_calibrate-lower_tail_rolls.R`; see
# `inst/notes/terrain-correction.md`.
fly_height_roll_table <- function() {
path <- system.file("extdata/flying_height_rolls.csv", package = "fly")
if (!nzchar(path)) {
stop("`flying_height_rolls.csv` is missing from the installed package.", call. = FALSE)
}
utils::read.csv(path, colClasses = c(film_roll = "character", cause = "character"))
utils::read.csv(path, colClasses = c(film_roll = "character", cause = "character",
tail = "character"))
}

# The DEM-aligned grid a single footprint is counted against.
Expand Down Expand Up @@ -671,7 +686,9 @@ fly_is_square <- function(footprints) {
#' inheriting whatever is wrong with it, and the catalogue's is about 10.76 times
#' (3.28084 squared) too large on 1,589 film frames from 13 rolls flown between
#' 1974 and 2005 — a feet-to-metres conversion applied the wrong way round, which
#' draws a 1:35000 frame 110 km across. A film frame states its height above
#' draws a 1:35000 frame 110 km across. On six roll-heights flown 1978-2000 the flight
#' logbooks show the factor is exactly 10 instead (fly#71), and those frames are
#' carried in the roll table below. A film frame states its height above
#' ground twice, as `flying_height` minus terrain and as scale times focal length,
#' so the two are compared, and `height_source` records the outcome:
#'
Expand All @@ -686,9 +703,10 @@ fly_is_square <- function(footprints) {
#' \item{`"corrected_roll_table"`}{they disagree, and the frame sits on one of
#' the roll-heights in `inst/extdata/flying_height_rolls.csv`, which the
#' province's flight logbooks and the spacing between adjacent frames settled
#' (fly#60): a height with one or two digits dropped (a logbook "20.0",
#' thousands of feet, catalogued as 2,000 ft), or a correct height beside a
#' wrong `scale`. Sized from the measured height; matched on `film_roll`,
#' (fly#60, fly#71): a height with one or two digits dropped (a logbook "20.0",
#' thousands of feet, catalogued as 2,000 ft), a height recorded ten times too
#' large, or a correct height beside a wrong `scale`. Checked before the
#' 10.76 slip above. Sized from the measured height; matched on `film_roll`,
#' `flying_height`, `focal_length` and `scale` together, so it needs a
#' `film_roll` column. As with the slip, `flying_height` is not overwritten}
#' \item{`"implausible"`}{they disagree some other way, or `flying_height` is
Expand All @@ -704,8 +722,9 @@ fly_is_square <- function(footprints) {
#' `"implausible"` even where `focal_length` is missing}
#' }
#'
#' Measured over the whole catalogue, the correction applies to those 1,589
#' frames and to nothing else. A digital frame's `scale` is a nominal figure, not
#' Measured over the whole catalogue, the two corrections for a height that is too
#' large apply to those 1,589 frames and to nothing else: 299 by the roll table,
#' the rest by 10.76. A digital frame's `scale` is a nominal figure, not
#' its image scale, so it is not compared: only the 16,000 m ceiling, or terrain at
#' or above the aircraft, can refuse one. To list the frames worth a second look:
#' `dplyr::filter(fp, height_source != "reported")`.
Expand Down Expand Up @@ -1089,9 +1108,10 @@ fly_footprint <- function(centroids_sf, negative_size = 9, format_size = NULL,
# two are compared, and a frame outside `fly_height_ratio_band()` is not sized from
# its `flying_height` as it stands. Where dividing by `fly_height_slip_factor()` brings
# it back inside, that is the slip and the corrected height is used; measured over the
# whole catalogue the repair fires on the 1,589 and on nothing else. Anywhere else the
# two disagree and nothing here can say which is wrong, so the frame falls back to
# nominal scale, exactly as one with unusable metadata does.
# whole catalogue the repair fires on the 1,589 and on nothing else, less the 299 on
# 1978-2000 rolls whose logbooks say x10, which the roll table takes first (fly#71).
# Anywhere else the two disagree and nothing here can say which is wrong, so the frame
# falls back to nominal scale, exactly as one with unusable metadata does.
#
# Judged after the FIRST pass and before the second, because the second pass samples
# the rectangle this height implies and that is the expensive half of the mistake.
Expand Down Expand Up @@ -1123,6 +1143,10 @@ fly_footprint <- function(centroids_sf, negative_size = 9, format_size = NULL,
# inferring one. A height slip must still reconcile THIS frame's ratio, as #54's does;
# a factor of 1 says the scale is the wrong field, so the ratio against that scale is
# exactly what cannot be asked of it — but that height must still clear the ground.
# A factor below 1 is a height recorded too LARGE (fly#71: the 1978-2000 rolls #54
# divides by 10.764, whose logbooks read ten times less) and is held to the band like
# any other slip. The test is `!= 1`, not `> 1`: the gate once read `> 1`, which handed
# those frames silently to #54's repair.
#
# Not only `disputed` frames: a height with two digits dropped sits BELOW the terrain
# (bc7280 is catalogued at 60 m), which `disputed` hands to the terrain-above-aircraft
Expand Down Expand Up @@ -1154,7 +1178,7 @@ fly_footprint <- function(centroids_sf, negative_size = 9, format_size = NULL,
# is 96 m short.
r_tabled <- (tab_height - first$elev) / nominal_agl
tabled <- out_of_band & is.finite(tab_factor) &
((tab_factor == 1 & r_reported > 0) | (tab_factor > 1 & in_band(r_tabled)))
((tab_factor == 1 & r_reported > 0) | (tab_factor != 1 & in_band(r_tabled)))

slipped <- disputed & !tabled & in_band(r_repaired)
fh_used <- fh
Expand Down Expand Up @@ -1293,7 +1317,8 @@ fly_footprint <- function(centroids_sf, negative_size = 9, format_size = NULL,
warning(
sum(roll_tabled), " of ", sum(dem_eligible), " frames sit on a roll whose ",
"`flying_height` disagreement was settled by the flight logbooks and the spacing ",
"between frames (`flying_height_rolls.csv`): a height with dropped digits, or a ",
"between frames (`flying_height_rolls.csv`): a height with dropped digits or ",
"recorded ten times too large, or a ",
"correct height beside a wrong `scale`. Sized from the measured height; ",
"`flying_height` is left as supplied and `height_agl` is the height used. ",
"See `height_source`.",
Expand Down
21 changes: 21 additions & 0 deletions data-raw/flying_height_logbooks.csv
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,24 @@
"CONTROL_bc78065__bc78065_3.jpg",TRUE,"bc78065","78065","62-270",62,270,"13.0","True Height (M'/M.S.L.)","13000","f 153 mm","153","","partial","sheet 3 of 3; Princeton Area Rivers OP 212/78; finals overwritten in red, read as 62...270 (uncertain); 80% fwd overlap"
"CONTROL_bcc228__bcc228_1.jpg",TRUE,"bcc228","bcc228","1-166",1,166,"12.650","M'/M.S.L.","12650","f 305","305","","clear","Remark: ""Too much turbulence for this job at 7,650' with 6"" cone"""
"CONTROL_bcc228__bcc228_2.jpg",TRUE,"bcc228","bcc228","177-218",177,218,"14.0","M'/M.S.L.","14000","f 305","305","","clear","First final 177 (possibly overwritten 187)"
"bc78078__bc78078_6.jpg",FALSE,"bc78078","B.C. 78078","55-63",55,63,"3.1","True Height (M'/M.S.L.)","3100","f 153 mm","153","","clear","handwritten form; sheet 6 of 16; field roll NOV. 25; camera 21162; strip 1 dir 315; op 358/78, June 27/78"
"bc78078__bc78078_6.jpg",FALSE,"bc78078","B.C. 78078","64-76",64,76,"-","True Height (M'/M.S.L.)","3100","f 153 mm","153","","clear","height column is a ditto dash under 3.1; strip 2 dir 160; final 64 written in red slightly smudged ('CA'-like) but field 64 is clear"
"bc78078__bc78078_6.jpg",FALSE,"bc78078","B.C. 78078","77-91",77,91,"-","True Height (M'/M.S.L.)","3100","f 153 mm","153","","clear","height column is a ditto dash under 3.1; strip 3 dir 340"
"bc79027__bc79027_4.jpg",FALSE,"bc79027","B.C. 79 027","190-204",190,204,"6.5","True Height (M'/M.S.L.)","6500","f 153 mm","153","","clear","sheet 4 of 4 (both numbers overwritten from 3 in blue); field roll OSCAR 8; camera ZE 21162; strip 1 dir 360; field numbers partly cut off at page edge; page also notes 173-175 cleared and negs 152-162 destroyed (processor breakdown); 80% fwd overlap"
"bc79027__bc79027_4.jpg",FALSE,"bc79027","B.C. 79 027","205-214",205,214,"-","True Height (M'/M.S.L.)","6500","f 153 mm","153","","clear","height column is a ditto dash under 6.5; strip 2 dir 180"
"bc79103__bc79103_5.jpg",FALSE,"bc79103","B.C. 79/03","294-317",294,317,"7.2","True Height (M'/M.S.L.)","7200","f 153 mm","153","","partial","sheet 5 of 5; field roll OSCAR 43; roll written '79/03' (read as 79103); height 7.2 clear; end final read 317 (red) - 3rd digit could be 7 or 1 unlikely other; field end number crossed out and overwritten (appears 124, consistent with field 101 -> final 294 offset); strip 2 dir 005, off at Miller Creek; film ran to end, spliced onto OSCAR 42"
"bcb98013__bcb98013_1.jpg",FALSE,"bcb98013","15BCB99013","001-123",1,123,"24000","True Height","24000","CFL 152.861","153","1: 35000","clear","typed form, height in plain feet (no unit stated; 24000 m impossible); page says final roll 15BCB99013, flight B-010-E-99, date 1999-AUG-02 - differs from file prefix bcb98013 (98 vs 99); line 197 dir 090; sheet 1 of 1; camera RC20 5085"
"bcb98013__bcb98013_1.jpg",FALSE,"bcb98013","15BCB99013","124-194",124,194,"24000","True Height","24000","CFL 152.861","153","1: 35000","clear","line 198 dir 270; off at 194 (126 deg 15 min); same roll-number discrepancy as above"
"bcb98013__bcb98013_1.jpg",FALSE,"bcb98013","15BCB99013","195-236",195,236,"24000","True Height","24000","CFL 152.861","153","1: 35000","clear","line 198 dir 270 resumed at 195; end 236; same roll-number discrepancy as above"
"bcc00085__bcc00085_1.jpg",FALSE,"bcc00085","30BCC00085","001-021",1,21,"18500","True Height","18500","CFL 304.483","305","1: 15000","clear","typed form, height in plain feet; flight C-057-FS-00, 2000-SEP-23; camera RC 10 3539; line 12 dir 270; sheet 1 of 1"
"bcc00085__bcc00085_1.jpg",FALSE,"bcc00085","30BCC00085","022-045",22,45,"18000","True Height","18000","CFL 304.483","305","1: 15000","clear","line 11 dir 090"
"bcc00085__bcc00085_1.jpg",FALSE,"bcc00085","30BCC00085","046-068",46,68,"18000","True Height","18000","CFL 304.483","305","1: 15000","clear","line 10 dir 270"
"bcc00085__bcc00085_1.jpg",FALSE,"bcc00085","30BCC00085","069-089",69,89,"18000","True Height","18000","CFL 304.483","305","1: 15000","clear","line 9 dir 090"
"bcc00085__bcc00085_1.jpg",FALSE,"bcc00085","30BCC00085","090-111",90,111,"18500","True Height","18500","CFL 304.483","305","1: 15000","clear","line 8 dir 270"
"bcc00085__bcc00085_1.jpg",FALSE,"bcc00085","30BCC00085","112-135",112,135,"18500","True Height","18500","CFL 304.483","305","1: 15000","clear","line 7 dir 090"
"bcc00085__bcc00085_1.jpg",FALSE,"bcc00085","30BCC00085","136-159",136,159,"18500","True Height","18500","CFL 304.483","305","1: 15000","clear","line 6 dir 270"
"bcc00085__bcc00085_1.jpg",FALSE,"bcc00085","30BCC00085","160-182",160,182,"19000","True Height","19000","CFL 304.483","305","1: 15000","clear","line 5 dir 090"
"bcc00085__bcc00085_1.jpg",FALSE,"bcc00085","30BCC00085","183-202",183,202,"18500","True Height","18500","CFL 304.483","305","1: 15000","clear","line 4 dir 270"
"bcc00085__bcc00085_1.jpg",FALSE,"bcc00085","30BCC00085","203-218",203,218,"18500","True Height","18500","CFL 304.483","305","1: 15000","clear","line 3 dir 090"
"bcc00085__bcc00085_1.jpg",FALSE,"bcc00085","30BCC00085","219-229",219,229,"19000","True Height","19000","CFL 304.483","305","1: 15000","clear","line 2 dir 270"
"bcc00085__bcc00085_1.jpg",FALSE,"bcc00085","30BCC00085","230-236",230,236,"19000","True Height","19000","CFL 304.483","305","1: 15000","clear","line 1 dir 090"
Loading
Loading