diff --git a/README.md b/README.md
index 9682bea..2908fd8 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,8 @@ There are several satellites to choose from, each covering a different region of
- Meteosat 9 (Africa, Middle East, India, Central Asia)
- Meteosat 10 (Atlantic Ocean, Africa, Europe)
+For each satellite, you can select a "sector" and a "product". The sector determines which part of the planet to zoom in on (defaults to 'full_disk', which is the entire Earth), and the product determines how the various black-and-white sensors are combined to produce the final image. The default is 'geocolor', which is an approximation of visible light, with some enhancement at night.
+
It's also possible to specify a custom background image, if desired.
## Warning - Data Usage
@@ -74,6 +76,8 @@ Description=Run Satpaper on login.
Environment=SATPAPER_SATELLITE=goes-east
Environment=SATPAPER_RESOLUTION_X=2560
Environment=SATPAPER_RESOLUTION_Y=1440
+Environment=SATPAPER_PRODUCT=geocolor
+Environment=SATPAPER_SECTOR=full_disk
Environment=SATPAPER_DISK_SIZE=94
Environment=SATPAPER_TARGET_PATH=/var/home/colonial/.local/share/backgrounds/
@@ -120,6 +124,10 @@ launchctl start $HOME/Library/LaunchAgents/com.satpaper.plist
2560
SATPAPER_RESOLUTION_Y
1440
+ SATPAPER_PRODUCT
+ geocolor
+ SATPAPER_SECTOR
+ full_disk
SATPAPER_DISK_SIZE
94
SATPAPER_TARGET_PATH
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index be93942..ee4dcd7 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -6,6 +6,8 @@ services:
dockerfile: ./docker/Dockerfile
environment:
- SATPAPER_SATELLITE=goes-east
+ - SATPAPER_PRODUCT=geocolor
+ - SATPAPER_SECTOR=full_disk
- SATPAPER_RESOLUTION_X=2560
- SATPAPER_RESOLUTION_Y=1440
- SATPAPER_DISK_SIZE=95
diff --git a/src/config.rs b/src/config.rs
index 47dd2f9..d527dc9 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -27,6 +27,15 @@ pub struct Config {
/// The Y resolution/height of the generated wallpaper.
#[arg(short = 'y', long, env = "SATPAPER_RESOLUTION_Y")]
pub resolution_y: u32,
+
+ /// The product requested. (geocolor, etc)
+ #[arg(short = 'p', long, env = "SATPAPER_PRODUCT", default_value = "geocolor")]
+ pub product: String,
+
+ /// The sector requested. (full_disk, conus, etc)
+ #[arg(short = 'c', long, env = "SATPAPER_SECTOR", default_value = "full_disk")]
+ pub sector: String,
+
/// The size of the "disk" (Earth) relative to the generated wallpaper's
/// smaller dimension.
///
@@ -102,8 +111,8 @@ impl Satellite {
}
}
- pub fn tile_image(self) -> Image, 3> {
- Image::alloc(self.tile_size(), self.tile_size()).boxed()
+ pub fn tile_image(self, sector: &String) -> Image, 3> {
+ Image::alloc(self.tile_size(sector), self.tile_size(sector)).boxed()
}
pub fn tile_count(self) -> u32 {
@@ -115,13 +124,27 @@ impl Satellite {
}
}
- pub fn tile_size(self) -> u32 {
+ pub fn tile_size(self, sector: &String) -> u32 {
use Satellite::*;
match self {
- GOESEast | GOESWest => 678,
- Himawari => 688,
- Meteosat9 | Meteosat10 => 464,
+ GOESEast | GOESWest => match sector.as_str() {
+ "full_disk" => 678,
+ "conus" => 625,
+ "mesoscale_01" => 500,
+ "mesoscale_02" => 500,
+ _ => 678
+ },
+ Himawari => match sector.as_str() {
+ "full_disk" => 688,
+ "japan" => 750,
+ "mesoscale_01" => 500,
+ _ => 688
+ },
+ Meteosat9 | Meteosat10 => match sector.as_str() {
+ "full_disk" => 464,
+ _ => 464
+ },
}
}
}
\ No newline at end of file
diff --git a/src/main.rs b/src/main.rs
index ebdfea7..24e83b1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -85,6 +85,8 @@ mod tests {
satellite: Satellite::GOESEast,
resolution_x: 2556,
resolution_y: 1440,
+ product: "geocolor",
+ sector: "full_disk",
disk_size: 95,
target_path: ".".into(),
wallpaper_command: None,
diff --git a/src/slider.rs b/src/slider.rs
index 1d5f773..70b4ccc 100644
--- a/src/slider.rs
+++ b/src/slider.rs
@@ -17,8 +17,6 @@ use super::{
pub type Image = Img;
const SLIDER_BASE_URL: &str = "https://rammb-slider.cira.colostate.edu";
-const SLIDER_SECTOR: &str = "full_disk";
-const SLIDER_PRODUCT: &str = "geocolor";
const TIMEOUT: Duration = Duration::from_secs(30);
@@ -55,8 +53,10 @@ fn download(config: &Config) -> Result>> {
.map(|(x, y)| -> Result<_> {
// year:04 i am hilarious
let url = format!(
- "{SLIDER_BASE_URL}/data/imagery/{year:04}/{month:02}/{day:02}/{}---{SLIDER_SECTOR}/{SLIDER_PRODUCT}/{}/{:02}/{x:03}_{y:03}.png",
+ "{SLIDER_BASE_URL}/data/imagery/{year:04}/{month:02}/{day:02}/{}---{}/{}/{}/{:02}/{x:03}_{y:03}.png",
config.satellite.id(),
+ config.sector,
+ config.product,
time.as_int(),
config.satellite.max_zoom()
);
@@ -74,7 +74,7 @@ fn download(config: &Config) -> Result>> {
let reader = resp.into_reader();
let dec = png::Decoder::new(reader);
let mut reader = dec.read_info()?;
- let mut buf = config.satellite.tile_image();
+ let mut buf = config.satellite.tile_image(&config.sector);
let info = reader.next_frame(unsafe { buf.buffer_mut() })?;
debug_assert!(matches!(info.color_type, png::ColorType::Rgb));
let buf = buf.scale::(tile_size, tile_size);
@@ -289,8 +289,10 @@ where
impl Time {
pub fn fetch(config: &Config) -> Result {
let url = format!(
- "{SLIDER_BASE_URL}/data/json/{}/{SLIDER_SECTOR}/{SLIDER_PRODUCT}/latest_times.json",
- config.satellite.id()
+ "{SLIDER_BASE_URL}/data/json/{}/{}/{}/latest_times.json",
+ config.satellite.id(),
+ config.sector,
+ config.product
);
let json = ureq::get(&url)
@@ -316,8 +318,10 @@ struct Date {
impl Date {
pub fn fetch(config: &Config) -> Result {
let url = format!(
- "{SLIDER_BASE_URL}/data/json/{}/{SLIDER_SECTOR}/{SLIDER_PRODUCT}/available_dates.json",
- config.satellite.id()
+ "{SLIDER_BASE_URL}/data/json/{}/{}/{}/available_dates.json",
+ config.satellite.id(),
+ config.sector,
+ config.product
);
let json = ureq::get(&url)