Moon surface map

This commit is contained in:
connor committed 2026-10-15 10:04:13 -04:00
1 parent 0e8134aa59
commit f8b515e198
36 files changed
+1710 -222

No files matched your search

+36 -2
View File
@@ -30,8 +30,8 @@ fn render(scene: &str, adapter: &str) -> image::ImageBuffer<image::Rgb<u16>, Vec
render_at(scene, adapter, "L0")
}
/// A data directory whose Earth images are small and uniformly gray, for tests at
/// lighting L1 that do not need Blue Marble: loading the real 16384 x 8192 images takes
/// A data directory whose Earth images and Moon map are small and uniform, for tests at
/// lighting L1 that do not need the real ones: loading those (16384 x 8192 each) takes
/// seconds in a debug build, and they are only there once fetched.
fn gray_earth() -> PathBuf {
static DIR: std::sync::OnceLock<PathBuf> = std::sync::OnceLock::new();
@@ -44,6 +44,11 @@ fn gray_earth() -> PathBuf {
.save(dir.join(format!("earth/bmng-2004-{month:02}.jpg")))
.unwrap();
}
// A uniform Moon: I/F 0.06 (16-bit values of I/F x 100,000).
std::fs::create_dir_all(dir.join("moon")).unwrap();
image::ImageBuffer::<image::Luma<u16>, _>::from_pixel(64, 32, image::Luma([6000]))
.save(dir.join("moon/wac-hapke-643.png"))
.unwrap();
dir
})
.clone()
@@ -164,6 +169,35 @@ fn solar_eclipse_puts_the_umbra_at_greatest_eclipse() {
assert!(corner.iter().all(|&v| v > 70), "{corner:?}");
}
#[test]
fn lighting_l1_names_a_missing_moon_map() {
// Earth's images but no Moon map: the error names the file and the script.
let dir = out_dir().join("earth-only");
std::fs::create_dir_all(dir.join("earth")).unwrap();
std::fs::copy(
gray_earth().join("earth/bmng-2004-07.jpg"),
dir.join("earth/bmng-2004-07.jpg"),
)
.unwrap();
let result = resolved(&[
"render",
"--scene",
"examples/scenes/landsat8.toml",
"--lighting",
"L1",
"--data",
dir.to_str().unwrap(),
"--preview",
"x.png",
]);
assert!(!result.status.success());
let stderr = String::from_utf8_lossy(&result.stderr);
assert!(
stderr.contains("moon/wac-hapke-643.png") && stderr.contains("fetch-moon.py"),
"{stderr}"
);
}
#[test]
fn errors_are_reported() {
let missing = resolved(&["render", "--scene", "no/such.toml", "--preview", "x.png"]);