Skip to content

V1-D2/Server_SatelliteProcessor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SatelliteProcessor: AI-Enhanced AMSR-2 Thermal Satellite Imagery System

Desktop application and server framework for processing AMSR-2 satellite thermal imagery with deep learning-based 8× super-resolution enhancement


Overview

SatelliteProcessor is a comprehensive software system for processing thermal satellite imagery from the AMSR-2 (Advanced Microwave Scanning Radiometer 2) sensor aboard GCOM-W1. The system combines traditional geospatial processing with state-of-the-art deep learning to provide enhanced resolution thermal data products for polar sea ice analysis and atmospheric research.

The system operates in two modes:

  • Desktop Application: Cross-platform GUI application for interactive processing
  • Server Framework: High-performance batch processing system for HPC clusters

Key Features:

  • Direct GPORTAL API integration for automated data acquisition
  • EASE-Grid 2.0 compliant polar projection with sub-pixel accuracy
  • Transformer-based 8× super-resolution enhancement (1.25 km effective resolution)
  • Multi-platform support (CUDA, Apple Silicon MPS, Intel DirectML)
  • Batch processing capabilities with SLURM integration

System Architecture

Processing Pipeline

GPORTAL Download → Temperature Extraction → Geometric Correction → Enhancement → Export
      ↓                    ↓                      ↓                    ↓           ↓
   HDF5 Files       36.5GHz Channel      EASE-Grid Projection    ML Processing   NPZ/PNG

The system processes raw AMSR-2 Level 1B brightness temperature data through several stages:

  1. Data Acquisition: Automated download from JAXA GPORTAL archives with authentication
  2. Temperature Extraction: Conversion from raw digital numbers to physical temperatures (Kelvin) using satellite-provided scale factors
  3. Geometric Transformation: Reprojection from swath geometry to EASE-Grid 2.0 equal-area projection
  4. Enhancement (optional): Deep learning-based super-resolution using cascaded SwinIR-ESRGAN architecture
  5. Export: Multi-format output including compressed arrays (NPZ), georeferenced imagery (PNG), and processing metadata (JSON)

Core Functionality

1. Polar Circle Generation

Creates full polar composite images by mosaicking multiple satellite passes:

  • Input: Date, orbit type (ascending/descending), hemisphere (north/south)
  • Process: Downloads all orbital passes for specified date, reprojects to EASE-Grid 2.0 (1800×1800 at 10 km/pixel), applies adaptive hole-filling algorithm for gap regions
  • Output: 1800×1800 polar projection covering ±90° to ±30° latitude

Geometric Transformation:

WGS84 (lat, lon) → EASE-Grid 2.0 (x, y) → Pixel indices (i, j)

Utilizes EPSG:6931 (North) and EPSG:6932 (South) coordinate reference systems with Lambert azimuthal equal-area projection. Grid registration follows NSIDC conventions with origin at (-9000 km, +9000 km).

2. Single Strip Processing

Processes individual satellite passes without mosaicking:

  • Input: Date, file selection index
  • Process: Extracts brightness temperature from 36.5 GHz horizontal polarization channel, applies scale factors, generates visualization products
  • Output: Temperature array (2000×220 typical) with associated coordinates

3. Enhanced 8× Super-Resolution

Applies cascaded deep learning model to increase effective spatial resolution:

  • Input: Original thermal imagery at native resolution
  • Process: Three-stage cascaded enhancement (2×→4×→8×), patch-based processing with Gaussian-weighted blending
  • Output: 8× enhanced imagery with preserved temperature distributions
  • Performance: ~0.2 K temperature drift across cascade, 39 dB PSNR on validation data

4. Enhanced 8× Polar Projection

Combines polar mosaicking with super-resolution:

  • Input: Date, orbit type, hemisphere
  • Process: Enhances individual swaths to 8× resolution before projection, creates 14,400×14,400 polar grid (1.25 km/pixel effective resolution)
  • Output: Ultra-high-resolution polar composite

Deep Learning Architecture

SwinIR-ESRGAN Hybrid Model

The super-resolution system employs a two-component architecture combining Swin Transformer blocks with adversarial training:

Generator: SwinIR Temperature Transformer

Architecture Overview:

Input (1×H×W) → Shallow Features (60×H×W) → Deep Features (6 RSTB blocks) 
              → Feature Fusion (60×H×W) → Upsampling (2×) → Output (1×2H×2W)

1. Shallow Feature Extraction

  • Single convolutional layer: Conv2d(1 → 60, kernel=3×3, padding=1)
  • Embeds raw temperature values into 60-dimensional feature space

2. Deep Feature Extraction

Six Residual Swin Transformer Blocks (RSTB), each containing:

Swin Transformer Layer Configuration:

  • 6 layers per RSTB with alternating attention patterns
  • Window size: 8×8 pixels (optimized for thermal gradients)
  • Embedding dimension: 60 channels
  • Attention heads: 6 per layer
  • MLP expansion ratio: 4× (60 → 240 → 60)

Attention Mechanism:

  • W-MSA (Window Multi-head Self-Attention): Layers 1, 3, 5 compute attention within non-overlapping 8×8 windows
  • SW-MSA (Shifted Window Multi-head Self-Attention): Layers 2, 4, 6 shift features by 4 pixels before windowing to enable cross-window information flow

Relative Position Bias:

  • Learnable (169 × 6) bias table encoding spatial relationships
  • 169 = (2×window_size-1)² = (2×8-1)² entries per attention head
  • Provides implicit geometric awareness without positional encoding

3-Conv Residual Connection:

Conv(60→15, 3×3) → LeakyReLU → Conv(15→15, 1×1) → LeakyReLU → Conv(15→60, 3×3)

Efficient channel reduction before residual addition to main feature path.

3. Feature Fusion

  • Conv2d(60 → 60, kernel=3×3): Aggregates multi-scale features from all RSTB blocks

4. Progressive Upsampling

Conv(60→64, 3×3) → LeakyReLU → Conv(64→256, 3×3) → PixelShuffle(r=2) → 64×2H×2W

PixelShuffle rearranges 256 channels into spatial dimensions (256 = 64×2²), avoiding checkerboard artifacts common in transposed convolutions.

5. Reconstruction

  • Conv2d(64 → 1, kernel=3×3): Projects features back to temperature space

Total Parameters: ~3.7M (generator)

Discriminator: U-Net with Spectral Normalization

Encoder (downsampling):

Conv0: 1 → 64 (stride=1)
Conv1: 64 → 128 (stride=2) + SpectralNorm → H/2×W/2
Conv2: 128 → 256 (stride=2) + SpectralNorm → H/4×W/4
Conv3: 256 → 512 (stride=2) + SpectralNorm → H/8×W/8

Decoder (upsampling + skip connections):

Upsample + Conv4: 512 → 256 + skip(256) → H/4×W/4
Upsample + Conv5: 256 → 128 + skip(128) → H/2×W/2
Upsample + Conv6: 128 → 64 + skip(64) → H×W

Classification Head:

Conv7: 64 → 64 (feature refinement)
Conv8: 64 → 64 (feature refinement)
Conv9: 64 → 1 (authenticity map) → 1×H×W

Outputs per-pixel authenticity scores for patch-based discrimination.

Spectral Normalization: Constrains weight matrices by their largest singular value (W_SN = W / σ(W)), preventing gradient explosion and stabilizing GAN training by enforcing Lipschitz continuity ≤ 1.

Total Parameters: ~2.8M (discriminator)


Training Methodology

Loss Function

Combined multi-component loss function balancing pixel fidelity, perceptual quality, and adversarial realism:

L_total = 100×L_pixel + 10×L_perceptual + 1×L_GAN

Physics-Consistency Loss (Pixel-Level)

L_pixel = L1(pred, target) + λ_grad·L_gradient + λ_smooth·L_smoothness

Components:

  • L1 Loss: Preserves absolute temperature values, more robust to outliers than L2
  • Gradient Loss: Maintains sharpness at thermal boundaries by matching spatial derivatives
  • Smoothness Loss: Penalizes excessive second-order derivatives to prevent artifacts

Weights: λ_grad = 0.08, λ_smooth = 0.03

Temperature Perceptual Loss

Custom feature extractor designed for thermal data:

[Conv(1→32, 3×3) + ReLU + Conv(32→32, 3×3, stride=2)] × 4 stages

Features extracted at 4 scales (1×, 1/2×, 1/4×, 1/8×) capture hierarchical thermal patterns. L1 distance between multi-scale features preserves perceptual quality beyond pixel-wise metrics.

GAN Loss

LSGAN (Least Squares GAN) formulation:

L_G = E[(D(G(x)) - 1)²]  (generator)
L_D = E[(D(y) - 1)²] + E[D(G(x))²]  (discriminator)

Encourages realistic texture synthesis while avoiding vanishing gradients common in standard GAN objectives.

Training Configuration

  • Optimizer: AdamW (lr=1×10⁻⁴, weight_decay=1×10⁻³)
  • Schedule: Cosine annealing (T_max=100k iterations, η_min=1×10⁻⁶)
  • Mixed Precision: FP16 forward/backward, FP32 optimizer states
  • Discriminator Updates: 5:1 ratio (5 D updates per G update)
  • Warmup: 5,000 iterations discriminator pre-training
  • Gradient Clipping: Max norm = 7.0 (prevents instability in transformer layers)

Cascaded Inference Strategy

8× Enhancement Pipeline

The 2× base model is applied recursively in three stages:

Original (H×W) → [2× SR] → 2H×2W → [2× SR] → 4H×4W → [2× SR] → 8H×8W

Patch-Based Processing

For memory efficiency on large images:

1. Patch Extraction

  • Patch size: 1000×110 pixels (adjusted to be divisible by window_size × scale)
  • Overlap ratio: 75% (stride = 250×27 pixels)

2. Gaussian Weight Generation

W(y,x) = exp(-((y-H/2/(2σ_y²) + (x-W/2/(2σ_x²)))

where σ = 0.3 × patch_dimension

3. Weighted Accumulation

Output[region] = Σ(SR_patch × W) / Σ(W)

Ensures seamless reconstruction without boundary artifacts.

Cumulative Error: 0.2 K temperature drift over 8× cascading (0.07% relative error) - within sensor noise floor.


Repository Structure

SatelliteProcessor/
├── core/                          # Core processing modules
│   ├── auth_manager.py           # GPORTAL authentication
│   ├── gportal_client.py         # JAXA GPORTAL API client
│   ├── image_processor.py        # Polar projection engine
│   ├── data_handler.py           # HDF5 temperature extraction
│   ├── enhanced_processor.py     # ML enhancement wrapper
│   └── path_manager.py           # Output directory management
├── ml_models/                     # Deep learning components
│   ├── network_swinir.py         # SwinIR architecture implementation
│   ├── sr_processor.py           # Cascaded enhancement processor
│   ├── temperature_sr_model.py   # Model wrapper for inference
│   ├── data_preprocessing.py     # Temperature normalization
│   ├── config.py                 # Model hyperparameters
│   └── checkpoints/              # Trained model weights
│       └── SwinIR-RealESRGAN_net_g_60000_4th_epoch_Strong_Discriminator.pth
├── gui/                           # Desktop application interface
│   ├── main_window.py            # Main menu
│   ├── login_window.py           # Authentication dialog
│   ├── path_selector.py          # Output directory selector
│   └── function_windows.py       # Processing task dialogs
├── scripts/                       # Server-side processing scripts
│   ├── job_processor.py          # Main job queue manager
│   ├── polar_circle.py           # Polar mosaic generator
│   ├── single_strip.py           # Single-pass processor
│   ├── enhance_8x.py             # ML enhancement script
│   ├── polar_enhanced_8x.py      # Enhanced polar mosaic
│   ├── monitor_jobs.py           # Real-time job monitoring
│   └── diagnostic.py             # System health checker
├── sbatch/                        # SLURM batch scripts
│   └── process_job.sbatch        # GPU job submission template
├── utils/                         # Utility functions
│   ├── validators.py             # Input validation
│   ├── file_manager.py           # Temporary file management
│   └── device_utils.py           # Hardware detection (CUDA/MPS/DirectML)
├── config/                        # Configuration files
│   ├── credentials.txt           # GPORTAL credentials (gitignored)
│   └── output_path.txt           # Default output directory
├── main.py                        # Desktop application entry point
├── requirements.txt               # Python dependencies
└── README.md                      # This file

Installation

Prerequisites

  • Python ≥ 3.8
  • PyTorch ≥ 2.0 (with CUDA 11.8+ for GPU acceleration)
  • 8GB+ GPU memory recommended for 8× enhancement

Desktop Application

# Clone repository
git clone https://github.com/yourusername/SatelliteProcessor.git
cd SatelliteProcessor

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Download model checkpoint (if not included)
# Place SwinIR-RealESRGAN_net_g_60000_4th_epoch_Strong_Discriminator.pth 
# in ml_models/checkpoints/

# Run application
python main.py

Server Framework (HPC)

# On compute cluster
git clone https://github.com/yourusername/SatelliteProcessor.git
cd SatelliteProcessor

# Install in container or module environment
pip install -r requirements.txt

# Configure credentials
echo "your_gportal_username" > config/credentials.txt
echo "your_gportal_password" >> config/credentials.txt

# Submit test job
sbatch sbatch/process_job.sbatch

Usage

Desktop Application

  1. Launch Application: Run python main.py
  2. Authentication: Enter GPORTAL credentials (required on first launch)
  3. Set Output Directory: Select folder for saving results
  4. Choose Function:
    • Polar Circle: Full polar composite from daily passes
    • Single Strip: Individual satellite pass processing
    • 8× Enhance: ML-enhanced single pass
    • 8× Polar: ML-enhanced polar composite

Server Framework

Job Submission

Create JSON job file in jobs/pending/:

{
  "job_id": "polar_20250526_enhanced",
  "function": "polar_enhanced_8x",
  "parameters": {
    "date": "2025-05-26",
    "orbit_type": "A",
    "pole": "N",
    "credentials": {
      "username": "your_username",
      "password": "your_password"
    }
  },
  "status": "pending",
  "submitted_time": "2025-05-26T10:00:00"
}

Job Monitoring

# Real-time monitoring
python scripts/monitor_jobs.py

# Single status check
python scripts/monitor_jobs.py --once

# System diagnostics
python scripts/diagnostic.py

Output Products

Standard Processing (Functions 1-2)

File Structure:

output_directory/
├── polar_color.png                    # Turbo colormap visualization
├── polar_color_percentile.png         # 1-99 percentile filtered
├── polar_grayscale.png                # Grayscale intensity map
├── polar_grayscale_percentile.png     # Filtered grayscale
├── temperature_data.npz               # Compressed temperature array
└── metadata.json                      # Processing metadata

NPZ Contents:

data = np.load('temperature_data.npz')
temperature = data['temperature']  # Float32 array, Kelvin, NaN for missing
stats = data['stats'].item()        # Dict with min/max/mean/coverage

Enhanced Processing (Functions 3-4)

Additional Files:

├── *_enhanced_8x.npz                  # 8× enhanced temperature array
├── *_enhanced_8x_color.png            # Enhanced visualization
├── *_enhanced_8x_gray.png             # Enhanced grayscale
└── job_metadata.json                  # Enhancement statistics

Enhancement Metadata:

{
  "enhancement_stats": {
    "original": {"shape": [2000, 220], "min_temp": 245.3, "max_temp": 273.8},
    "stage_8x": {"shape": [16000, 1760], "min_temp": 245.1, "max_temp": 273.9},
    "enhancement_ratio": {"avg_preserved": 1.0002}
  }
}

Hardware Requirements

Minimum Specifications

  • CPU: 4 cores
  • RAM: 8 GB
  • Storage: 50 GB free space
  • GPU: Optional (CPU processing available)

Recommended Specifications

  • CPU: 8+ cores
  • RAM: 16+ GB
  • Storage: 200+ GB (for temporary files)
  • GPU: NVIDIA GPU with 8+ GB VRAM (RTX 3060 or better)

Supported Platforms

  • CUDA: NVIDIA GPUs (primary)
  • MPS: Apple Silicon (M1/M2/M3)
  • DirectML: Intel GPUs (experimental)
  • CPU: Fallback mode (slower)

Performance Metrics

Processing Times (NVIDIA RTX 4090)

Function Input Size Output Size Time GPU Memory
Polar Circle 23 passes 1800×1800 ~30 min 2 GB
Single Strip 2000×220 2000×220 ~8 sec 0.5 GB
8× Enhance 2000×220 16000×1760 ~38 min 6 GB
8× Polar 23 passes 14400×14400 ~100 min 8 GB

Quality Metrics

  • PSNR: 39 dB (2× stage, validated against high-resolution reference)
  • SSIM: 0.97 (structural similarity preserved)
  • Temperature Accuracy: ±0.2 K (within sensor noise specification)

Technical Details

Coordinate Systems

  • Input: WGS84 geographic coordinates (EPSG:4326)
  • Output: EASE-Grid 2.0 North (EPSG:6931) / South (EPSG:6932)
  • Projection: Lambert azimuthal equal-area
  • Grid Origin: (-9000 km, +9000 km)
  • Pixel Size: 10 km (standard) / 1.25 km (8× enhanced)

Data Specifications

  • Sensor: AMSR-2 aboard GCOM-W1 satellite
  • Channel: 36.5 GHz horizontal polarization
  • Swath Width: ~1450 km
  • Footprint: ~10 km × 6 km (along-track × cross-track)
  • Temperature Range: 50-340 K (calibrated brightness temperature)

File Formats

  • Input: HDF5 (JAXA Level 1B standard)
  • Output Arrays: NPZ (compressed NumPy format)
  • Output Images: PNG (8-bit grayscale, 24-bit RGB)
  • Metadata: JSON

Citation

If you use this software in your research, please cite:

@software{didur2025satelliteprocessor,
  author = {Didur, Volodymyr},
  title = {SatelliteProcessor: AI-Enhanced AMSR-2 Thermal Satellite Imagery System},
  year = {2025},
  publisher = {GitHub},
  url = {https://github.com/yourusername/SatelliteProcessor}
}

Related Publication:

@inproceedings{didur2025amsr2sr,
  title={Advanced Deep Learning Models for Generating Super-resolution AMSR2 Imagery in Support of Sea Ice Forecasting and Analysis},
  author={Volodymyr Didur},
  booktitle={AGU Fall Meeting 2025},
  year={2025}
}

Acknowledgments

This project builds upon several foundational works:

  • SwinIR: Liang et al., "SwinIR: Image Restoration Using Swin Transformer" (2021) - Transformer architecture for image restoration
  • Real-ESRGAN: Wang et al., "Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data" (2021) - Adversarial training framework
  • BasicSR: Xintao Wang et al., Basic SR framework for image and video restoration

AMSR-2 data provided by JAXA GCOM-W1 mission via GPORTAL data portal.


License

This project is released under the MIT License. See LICENSE file for details.


Support

For questions, bug reports, or feature requests:


Development Status

Version: 1.0.0
Status: Production
Last Updated: December 2024

Upcoming Features:

  • Multi-channel processing (additional AMSR-2 frequencies)
  • Real-time processing mode
  • Web-based interface

About

Desktop application and HPC framework for AMSR-2 thermal data. Features automated GPORTAL downloads, EASE-Grid 2.0 polar projection, and deep learning enhancement using cascaded SwinIR-ESRGAN architecture.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors