Rossby: The Instant Spatio-Temporal Database
NOTE: Rossby is currently in early development (v0.0.1). The API may change in future releases.
rossby is a blazingly fast, in-memory, NetCDF-to-API server written in Rust.
Instantly serve massive NetCDF datasets as a high-performance HTTP API for point queries and image rendering, with zero data configuration.
Vision
Scientific data is often locked away in static files like NetCDF. rossby liberates this data by providing a simple command-line tool to load a file directly into memory and serve it via a simple, powerful API. It's designed for scientists, engineers, and anyone who needs to interact with spatio-temporal grid data dynamically without the overhead of setting up a traditional database.
Features
- In-Memory Performance: Loads the entire dataset into RAM for microsecond-level query latency.
- NetCDF Native: Directly reads
.ncfiles without any preprocessing or import steps. - Zero Data-Config: All metadata (variables, dimensions, coordinates) is automatically inferred from the NetCDF file.
- High-Performance API: Built with Rust, Axum, and Tokio for incredible speed and concurrency.
- On-the-fly Interpolation: Point queries are not limited to the grid;
rossbyprovides interpolated values for any coordinate. - Dynamic Image Generation: Instantly render data slices as PNG or JPEG images for quick visualization.
- Flexible Server Configuration: Configure your server via command-line arguments, environment variables, or a JSON file, inspired by
uwsgi. - Server Monitoring: Built-in
/heartbeatendpoint provides comprehensive server status, including memory usage and uptime. - Service Discovery Ready: Support for service registration and discovery to enable scalable multi-server deployments.
Quick Start
1. Installation
Ensure you have Rust installed. Then, install rossby using cargo:
2. Get Sample Data
We'll use a sample weather forecast file for this demo.
# a real climate data file
)
3. Run rossby
Point rossby at your NetCDF file. It's that simple.
You should see output indicating the server has started, probably on 127.0.0.1:8000.
INFO rossby > Loading NetCDF file: "tests/fixtures/2m_temperature_1982_5.625deg.nc"
INFO rossby > Found 4 variables
INFO rossby > Found 3 dimensions
INFO rossby > Data loaded successfully.
INFO axum::server > Listening on [http://127.0.0.1:8000](http://127.0.0.1:8000)
4. Query the API
Open a new terminal and use curl to interact with your new, instant database.
Get Metadata: Discover what's in the file.
Get a Point Forecast: Get the interpolated 2-meter temperature (t2m) for a specific location.
There are two ways to query points:
- Using time index (legacy method):
# Expected Response: {"t2m": 288.45}
- Using physical value (recommended):
# Expected Response: {"t2m": 288.45}
Get an Image: Render an image of the t2m variable for a specific region and time.
# Now open the generated japan_temp.png file.
Configuration
rossby uses a layered configuration system with the following order of precedence:
- Command-Line Arguments (highest priority)
- Environment Variables
- JSON Config File
- Default Values (lowest priority)
CLI Usage:
# Example: Run on a public IP, port 9000, with 8 worker threads
# Enable service discovery
JSON Configuration:
You can specify a config file with the --config flag.
rossby --config server.json
server.json example:
API Reference
-
GET /metadata: Returns JSON describing all variables, dimensions, and attributes of the loaded file. -
GET /point: Returns interpolated values for one or more variables at a specific point in space-time. Supports querying by physical value or raw index. -
GET /image: Returns a PNG/JPEG image rendering of a variable over a specified region and time. -
GET /heartbeat: Returns server status information including uptime, memory usage, and dataset details.- Response includes:
server_id: Unique identifier for this server instancetimestamp: Current time in ISO 8601 formatuptime_seconds: Server uptime in secondsmemory_usage_bytes: Process memory usage (if available)available_memory_bytes: Available system memory (if available)status: Server health status ("healthy" under normal conditions)dataset: Object containing dataset information:file_path: Path to the loaded NetCDF filevariable_count: Number of variables in the datasetvariables: List of variable namesdimension_count: Number of dimensionsdimensions: List of dimension names and sizesdata_memory_bytes: Approximate memory usage of the dataset
- Response includes:
-
GET /image: Returns a PNG/JPEG image rendering of a variable over a specified region and time.var: (required) Variable name to rendertime_index: (optional) Time index, defaults to 0bbox: (optional) Bounding box as "min_lon,min_lat,max_lon,max_lat"width: (optional) Image width in pixels, defaults to 800height: (optional) Image height in pixels, defaults to 600colormap: (optional) Colormap name (e.g., viridis, plasma, coolwarm), defaults to "viridis"format: (optional) Output format: "png" or "jpeg", defaults to "png"center: (optional) Map centering: "eurocentric" (-180° to 180°), "americas" (-90° to 270°), "pacific" (0° to 360°), or a custom longitude value, defaults to "eurocentric"wrap_longitude: (optional) Allow bounding boxes that cross the dateline/prime meridian, defaults to falseresampling: (optional) Upsampling/downsampling quality: "nearest", "bilinear", "bicubic", or "auto", defaults to "auto" (bilinear)
For full details, see the documentation included in the repository.
Building from Source
Development
Continuous Integration
This project uses GitHub Actions for continuous integration. The CI pipeline runs the following checks on every push and pull request:
cargo check- Verifies the code compiles without errorscargo test- Runs all tests to ensure they passcargo clippy- Performs static analysis to catch common mistakescargo fmt --check- Ensures code adheres to formatting standards
You can see the CI configuration in the .github/workflows/ci.yml file.
Git Hooks
To ensure code quality before commits are made, we provide Git hooks in the hooks/ directory. These hooks automatically run tests and other checks before allowing commits.
To install the hooks, follow the instructions in the hooks/README.md file.
Contributing
Contributions are welcome! Please feel free to open an issue or submit a pull request.
Before submitting a PR, please make sure:
- All tests pass (
cargo test) - The code is properly formatted (
cargo fmt) - There are no clippy warnings (
cargo clippy) - You've added tests for any new functionality
License
This project is licensed under either of
- Apache License, Version 2.0
- MIT license
at your option.