Metadata-Version: 2.4
Name: confoundry
Version: 0.2.1
Summary: Causal explorer for droughts.
Author-email: Vytautas Jancauskas <vytautas.jancauskas@dlr.de>, Samuel Garske <samuel.garske@dlr.de>
Project-URL: Homepage, https://github.com/DLR-MF-DAS/confoundry
Project-URL: Issues, https://github.com/DLR-MF-DAS/confoundry/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pytest
Requires-Dist: click
Requires-Dist: pdoc
Requires-Dist: requests
Requires-Dist: geopandas
Requires-Dist: xarray
Requires-Dist: rioxarray
Requires-Dist: h5netcdf
Requires-Dist: h5py
Requires-Dist: netcdf4
Requires-Dist: cdsapi
Requires-Dist: dowhy
Requires-Dist: pydot
Requires-Dist: pygraphviz
Requires-Dist: cdsapi
Requires-Dist: networkx
Requires-Dist: duckdb
Requires-Dist: networkx
Requires-Dist: numba
Requires-Dist: causal-learn
Requires-Dist: lingam
Requires-Dist: plotly
Requires-Dist: PyYAML
Requires-Dist: python-dotenv
Requires-Dist: fetcheo==0.0.7
Requires-Dist: joblib
Requires-Dist: matplotlib
Requires-Dist: rasterio
Requires-Dist: requests
Requires-Dist: tqdm
Requires-Dist: scikit-learn>=1.1
Dynamic: license-file

# Confoundry

A Causal Inference framework for Earth Observation applications.

# How to Download the Data
To download geospatial time series datasets for a specific region, use the provided command-line interface (CLI):

1. **Prepare a GeoJSON file**  
	Create or obtain a GeoJSON file that defines the polygon of your region of interest (e.g., `data/california.json`).

2. **Activate your Python environment**  
	Make sure your environment is activated:
	```bash
	source .venv/bin/activate
	```

3. **Run the download command**  
	Use the following command to download data and populate the database:
	```bash
	python -m drought_causality.download_to_db \
	  --geojson_path data/california.json \
	  --db_path confoundry_db.duckdb \
	  --start_date 2014-01-01 \
	  --end_date 2014-03-31
	```
	- `--geojson_path`: Path to your GeoJSON file.
	- `--db_path`: Path to the DuckDB database file (will be created if it doesn't exist).
	- `--start_date` / `--end_date`: Date range for data download (format: YYYY-MM-DD).
	- `--location_nickname`: (Optional) Custom name for the location. Otherwise, the filename of the geojson is used by default.
	- `--downloaders`: (Optional, repeatable) Specify which data sources to download (e.g., `spei`, `era5`). If omitted, all available downloaders are used.

	Example with specific downloaders:
	```bash
	python -m drought_causality.download_to_db \
	  --geojson_path data/california.json \
	  --downloaders spei --downloaders era5
	```

4. **Output**  
	Downloaded files will be saved under `data/<location_nickname>/`, and all metadata will be recorded in the DuckDB database.


# Aridity stratification of VAR–LiNGAM effects

Run `python -m confoundry.varlingam_aridity_stratification --help` to compare
saved NDVI responses along an external aridity gradient. The module produces
publication figures, LaTeX tables, QC coverage summaries, and spatial tests.
See the [experiment guide](docs/varlingam_aridity_stratification.md) for inputs,
commands, and scientific interpretation.

# Cite this Work (TBC)
