# marsraw/mars-raw-utils architecture

> Architecture diagram of the GitHub repository marsraw/mars-raw-utils, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marsraw/mars-raw-utils
- Repository: https://github.com/marsraw/mars-raw-utils

## Overview

MRU is a command-line toolkit and Rust library for retrieving public raw Mars mission imagery and processing it for enthusiast and citizen-science use. Its principal workflow accepts a mission-specific fetch command, queries the corresponding public image service, filters results, downloads image files and metadata, and saves them locally. Separate workflows update calibration data and calibrate images; additional commands manipulate images and expose mission time, location, weather, and overpass information. The README documents camera-specific calibration capabilities; mission and auxiliary command wiring beyond the sampled fetch path is represented only where the tree and documentation support it.

Main entry points: [`src/remotequery.rs`](https://github.com/marsraw/mars-raw-utils/blob/master/src/remotequery.rs) (Fetch orchestration), [`bin/mru.rs`](https://github.com/marsraw/mars-raw-utils/blob/master/bin/mru.rs) (MRU CLI), [`bin/subs/mod.rs`](https://github.com/marsraw/mars-raw-utils/blob/master/bin/subs/mod.rs) (Mission commands), [`src/caldata/mod.rs`](https://github.com/marsraw/mars-raw-utils/blob/master/src/caldata/mod.rs) (Calibration data manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command interface"]
  node_mru["MRU CLI<br/>[mru.rs]"]
  node_fetch_cmds["Fetch commands<br/>[m20fetch.rs]"]
  node_cal_cmd["Calibration command<br/>[calibrate.rs]"]
  node_image_cmds["Image commands<br/>[mod.rs]"]
  node_mission_cmds["Mission commands<br/>[mod.rs]"]
end

subgraph group_retrieval["Image retrieval"]
  node_remotequery["Fetch orchestration<br/>[remotequery.rs]"]
  node_m20_fetch["Mars2020 fetch client<br/>[fetch.rs]"]
  node_msl_fetch["MSL fetch client<br/>[fetch.rs]"]
  node_nsyt_fetch["InSight fetch client<br/>[fetch.rs]"]
  node_raw_service{{"NASA raw-image services"}}
  node_http["HTTP retrieval<br/>[httpfetch.rs]"]
  node_image_store["Downloaded images"]
  node_metadata["Image metadata<br/>[metadata.rs]"]
end

subgraph group_processing["Image processing"]
  node_calibrate["Calibration entrypoint<br/>[calibrate.rs]"]
  node_mission_cal["Mission camera calibration<br/>[mod.rs]"]
  node_image_ops["Image operations<br/>[lib.rs]"]
end

subgraph group_mission["Mission services"]
  node_mission_info["Mission information APIs<br/>[mod.rs]"]
  node_passes["Orbiter overpasses<br/>[passes.rs]"]
  node_location["Rover location<br/>[location.rs]"]
  node_mission_weather["Mission weather<br/>[weather.rs]"]
  node_mission_services{{"Mission web services"}}
end

subgraph group_caldata["Calibration data"]
  node_caldata_cmd["Calibration updater<br/>[caldata.rs]"]
  node_caldata["Calibration data manager<br/>[mod.rs]"]
  node_cal_store[("Local calibration files")]
end

node_user(("User"))

node_user -->|"invokes"| node_mru
node_mru -->|"dispatches"| node_fetch_cmds
node_mru -->|"dispatches"| node_cal_cmd
node_mru -->|"dispatches"| node_image_cmds
node_mru -->|"dispatches"| node_mission_cmds
node_fetch_cmds -->|"configures fetch"| node_remotequery
node_remotequery -->|"queries"| node_m20_fetch
node_remotequery -->|"queries"| node_msl_fetch
node_remotequery -->|"queries"| node_nsyt_fetch
node_m20_fetch -->|"requests images"| node_raw_service
node_msl_fetch -->|"requests images"| node_raw_service
node_nsyt_fetch -->|"requests images"| node_raw_service
node_remotequery -->|"downloads bytes"| node_http
node_remotequery -->|"writes images"| node_image_store
node_remotequery -->|"saves metadata"| node_metadata
node_cal_cmd -->|"runs calibration"| node_calibrate
node_calibrate -->|"selects routines"| node_mission_cal
node_image_cmds -->|"runs operations"| node_image_ops
node_mission_cmds -.->|"requests data"| node_mission_info
node_mission_info -.->|"queries"| node_mission_services
node_mission_cmds -.->|"requests passes"| node_passes
node_mission_cmds -.->|"requests location"| node_location
node_mission_cmds -.->|"requests weather"| node_mission_weather
node_mission_weather -.->|"queries"| node_mission_services
node_caldata_cmd -->|"updates files"| node_caldata
node_caldata -->|"fetches files"| node_http
node_caldata -->|"writes files"| node_cal_store

click node_mru "https://github.com/marsraw/mars-raw-utils/blob/master/bin/mru.rs"
click node_fetch_cmds "https://github.com/marsraw/mars-raw-utils/blob/master/bin/subs/m20/m20fetch.rs"
click node_cal_cmd "https://github.com/marsraw/mars-raw-utils/blob/master/bin/subs/calibrate.rs"
click node_image_cmds "https://github.com/marsraw/mars-raw-utils/blob/master/bin/subs/mod.rs"
click node_mission_cmds "https://github.com/marsraw/mars-raw-utils/blob/master/bin/subs/mod.rs"
click node_remotequery "https://github.com/marsraw/mars-raw-utils/blob/master/src/remotequery.rs"
click node_m20_fetch "https://github.com/marsraw/mars-raw-utils/blob/master/src/m20/fetch.rs"
click node_msl_fetch "https://github.com/marsraw/mars-raw-utils/blob/master/src/msl/fetch.rs"
click node_nsyt_fetch "https://github.com/marsraw/mars-raw-utils/blob/master/src/nsyt/fetch.rs"
click node_http "https://github.com/marsraw/mars-raw-utils/blob/master/src/httpfetch.rs"
click node_metadata "https://github.com/marsraw/mars-raw-utils/blob/master/src/metadata.rs"
click node_calibrate "https://github.com/marsraw/mars-raw-utils/blob/master/src/calibrate.rs"
click node_mission_cal "https://github.com/marsraw/mars-raw-utils/blob/master/src/m20/mod.rs"
click node_image_ops "https://github.com/marsraw/mars-raw-utils/blob/master/src/lib.rs"
click node_caldata_cmd "https://github.com/marsraw/mars-raw-utils/blob/master/bin/subs/caldata.rs"
click node_caldata "https://github.com/marsraw/mars-raw-utils/blob/master/src/caldata/mod.rs"
click node_mission_info "https://github.com/marsraw/mars-raw-utils/blob/master/src/m20/mod.rs"
click node_passes "https://github.com/marsraw/mars-raw-utils/blob/master/src/passes.rs"
click node_location "https://github.com/marsraw/mars-raw-utils/blob/master/src/location.rs"
click node_mission_weather "https://github.com/marsraw/mars-raw-utils/blob/master/src/m20/weather.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mru,node_fetch_cmds,node_cal_cmd,node_image_cmds,node_mission_cmds,node_user toneBlue
class node_remotequery,node_m20_fetch,node_msl_fetch,node_nsyt_fetch,node_raw_service,node_http,node_image_store,node_metadata toneAmber
class node_calibrate,node_mission_cal,node_image_ops toneMint
class node_mission_info,node_passes,node_location,node_mission_weather,node_mission_services toneRose
class node_caldata_cmd,node_caldata,node_cal_store toneIndigo
```

## Components

### Command interface

- [MRU CLI](https://github.com/marsraw/mars-raw-utils/blob/master/bin/mru.rs): `bin/mru.rs`
- [Fetch commands](https://github.com/marsraw/mars-raw-utils/blob/master/bin/subs/m20/m20fetch.rs): `bin/subs/m20/m20fetch.rs`
- [Calibration command](https://github.com/marsraw/mars-raw-utils/blob/master/bin/subs/calibrate.rs): `bin/subs/calibrate.rs`
- [Image commands](https://github.com/marsraw/mars-raw-utils/blob/master/bin/subs/mod.rs): `bin/subs/mod.rs`
- [Mission commands](https://github.com/marsraw/mars-raw-utils/blob/master/bin/subs/mod.rs): `bin/subs/mod.rs`

### Image retrieval

- [Fetch orchestration](https://github.com/marsraw/mars-raw-utils/blob/master/src/remotequery.rs): `src/remotequery.rs`
- [Mars2020 fetch client](https://github.com/marsraw/mars-raw-utils/blob/master/src/m20/fetch.rs): `src/m20/fetch.rs`
- [MSL fetch client](https://github.com/marsraw/mars-raw-utils/blob/master/src/msl/fetch.rs): `src/msl/fetch.rs`
- [InSight fetch client](https://github.com/marsraw/mars-raw-utils/blob/master/src/nsyt/fetch.rs): `src/nsyt/fetch.rs`
- **NASA raw-image services**
- [HTTP retrieval](https://github.com/marsraw/mars-raw-utils/blob/master/src/httpfetch.rs): `src/httpfetch.rs`
- **Downloaded images**
- [Image metadata](https://github.com/marsraw/mars-raw-utils/blob/master/src/metadata.rs): `src/metadata.rs`

### Image processing

- [Calibration entrypoint](https://github.com/marsraw/mars-raw-utils/blob/master/src/calibrate.rs): `src/calibrate.rs`
- [Mission camera calibration](https://github.com/marsraw/mars-raw-utils/blob/master/src/m20/mod.rs): `src/m20/mod.rs`
- [Image operations](https://github.com/marsraw/mars-raw-utils/blob/master/src/lib.rs): `src/lib.rs`

### Mission services

- [Mission information APIs](https://github.com/marsraw/mars-raw-utils/blob/master/src/m20/mod.rs): `src/m20/mod.rs`
- [Orbiter overpasses](https://github.com/marsraw/mars-raw-utils/blob/master/src/passes.rs): `src/passes.rs`
- [Rover location](https://github.com/marsraw/mars-raw-utils/blob/master/src/location.rs): `src/location.rs`
- [Mission weather](https://github.com/marsraw/mars-raw-utils/blob/master/src/m20/weather.rs): `src/m20/weather.rs`
- **Mission web services**

### Calibration data

- [Calibration updater](https://github.com/marsraw/mars-raw-utils/blob/master/bin/subs/caldata.rs): `bin/subs/caldata.rs`
- [Calibration data manager](https://github.com/marsraw/mars-raw-utils/blob/master/src/caldata/mod.rs): `src/caldata/mod.rs`
- **Local calibration files**

### Other components

- **User**

## Connections

- User → MRU CLI: invokes
- MRU CLI → Fetch commands: dispatches
- MRU CLI → Calibration command: dispatches
- MRU CLI → Image commands: dispatches
- MRU CLI → Mission commands: dispatches
- Fetch commands → Fetch orchestration: configures fetch
- Fetch orchestration → Mars2020 fetch client: queries
- Fetch orchestration → MSL fetch client: queries
- Fetch orchestration → InSight fetch client: queries
- Mars2020 fetch client → NASA raw-image services: requests images
- MSL fetch client → NASA raw-image services: requests images
- InSight fetch client → NASA raw-image services: requests images
- Fetch orchestration → HTTP retrieval: downloads bytes
- Fetch orchestration → Downloaded images: writes images
- Fetch orchestration → Image metadata: saves metadata
- Calibration command → Calibration entrypoint: runs calibration
- Calibration entrypoint → Mission camera calibration: selects routines
- Image commands → Image operations: runs operations
- Mission commands → Mission information APIs: requests data
- Mission information APIs → Mission web services: queries
- Mission commands → Orbiter overpasses: requests passes
- Mission commands → Rover location: requests location
- Mission commands → Mission weather: requests weather
- Mission weather → Mission web services: queries
- Calibration updater → Calibration data manager: updates files
- Calibration data manager → HTTP retrieval: fetches files
- Calibration data manager → Local calibration files: writes files
