diff --git a/Cargo.toml b/Cargo.toml index 95b241a..20b4b77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rust-jpl" -version = "0.0.1" +version = "0.0.1-alpha" edition = "2021" authors = ["Chinmay Vivek "] description = "Rust library for NASA JPL DE441 ephemeris: precise planetary positions for astronomy, astrophysics, and astrology applications" diff --git a/crates-io.md b/crates-io.md index 533d0f2..80b4278 100644 --- a/crates-io.md +++ b/crates-io.md @@ -4,3 +4,189 @@ It provides **high-precision planetary and lunar positions** based on a given **Julian date**, using official **NASA JPL DE ephemerides (DE441)**. The library is designed for **scientific correctness, API clarity, and performance**, making it suitable for research, engineering, simulation, and educational use. + +## 🧭 Use Cases + +- Astronomy and astrophysics research +- Orbital mechanics and trajectory planning +- Space mission planning +- Celestial navigation +- Satellite and ground-station tracking +- Educational tools and simulations +- Scientific visualization software + +--- + +## πŸ›  Requirements + +| Requirement | Version | +| --------------- | --------------------- | +| **Rust (MSRV)** | **1.70.0** or newer | +| Cargo | Comes with Rust | +| Supported OS | Linux, macOS, Windows | +| Architecture | x86_64, aarch64 | + +> The MSRV is documented and respected. Breaking MSRV changes will require a minor or major release. + +--- + +## πŸ“¦ Installation + +### From crates.io + +```toml +[dependencies] +rust-jpl = "0.0.1-alpha" +``` + +--- + +## πŸš€ Quick Start + +### Basic Usage + +```rust +use rust_jpl::{Ephemeris, JulianDate}; + +fn main() -> Result<(), Box> { + let mut eph = Ephemeris::new("config.toml")?; + + let jd = JulianDate::from_calendar(2024, 1, 15, 12, 0, 0.0)?; + let position = eph.get_position("Earth", jd)?; + + println!( + "Earth position: ({}, {}, {}) AU", + position.x, position.y, position.z + ); + + Ok(()) +} +``` + +--- + +## ⏱ Time Conversion + +```rust +use rust_jpl::{CalendarDate, JulianDate}; + +let cal = CalendarDate::new(2024, 1, 15, 12, 0, 0.0); +let jd = cal.to_julian()?; +println!("Julian Date: {}", jd.as_f64()); + +let cal2 = jd.to_calendar(); +println!("Calendar: {}-{:02}-{:02}", cal2.year, cal2.month, cal2.day); +``` + +--- + +## πŸͺ Planetary Positions + +```rust +use rust_jpl::{Ephemeris, JulianDate}; + +let mut eph = Ephemeris::new("config.toml")?; +let jd = JulianDate::from_calendar(2024, 1, 15, 12, 0, 0.0)?; + +let sun = eph.get_position("Sun", jd)?; +let earth = eph.get_position("Earth", jd)?; +let mars = eph.get_position("Mars", jd)?; + +println!("Sun: ({:.6}, {:.6}, {:.6}) AU", sun.x, sun.y, sun.z); +println!("Distance from origin: {:.6} AU", sun.distance()); +``` + +--- + +## πŸ“Š Ephemeris Metadata + +```rust +use rust_jpl::Ephemeris; + +let mut eph = Ephemeris::new("config.toml")?; +let metadata = eph.get_metadata(); + +println!("Date Range: {} - {}", metadata.start_year, metadata.end_year); +println!("Julian Range: {} - {}", metadata.julian_start, metadata.julian_end); +println!("Interval: {} days", metadata.interval_days); +println!("Earth–Moon Mass Ratio: {}", metadata.earth_moon_ratio); + +for body in eph.get_bodies() { + println!("{}: {}", body.name, if body.active { "active" } else { "inactive" }); +} +``` + +--- + +## βš™οΈ Configuration + +Copy the example configuration file: + +```bash +cp config.toml.example config.toml +``` + +### Example `config.toml` + +```toml +[paths] +nasa_jpl_de441 = "assets/linux_m13000p17000.441.bsp" +header_441 = "assets/header.441" +initial_data_dat = "assets/Initial_data.dat" +``` + +--- + +## πŸ“₯ Ephemeris File Setup + +### 1. Download NASA JPL DE441 + +- Source: NASA JPL Solar System Dynamics +- Required files: + - `linux_m13000p17000.441` + - `header.441` + +Rename: + +``` +linux_m13000p17000.441 β†’ linux_m13000p17000.441.bsp +``` + +Place files in the `assets/` directory. + +--- + +### 2. Create `Initial_data.dat` + +```text +BODIES: + +Mercury true +Venus true +EarthMoon_barycenter true +Mars true +Jupiter true +Saturn true +Uranus true +Neptune true +Pluto true +Moon_geocentric true +Sun true + +DATE: + +Start_year 1940 +End_year 2100 +``` + +--- + +## πŸ§ͺ Examples + +```bash +cargo run --example basic_usage +cargo run --example time_conversion +cargo run --example planetary_positions +``` + +--- diff --git a/publish.sh b/publish.sh deleted file mode 100644 index 4b7df0d..0000000 --- a/publish.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash - -# ===================================================== -# rust-jpl crate publish automation -# Author: Chinmay Vivek -# Purpose: Automate pre-checks and publish to crates.io -# ===================================================== - -set -e # exit on any error -set -o pipefail - -# --- Config --- -MIN_RUST_VERSION="1.70.0" -CRATE_NAME="rust-jpl" - -echo "πŸš€ Starting publish process for $CRATE_NAME..." - -# --- 1. Check Rust version --- -RUST_VERSION=$(rustc --version | awk '{print $2}') -echo "Detected Rust version: $RUST_VERSION" - -if [ "$(printf '%s\n' "$MIN_RUST_VERSION" "$RUST_VERSION" | sort -V | head -n1)" != "$MIN_RUST_VERSION" ]; then - echo "⚠️ Rust version must be >= $MIN_RUST_VERSION" - exit 1 -fi - -# --- 2. Ensure Git repo is clean --- -if [ -n "$(git status --porcelain)" ]; then - echo "⚠️ Git repository is not clean. Commit or stash changes first." - git status - exit 1 -fi - -# --- 3. Run formatting and linting --- -echo "πŸ”§ Running cargo fmt..." -cargo fmt --all -- --check - -echo "πŸ” Running cargo clippy..." -cargo clippy --all-targets --all-features -- -D warnings - -# --- 4. Run tests --- -echo "πŸ§ͺ Running tests..." -cargo test --all - -# --- 5. Build docs --- -echo "πŸ“š Building documentation..." -cargo doc --no-deps - -# --- 6. Check package --- -echo "πŸ“¦ Verifying package contents (dry run)..." -cargo package --allow-dirty --no-verify --dry-run - -# --- 7. Confirm publish --- -read -p "βœ… All checks passed. Proceed to publish $CRATE_NAME to crates.io? [y/N]: " CONFIRM -CONFIRM=${CONFIRM,,} # convert to lowercase -if [[ "$CONFIRM" != "y" ]]; then - echo "❌ Publish aborted." - exit 0 -fi - -# --- 8. Publish --- -echo "πŸš€ Publishing $CRATE_NAME to crates.io..." -cargo publish - -echo "πŸŽ‰ Publish completed successfully!" diff --git a/readme.md b/readme.md index abd1923..eeaa01d 100644 --- a/readme.md +++ b/readme.md @@ -54,7 +54,7 @@ The library is designed for **scientific correctness, API clarity, and performan ```toml [dependencies] -rust-jpl = "0.0.1" +rust-jpl = "0.0.1-alpha" ``` ### From source