Skip to main content

Earth Visualization Backend - FastAPI router for weather data and earth imagery

Project description

Earth-Viz Backend

FastAPI backend server for the Earth-Viz interactive globe visualization.

What It Does

  • Serves the Earth-Viz web application
  • Proxies NOAA weather data requests (OpenDAP and GRIB2)
  • Generates real-time cloud imagery from satellite data
  • Provides WebSocket API for programmatic control of the visualization
  • Serves static planet textures

Quick Start

pip install earth-viz
earth-viz-setup    # Download static files (one-time, ~100MB)
earth-viz-server   # Start server

The application will be available at http://localhost:8000/earth-viz-app/

Installation

Prerequisites

  • Python 3.8+
  • pip package manager

Install Package

pip install earth-viz

Download Static Files

The package requires high-resolution planet textures (~300MB). Download them once:

earth-viz-setup

This downloads static images to ~/.globe-server/static_images/

Start Server

earth-viz-server

API Endpoints

Web Application

GET /earth-viz-app/          # Main application

Health & Status

GET /earth-viz/api/health    # Health check
GET /earth-viz/api/status    # Connection status

Data Proxies

GET /earth-viz/api/proxy/opendap?url={url}           # OpenDAP data proxy
GET /earth-viz/api/cgi-bin/filter_gfs_0p25.pl        # GRIB2 data proxy

Planet Images

GET /earth-viz/api/planets/{planet_name}             # Static planet textures

Supported planets: earth, mars, venus, moon, jupiter, saturn, uranus, neptune, mercury

Cloud Generation

GET /earth-viz/api/live-earth/status                 # Trigger cloud generation

WebSocket Control

WS /earth-viz/ws                                     # Control connection

WebSocket Control API

Connect to /earth-viz/ws to send commands to the visualization:

const ws = new WebSocket('ws://localhost:8000/earth-viz/ws');

ws.send(JSON.stringify({
  type: 'EARTH_COMMAND',
  command: 'setProjection',
  params: ['orthographic']
}));

Available commands:

  • setProjection(projection) - Set map projection
  • setOverlay(type) - Set overlay type
  • setAirMode(level, particleType, overlayType) - Air mode
  • setOceanMode(particleType, overlayType) - Ocean mode
  • setPlanetMode(planet) - Planet mode
  • setLevel(level) - Set atmospheric level
  • showGrid() / hideGrid() - Toggle grid
  • setWindUnits(units) - Set wind units
  • setDate(date) / setHour(hour) - Time controls
  • navigateTime(hours) - Navigate time
  • goToNow() - Reset to current time
  • hideUI() / showUI() - Toggle UI
  • enableFullScreen() / disableFullScreen() - Fullscreen

Integration Mode

Mount the Earth-Viz router in your own FastAPI application:

from fastapi import FastAPI
from earth_viz_backend.earth_viz_api import create_earth_viz_router
from earth_viz_backend.earth_control import create_earth_control_router
from earth_viz_backend.services.cloud_scheduler import scheduler
import asyncio

app = FastAPI()

# Mount routers
app.include_router(create_earth_viz_router())
app.include_router(create_earth_control_router())

# Add lifecycle handlers
@app.on_event("startup")
async def startup():
    asyncio.create_task(scheduler.start())

@app.on_event("shutdown")
async def shutdown():
    await scheduler.stop()

Programmatic Control

Control the visualization from Python:

from earth_viz_backend.earth_control import (
    set_projection,
    set_air_mode,
    set_planet_mode,
    await_earth_connection
)

# Wait for frontend to connect
await await_earth_connection(timeout=30.0)

# Send commands
await set_projection("orthographic")
await set_air_mode("surface", "wind", "temp")
await set_planet_mode("mars")

Development

API documentation available at:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

File Locations

  • Static images: ~/.globe-server/static_images/
  • Generated clouds: ~/.globe-server/images/
  • Package source: src/earth_viz_backend/
  • Frontend app: src/earth_viz_backend/static/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

earth_viz-0.0.466.tar.gz (252.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

earth_viz-0.0.466-py3-none-any.whl (253.1 kB view details)

Uploaded Python 3

File details

Details for the file earth_viz-0.0.466.tar.gz.

File metadata

  • Download URL: earth_viz-0.0.466.tar.gz
  • Upload date:
  • Size: 252.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for earth_viz-0.0.466.tar.gz
Algorithm Hash digest
SHA256 993d411291b5fa1e58fea2d8636b0781b15c88a8b659cae0ca96f3bd451f7088
MD5 7ff5d1a83704733265edee1d8acd533f
BLAKE2b-256 df4864146ee47d2fee22feb4e60abdf82993e3c100ea2bc3ae696d874cc06b27

See more details on using hashes here.

File details

Details for the file earth_viz-0.0.466-py3-none-any.whl.

File metadata

  • Download URL: earth_viz-0.0.466-py3-none-any.whl
  • Upload date:
  • Size: 253.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for earth_viz-0.0.466-py3-none-any.whl
Algorithm Hash digest
SHA256 b7a0972b09832b30b7174674d2e0b6f2e9edade9946e67411bc65ac919a02c54
MD5 ee0cb6880e6bdb1ccaaf84554f30f5ec
BLAKE2b-256 6060520b00ade2d15a7556288d2b944854d688a3a3ae3e677195d0d70214344f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page