Fetches the last 7 days of daily data from the FieldClimate API for a single device, then writes a CSV containing ET0 and precipitation totals. Designed for quick weekly reporting.
- Authenticates against the FieldClimate OAuth endpoint
- Requests daily data for the last 7 days for a single device
- Extracts ET0 (
disease_evapotranspiration_ETo) and precipitation (Yağış [mm]) - Writes a CSV with daily values and weekly totals
- Downloads the CSV automatically when run inside Google Colab
- Python 3.9+
- A FieldClimate account and API credentials
- A device ID for the station you want to query
- Create a virtual environment (optional but recommended)
- Install dependencies
- Configure environment variables
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtCreate a .env file in the project root:
FIELDCLIMATE_CLIENT_ID=your_client_id
FIELDCLIMATE_CLIENT_SECRET=your_client_secret
FIELDCLIMATE_USERNAME=your_username
FIELDCLIMATE_PASSWORD=your_password
FIELDCLIMATE_DEVICE_ID=your_device_idpython main.pyA CSV file named like fieldclimate_et0_yagis_YYYY-MM-DD.csv containing:
- Date
- ET0 (mm)
- Yağış (mm)
- Weekly totals row at the bottom
- If you run this outside Google Colab, the CSV will be saved locally and a message will be printed instead of auto-download.
- The script expects the API response to contain
grid.datawith the keys listed above.
- Missing credentials: ensure all
FIELDCLIMATE_*variables are set in.env. - 401/403: verify API credentials and device permissions.