|
1 | | -# PyEhsa: Emerging Hot Spot Analysis in Python |
2 | | - |
3 | | -[](https://badge.fury.io/py/pyehsa) |
4 | | -[](https://pypi.org/project/pyehsa) |
5 | | -[](https://opensource.org/licenses/MIT) |
6 | | - |
7 | | -**PyEhsa** is a Python library for **Emerging Hot Spot Analysis (EHSA)** of spatio-temporal data, providing functionality similar to R's `sfdep` package. It enables researchers and analysts to identify and classify spatial-temporal patterns, emerging hotspots, and coldspots in geographic data. |
8 | | - |
9 | | -## 🚀 Key Features |
10 | | - |
11 | | -- **Emerging Hot Spot Analysis**: Identify emerging patterns in spatio-temporal data |
12 | | -- **Spatial Statistics**: Calculate Getis-Ord Gi* statistics for hotspot detection |
13 | | -- **Mann-Kendall Trend Analysis**: Detect trends in time series data |
14 | | -- **Multiple Classifications**: Comprehensive hotspot pattern classification |
15 | | -- **Visualization Tools**: Create interactive maps and plots with Folium and Plotly |
16 | | -- **Flexible Data Input**: Support for pandas DataFrames and GeoPandas GeoDataFrames |
17 | | - |
18 | | -## 📦 Installation |
19 | | - |
20 | | -```bash |
21 | | -pip install pyehsa |
22 | | -``` |
23 | | - |
24 | | -## 🔧 Requirements |
25 | | - |
26 | | -- Python 3.9+ |
27 | | -- pandas >= 2.0.0 |
28 | | -- geopandas >= 0.14.0 |
29 | | -- numpy >= 1.24.0 |
30 | | -- scipy >= 1.10.0 |
31 | | -- libpysal >= 4.9.0 |
32 | | - |
33 | | -## 📖 Quick Start |
34 | | - |
35 | | -```python |
36 | | -import pandas as pd |
37 | | -import geopandas as gpd |
38 | | -from pyehsa import EmergingHotspotAnalysis |
39 | | - |
40 | | -# Load your spatio-temporal data |
41 | | -df = pd.read_csv("your_data.csv") |
42 | | -geo = gpd.read_file("your_shapes.geojson") |
43 | | - |
44 | | -# Merge data with geometry |
45 | | -data = df.merge(geo[['region_id', 'geometry']], on='region_id') |
46 | | -data = gpd.GeoDataFrame(data, geometry='geometry') |
47 | | -data = data.set_crs(epsg=4326) |
48 | | - |
49 | | -# Convert time column to datetime |
50 | | -data['time_period'] = pd.to_datetime(data['time_period']) |
51 | | - |
52 | | -# Run Emerging Hot Spot Analysis |
53 | | -results = EmergingHotspotAnalysis.emerging_hotspot_analysis( |
54 | | - data, |
55 | | - location_col='region_id', |
56 | | - time_col='time_period', |
57 | | - value_col='value', |
58 | | - k=1, # spatial neighbors |
59 | | - nsim=199 # Monte Carlo simulations |
60 | | -) |
61 | | - |
62 | | -# View results |
63 | | -print(results['classification'].value_counts()) |
64 | | -``` |
65 | | - |
66 | | -## 📊 Example Output |
67 | | - |
68 | | -The analysis returns a DataFrame with classifications such as: |
69 | | -- **New Hot Spot**: Recently emerged statistically significant hotspots |
70 | | -- **Consecutive Hot Spot**: Hotspots that are statistically significant for multiple consecutive time periods |
71 | | -- **Oscillating Hot Spot**: Areas that are statistically significant hotspots for some periods but not others |
72 | | -- **Cold Spot**: Areas with statistically significant low values |
73 | | -- **No Pattern Detected**: Areas without statistically significant patterns |
74 | | - |
75 | | -## 🗺️ Visualization |
76 | | - |
77 | | -```python |
78 | | -from pyehsa import EhsaPlotting |
79 | | - |
80 | | -# Create interactive map |
81 | | -plotter = EhsaPlotting() |
82 | | -map_viz = plotter.plot_ehsa_map(results, 'classification') |
83 | | - |
84 | | -# Save or display |
85 | | -map_viz.save('hotspot_analysis.html') |
86 | | -``` |
87 | | - |
88 | | -## 📚 Documentation |
89 | | - |
90 | | -For detailed documentation, examples, and API reference, visit: [https://pyehsa.readthedocs.io](https://pyehsa.readthedocs.io) |
91 | | - |
92 | | -## 🤝 Contributing |
93 | | - |
94 | | -We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details. |
95 | | - |
96 | | -## 📄 Citation |
97 | | - |
98 | | -If you use PyEhsa in your research, please cite: |
99 | | - |
100 | | -```bibtex |
101 | | -@software{pyehsa2025, |
102 | | - author = {CloudWalk}, |
103 | | - title = {PyEhsa: Emerging Hot Spot Analysis in Python}, |
104 | | - year = {2025}, |
105 | | - url = {https://github.com/cloudwalk/PyEhsa} |
106 | | -} |
107 | | -``` |
108 | | - |
109 | | -## 📋 License |
110 | | - |
111 | | -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
112 | | - |
113 | | -## 🔬 Related Work |
114 | | - |
115 | | -PyEhsa is inspired by and provides similar functionality to: |
116 | | -- R's `sfdep` package for spatial dependence analysis |
117 | | -- ArcGIS's Emerging Hot Spot Analysis tool |
118 | | -- PySAL ecosystem for spatial analysis |
119 | | - |
120 | | -## 📈 Development Status |
121 | | - |
122 | | -This package is actively developed and maintained. For support, please open an issue on [GitHub Issues](https://github.com/cloudwalk/PyEhsa/issues). |
123 | | - |
124 | | ---- |
| 1 | +# PyEhsa |
| 2 | +Welcome to the PyEhsa repository. |
0 commit comments