CoolFace
Apppublic

loboprajwal/pfz-advisory-india

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
App README

Predicting Potential Fishing Zones From Marine Data

This project uses marine data (GBIF, CMEMS) and XGBoost to predict fishing zones along the Indian coastline.# PFZ Advisory System — Indian Coastline

Clone/mirror of INCOIS WebGIS with per-species ML advisory for 15 commercial species.

Quick Start

bash
# 1. Clone / enter project
cd pfz_project

# 2. Python environment
python3 -m venv venv
source venv/bin/activate          # Windows: venv\Scripts\activate
pip install -r requirements.txt

# 3. Copy your existing files
cp /path/to/ecofish_golden.db  data/raw/cmfri/
cp /path/to/marine_species_range_shift.ipynb  notebooks/

# 4. Set environment variables
cp config/.env.example config/.env
# Edit config/.env with your API keys (see API_KEYS.md)

# 5. Run the full pipeline (first time ~2-4 hours, fetches all data)
python scripts/run_pipeline.py --species-all --year-start 2005 --year-end 2025

# 6. Start the API
uvicorn api.main:app --reload --port 8000

# 7. Start the frontend (new terminal)
cd frontend
npm install
npm run dev
# Open http://localhost:5173

Directory Structure

pfz_project/
├── README.md
├── requirements.txt
├── config/
│   ├── .env.example
│   ├── settings.py           # All config loaded here
│   └── species_config.py     # 15 target species definitions
├── pipeline/
│   ├── 01_fetch_occurrences.py   # OBIS + GBIF + iNaturalist
│   ├── 02_fetch_satellite.py     # Bio-Oracle + CMEMS SST/Chl/SSH
│   ├── 03_build_feature_grid.py  # 0.1° grid feature matrix
│   ├── 04_train_models.py        # XGBoost per species
│   ├── 05_run_inference.py       # Daily PFZ raster generation
│   └── 06_export_tiles.py        # GeoJSON + MBTiles output
├── api/
│   ├── main.py               # FastAPI app
│   └── routers/
│       ├── pfz.py            # /api/pfz/daily, /api/pfz/nodes
│       ├── species.py        # /api/species/{name}/map
│       └── catch.py          # /api/catch/history
├── frontend/
│   ├── package.json
│   └── src/
│       ├── App.jsx           # Root with Leaflet map
│       ├── components/
│       │   ├── PfzMap.jsx        # Main Leaflet map
│       │   ├── SpeciesPanel.jsx  # Left sidebar
│       │   ├── NodeMarkers.jsx   # 1223 coastal nodes
│       │   └── AdvisoryCard.jsx  # Node popup
│       └── utils/
│           └── api.js        # Fetch helpers
├── data/
│   ├── raw/
│   │   ├── occurrences/      # CSV per species from OBIS/GBIF
│   │   ├── satellite/        # NetCDF/CSV from Bio-Oracle
│   │   └── cmfri/            # ecofish_golden.db lives here
│   ├── processed/            # Merged feature matrices
│   ├── models/               # Trained XGBoost .pkl files
│   └── tiles/                # GeoJSON + MBTiles outputs
├── notebooks/
│   ├── marine_species_range_shift.ipynb   # YOUR EXISTING FILE
│   └── 02_model_training_eda.ipynb
└── scripts/
    ├── run_pipeline.py       # Orchestrator
    └── seed_incois_nodes.py  # Download 1223 node coords

API Keys Needed

ServiceFree?URL
GBIFYes (register)https://www.gbif.org/user/profile
OBISYes (no key needed)—
iNaturalistYes (no key needed)—
CMEMS (Copernicus Marine)Yes (register)https://marine.copernicus.eu
Bio-OracleYes (no key needed)—

See config/API_KEYS.md for exact steps.