MOUNTAINOUS SURFACE REFLECTANCE ESTIMATION (U-NET + ATTENTION)
==============================================================

1. OVERVIEW
-----------
This script estimates surface reflectance in mountainous areas using a deep learning
model (U-Net with Spectral and Spatial Attention). It takes Top-of-Atmosphere (TOA)
radiance and topographic factors to predict accurate reflectance, automatically 
correcting for shadow and slope effects.

2. REQUIREMENTS
---------------
- Python 3.8+
- Libraries: torch, numpy, rasterio
- Hardware: GPU (CUDA) recommended; supports CPU.

3. INPUT DATA SPECIFICATIONS
----------------------------
A. Main Input Image (GeoTIFF, 20 Bands):
   The input file must follow this specific band order:
   - Band 0-6  : Landsat Official Surface Reflectance (Reserved, ignored during inference)
   - Band 7    : Quality Assessment (Ignored)
   - Band 8-14 : Landsat TOA Radiance (Main Model Input)
   - Band 15   : Solar Zenith Angle (scaled by 100)
   - Band 16   : Solar Azimuth Angle (scaled by 100)
   - Band 17   : DEM (Elevation)
   - Band 18   : Slope (scaled by 100)
   - Band 19   : Aspect (in radian, scaled by 100)

B. Shadow Mask:
   - Location: Must be in the same directory as the input file.
   - Filename: "shadow_{input_filename}.tif"
   - Value: 1 = Shadow, 0 = Non-shadow.

4. OUTPUT DATA
--------------
- Format: GeoTIFF (7 Bands).
- Content: Estimated Surface Reflectance corresponding to input spectral bands.
- Data Type: Int16.
- Scale Factor: 10,000 (Values are multiplied by 10,000. Divide by 10,000 to get 0-1 range).
- Invalid Pixels: Set to 0.

5. HOW TO RUN
-------------
1. Place the model weight file ("unet_attention_model_combine.pth") in the script directory.
2. Open the script and update the "INPUT_FILE" path to point to your .tif file.
3. Run command: python main.py

6. MODEL DETAILS
----------------
- Architecture: Modified U-Net with Encoder-Decoder structure.
- Key Modules: 
  - Spectral Attention (Encoder)
  - PSPModule & SEBlock (Bottleneck)
  - Spatial Attention (Decoder)