pymountain


Namepymountain JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
Summary功能强大、高度模块化的Python软件包,专注于山体地形数据的可视化 | A powerful, highly modular Python package focused on mountain terrain data visualization
upload_time2025-08-08 06:15:19
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords terrain visualization 3d contour mountain gis matplotlib
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyMountain 🏔️

**A powerful and flexible Python library for mountain terrain data visualization**

[![Python Version](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://python.org)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)](#)
[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](#)

## 🌟 Features

### 🎯 Core Features
- **Multiple visualization methods**
  - 3D surface rendering
  - Contour maps
  - Scatter plots
  - Custom renderers

- **Flexible data processing**
  - Multiple data format support
  - Data interpolation and smoothing
  - Statistical analysis features
  - Data import/export

- **Highly customizable**
  - Custom color mapping
  - Configurable rendering parameters
  - Plugin-based architecture
  - Theme and style system

### 🚀 Performance Advantages
- **Efficient rendering**
- **Memory optimization**
- **Large dataset support**
- **Parallel processing**

## 📦 Installation

### Install with pip
```bash
pip install pymountain
```

### Install from source
```bash
git clone https://github.com/yourusername/pymountain.git
cd pymountain
pip install -e .
```

### Development installation
```bash
git clone https://github.com/yourusername/pymountain.git
cd pymountain
pip install -e ".[dev]"
```

## 🚀 Quick Start

### Create your first mountain in 30 seconds

```python
from pymountain import quick_render

# Define mountain peak data points (x, y, elevation)
points = [
    (0, 0, 1000),    # Peak
    (1, 0, 800),     # East side
    (-1, 0, 800),    # West side
    (0, 1, 750),     # North side
    (0, -1, 750),    # South side
]

# Complete 3D visualization in one line!
renderer = quick_render(points, renderer_type="3d", title="My First Mountain")
renderer.show()
```

### More detailed usage

```python
from pymountain import MountainData, Matplotlib3DRenderer

# Create data object
data = MountainData()

# Add data points
data.add_point(0, 0, 1000, metadata={'name': 'Main Peak'})
data.add_point(1, 1, 800, metadata={'name': 'Secondary Peak'})
data.add_point(-1, -1, 600, metadata={'name': 'Small Peak'})

# Create renderer
renderer = Matplotlib3DRenderer(
    config={
        'title': 'Mountain Terrain Map',
        'colormap': 'terrain',
        'figure_size': (12, 8)
    }
)

# Render and display
fig = renderer.render(data)
renderer.show()

# Save image
renderer.save_figure('my_mountain.png')
```

## 📚 Documentation and Examples

### 📖 Example Code

We provide rich example code to help you get started quickly:

```bash
# Quick start example
python examples/quick_start.py

# Basic usage example
python examples/basic_usage.py

# Advanced features example
python examples/advanced_usage.py
```

### 🎓 Learning Path

1. **Beginners**: Start with `examples/quick_start.py`
2. **Intermediate**: Learn `examples/basic_usage.py`
3. **Advanced**: Explore `examples/advanced_usage.py`

## 🛠️ API Reference

### Core Classes

#### `MountainData`
Mountain data management class

```python
from pymountain import MountainData

data = MountainData()
data.add_point(x, y, elevation, metadata={})
data.get_bounds()  # Get data bounds
data.get_elevation_stats()  # Get elevation statistics
```

#### `BaseRenderer`
Base renderer class

```python
from pymountain import Matplotlib3DRenderer

renderer = Matplotlib3DRenderer(config={
    'title': 'Title',
    'colormap': 'terrain',
    'figure_size': (10, 8)
})
```

### Renderer Types

| Renderer | Description | Use Case |
|----------|-------------|----------|
| `Matplotlib3DRenderer` | 3D surface rendering | 3D terrain display |
| `MatplotlibContourRenderer` | Contour rendering | Terrain analysis |
| `MatplotlibRenderer` | General renderer | Custom visualization |

### Utility Functions

#### Interpolation Functions
```python
from pymountain.utils import (
    linear_interpolation,
    cubic_interpolation,
    rbf_interpolation
)

# Linear interpolation
zi = linear_interpolation(x, y, z, xi, yi)
```

#### Color Mapping
```python
from pymountain.utils import ColorMapper, create_elevation_colormap

# Create custom color mapping
colormap = create_elevation_colormap({
    (0, 500): '#2E8B57',      # Lowland
    (500, 1000): '#DAA520',   # Hills
    (1000, 2000): '#A0522D'   # Mountains
})
```

## 🎨 Advanced Features

### Custom Color Mapping

```python
from pymountain import ColorMapper

# Create color mapper
mapper = ColorMapper()

# Define elevation band colors
elevation_colors = {
    (0, 200): '#2E8B57',      # Sea green - lowland
    (200, 600): '#DAA520',    # Golden - hills
    (600, 1000): '#A0522D',   # Sienna - mountains
    (1000, float('inf')): '#FFFFFF'  # White - snow peaks
}

colormap = mapper.create_elevation_colormap(elevation_colors)
```

### Data Interpolation

```python
from pymountain.utils import interpolate_mountain_data

# Interpolate sparse data
interpolated_data = interpolate_mountain_data(
    data, 
    method='cubic',
    grid_size=(100, 100)
)
```

### Performance Optimization

```python
# Large dataset processing recommendations
data = MountainData()

# Use batch addition
points = [(x, y, z) for x, y, z in large_dataset]
data.add_points_batch(points)

# Use data sampling
sampled_data = data.sample(max_points=1000)
```

## 📊 Supported Data Formats

### Input Formats
- **NumPy arrays**: `(x, y, z)` coordinates
- **Pandas DataFrame**: DataFrame with coordinate columns
- **JSON files**: Structured terrain data
- **CSV files**: Comma-separated coordinate data
- **Python lists**: `[(x1, y1, z1), (x2, y2, z2), ...]`

### Output Formats
- **Image files**: PNG, JPG, SVG, PDF
- **Data files**: JSON, CSV, NumPy (.npz)
- **Interactive charts**: HTML (via Plotly)

## 🔧 Configuration Options

### Renderer Configuration

```python
config = {
    # Basic settings
    'title': 'Mountain Terrain Map',
    'figure_size': (12, 8),
    'dpi': 300,
    
    # Color settings
    'colormap': 'terrain',
    'color_levels': 20,
    
    # 3D settings
    'elevation_angle': 30,
    'azimuth_angle': 45,
    'surface_alpha': 0.8,
    
    # Contour settings
    'contour_levels': 15,
    'filled_contours': True,
    'show_contour_lines': True,
    
    # Data point settings
    'show_data_points': True,
    'point_size': 50,
    'point_color': 'red'
}
```

## 🧪 Testing

Run test suite:

```bash
# Run all tests
pytest

# Run specific tests
pytest tests/test_core.py

# Generate coverage report
pytest --cov=pymountain
```

## 🤝 Contributing

We welcome all forms of contributions!

### How to Contribute

1. **Fork** this repository
2. **Create** a feature branch
   ```bash
   git checkout -b feature/amazing-feature
   ```
3. **Commit** your changes
   ```bash
   git commit -m 'Add some amazing feature'
   ```
4. **Push** to the branch
   ```bash
   git push origin feature/amazing-feature
   ```
5. **Open** a Pull Request

### Development Guidelines

- Follow PEP 8 code style
- Add appropriate tests
- Update documentation
- Ensure all tests pass

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 🙏 Acknowledgments

- Thanks to all contributors
- Built on excellent open source libraries:
  - [NumPy](https://numpy.org/) - Numerical computing
  - [Matplotlib](https://matplotlib.org/) - Data visualization
  - [SciPy](https://scipy.org/) - Scientific computing

## 📞 Support

- **Documentation**: [Online Documentation](https://pymountain.readthedocs.io/)
- **Issue Reports**: [GitHub Issues](https://github.com/yourusername/pymountain/issues)
- **Discussions**: [GitHub Discussions](https://github.com/yourusername/pymountain/discussions)
- **Email**: support@pymountain.org

## 🗺️ Roadmap

### v1.1 (Planned)
- [ ] Interactive 3D visualization
- [ ] More renderer support
- [ ] Performance optimization
- [ ] Mobile support

### v1.2 (Future)
- [ ] Real-time data streaming
- [ ] Machine learning integration
- [ ] Cloud rendering service
- [ ] VR/AR support

---

**Start your mountain visualization journey! 🏔️**

[⬆ Back to top](#pymountain-🏔️)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pymountain",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "terrain, visualization, 3d, contour, mountain, gis, matplotlib",
    "author": null,
    "author_email": "Miraitowa <2056978412@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/15/e5/1d8f6852a31ae4a930658900427c183b0e34f10cccb76266a80441a1b937/pymountain-0.1.0.tar.gz",
    "platform": null,
    "description": "# PyMountain \ud83c\udfd4\ufe0f\r\n\r\n**A powerful and flexible Python library for mountain terrain data visualization**\r\n\r\n[![Python Version](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://python.org)\r\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\r\n[![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)](#)\r\n[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](#)\r\n\r\n## \ud83c\udf1f Features\r\n\r\n### \ud83c\udfaf Core Features\r\n- **Multiple visualization methods**\r\n  - 3D surface rendering\r\n  - Contour maps\r\n  - Scatter plots\r\n  - Custom renderers\r\n\r\n- **Flexible data processing**\r\n  - Multiple data format support\r\n  - Data interpolation and smoothing\r\n  - Statistical analysis features\r\n  - Data import/export\r\n\r\n- **Highly customizable**\r\n  - Custom color mapping\r\n  - Configurable rendering parameters\r\n  - Plugin-based architecture\r\n  - Theme and style system\r\n\r\n### \ud83d\ude80 Performance Advantages\r\n- **Efficient rendering**\r\n- **Memory optimization**\r\n- **Large dataset support**\r\n- **Parallel processing**\r\n\r\n## \ud83d\udce6 Installation\r\n\r\n### Install with pip\r\n```bash\r\npip install pymountain\r\n```\r\n\r\n### Install from source\r\n```bash\r\ngit clone https://github.com/yourusername/pymountain.git\r\ncd pymountain\r\npip install -e .\r\n```\r\n\r\n### Development installation\r\n```bash\r\ngit clone https://github.com/yourusername/pymountain.git\r\ncd pymountain\r\npip install -e \".[dev]\"\r\n```\r\n\r\n## \ud83d\ude80 Quick Start\r\n\r\n### Create your first mountain in 30 seconds\r\n\r\n```python\r\nfrom pymountain import quick_render\r\n\r\n# Define mountain peak data points (x, y, elevation)\r\npoints = [\r\n    (0, 0, 1000),    # Peak\r\n    (1, 0, 800),     # East side\r\n    (-1, 0, 800),    # West side\r\n    (0, 1, 750),     # North side\r\n    (0, -1, 750),    # South side\r\n]\r\n\r\n# Complete 3D visualization in one line!\r\nrenderer = quick_render(points, renderer_type=\"3d\", title=\"My First Mountain\")\r\nrenderer.show()\r\n```\r\n\r\n### More detailed usage\r\n\r\n```python\r\nfrom pymountain import MountainData, Matplotlib3DRenderer\r\n\r\n# Create data object\r\ndata = MountainData()\r\n\r\n# Add data points\r\ndata.add_point(0, 0, 1000, metadata={'name': 'Main Peak'})\r\ndata.add_point(1, 1, 800, metadata={'name': 'Secondary Peak'})\r\ndata.add_point(-1, -1, 600, metadata={'name': 'Small Peak'})\r\n\r\n# Create renderer\r\nrenderer = Matplotlib3DRenderer(\r\n    config={\r\n        'title': 'Mountain Terrain Map',\r\n        'colormap': 'terrain',\r\n        'figure_size': (12, 8)\r\n    }\r\n)\r\n\r\n# Render and display\r\nfig = renderer.render(data)\r\nrenderer.show()\r\n\r\n# Save image\r\nrenderer.save_figure('my_mountain.png')\r\n```\r\n\r\n## \ud83d\udcda Documentation and Examples\r\n\r\n### \ud83d\udcd6 Example Code\r\n\r\nWe provide rich example code to help you get started quickly:\r\n\r\n```bash\r\n# Quick start example\r\npython examples/quick_start.py\r\n\r\n# Basic usage example\r\npython examples/basic_usage.py\r\n\r\n# Advanced features example\r\npython examples/advanced_usage.py\r\n```\r\n\r\n### \ud83c\udf93 Learning Path\r\n\r\n1. **Beginners**: Start with `examples/quick_start.py`\r\n2. **Intermediate**: Learn `examples/basic_usage.py`\r\n3. **Advanced**: Explore `examples/advanced_usage.py`\r\n\r\n## \ud83d\udee0\ufe0f API Reference\r\n\r\n### Core Classes\r\n\r\n#### `MountainData`\r\nMountain data management class\r\n\r\n```python\r\nfrom pymountain import MountainData\r\n\r\ndata = MountainData()\r\ndata.add_point(x, y, elevation, metadata={})\r\ndata.get_bounds()  # Get data bounds\r\ndata.get_elevation_stats()  # Get elevation statistics\r\n```\r\n\r\n#### `BaseRenderer`\r\nBase renderer class\r\n\r\n```python\r\nfrom pymountain import Matplotlib3DRenderer\r\n\r\nrenderer = Matplotlib3DRenderer(config={\r\n    'title': 'Title',\r\n    'colormap': 'terrain',\r\n    'figure_size': (10, 8)\r\n})\r\n```\r\n\r\n### Renderer Types\r\n\r\n| Renderer | Description | Use Case |\r\n|----------|-------------|----------|\r\n| `Matplotlib3DRenderer` | 3D surface rendering | 3D terrain display |\r\n| `MatplotlibContourRenderer` | Contour rendering | Terrain analysis |\r\n| `MatplotlibRenderer` | General renderer | Custom visualization |\r\n\r\n### Utility Functions\r\n\r\n#### Interpolation Functions\r\n```python\r\nfrom pymountain.utils import (\r\n    linear_interpolation,\r\n    cubic_interpolation,\r\n    rbf_interpolation\r\n)\r\n\r\n# Linear interpolation\r\nzi = linear_interpolation(x, y, z, xi, yi)\r\n```\r\n\r\n#### Color Mapping\r\n```python\r\nfrom pymountain.utils import ColorMapper, create_elevation_colormap\r\n\r\n# Create custom color mapping\r\ncolormap = create_elevation_colormap({\r\n    (0, 500): '#2E8B57',      # Lowland\r\n    (500, 1000): '#DAA520',   # Hills\r\n    (1000, 2000): '#A0522D'   # Mountains\r\n})\r\n```\r\n\r\n## \ud83c\udfa8 Advanced Features\r\n\r\n### Custom Color Mapping\r\n\r\n```python\r\nfrom pymountain import ColorMapper\r\n\r\n# Create color mapper\r\nmapper = ColorMapper()\r\n\r\n# Define elevation band colors\r\nelevation_colors = {\r\n    (0, 200): '#2E8B57',      # Sea green - lowland\r\n    (200, 600): '#DAA520',    # Golden - hills\r\n    (600, 1000): '#A0522D',   # Sienna - mountains\r\n    (1000, float('inf')): '#FFFFFF'  # White - snow peaks\r\n}\r\n\r\ncolormap = mapper.create_elevation_colormap(elevation_colors)\r\n```\r\n\r\n### Data Interpolation\r\n\r\n```python\r\nfrom pymountain.utils import interpolate_mountain_data\r\n\r\n# Interpolate sparse data\r\ninterpolated_data = interpolate_mountain_data(\r\n    data, \r\n    method='cubic',\r\n    grid_size=(100, 100)\r\n)\r\n```\r\n\r\n### Performance Optimization\r\n\r\n```python\r\n# Large dataset processing recommendations\r\ndata = MountainData()\r\n\r\n# Use batch addition\r\npoints = [(x, y, z) for x, y, z in large_dataset]\r\ndata.add_points_batch(points)\r\n\r\n# Use data sampling\r\nsampled_data = data.sample(max_points=1000)\r\n```\r\n\r\n## \ud83d\udcca Supported Data Formats\r\n\r\n### Input Formats\r\n- **NumPy arrays**: `(x, y, z)` coordinates\r\n- **Pandas DataFrame**: DataFrame with coordinate columns\r\n- **JSON files**: Structured terrain data\r\n- **CSV files**: Comma-separated coordinate data\r\n- **Python lists**: `[(x1, y1, z1), (x2, y2, z2), ...]`\r\n\r\n### Output Formats\r\n- **Image files**: PNG, JPG, SVG, PDF\r\n- **Data files**: JSON, CSV, NumPy (.npz)\r\n- **Interactive charts**: HTML (via Plotly)\r\n\r\n## \ud83d\udd27 Configuration Options\r\n\r\n### Renderer Configuration\r\n\r\n```python\r\nconfig = {\r\n    # Basic settings\r\n    'title': 'Mountain Terrain Map',\r\n    'figure_size': (12, 8),\r\n    'dpi': 300,\r\n    \r\n    # Color settings\r\n    'colormap': 'terrain',\r\n    'color_levels': 20,\r\n    \r\n    # 3D settings\r\n    'elevation_angle': 30,\r\n    'azimuth_angle': 45,\r\n    'surface_alpha': 0.8,\r\n    \r\n    # Contour settings\r\n    'contour_levels': 15,\r\n    'filled_contours': True,\r\n    'show_contour_lines': True,\r\n    \r\n    # Data point settings\r\n    'show_data_points': True,\r\n    'point_size': 50,\r\n    'point_color': 'red'\r\n}\r\n```\r\n\r\n## \ud83e\uddea Testing\r\n\r\nRun test suite:\r\n\r\n```bash\r\n# Run all tests\r\npytest\r\n\r\n# Run specific tests\r\npytest tests/test_core.py\r\n\r\n# Generate coverage report\r\npytest --cov=pymountain\r\n```\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nWe welcome all forms of contributions!\r\n\r\n### How to Contribute\r\n\r\n1. **Fork** this repository\r\n2. **Create** a feature branch\r\n   ```bash\r\n   git checkout -b feature/amazing-feature\r\n   ```\r\n3. **Commit** your changes\r\n   ```bash\r\n   git commit -m 'Add some amazing feature'\r\n   ```\r\n4. **Push** to the branch\r\n   ```bash\r\n   git push origin feature/amazing-feature\r\n   ```\r\n5. **Open** a Pull Request\r\n\r\n### Development Guidelines\r\n\r\n- Follow PEP 8 code style\r\n- Add appropriate tests\r\n- Update documentation\r\n- Ensure all tests pass\r\n\r\n## \ud83d\udcc4 License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## \ud83d\ude4f Acknowledgments\r\n\r\n- Thanks to all contributors\r\n- Built on excellent open source libraries:\r\n  - [NumPy](https://numpy.org/) - Numerical computing\r\n  - [Matplotlib](https://matplotlib.org/) - Data visualization\r\n  - [SciPy](https://scipy.org/) - Scientific computing\r\n\r\n## \ud83d\udcde Support\r\n\r\n- **Documentation**: [Online Documentation](https://pymountain.readthedocs.io/)\r\n- **Issue Reports**: [GitHub Issues](https://github.com/yourusername/pymountain/issues)\r\n- **Discussions**: [GitHub Discussions](https://github.com/yourusername/pymountain/discussions)\r\n- **Email**: support@pymountain.org\r\n\r\n## \ud83d\uddfa\ufe0f Roadmap\r\n\r\n### v1.1 (Planned)\r\n- [ ] Interactive 3D visualization\r\n- [ ] More renderer support\r\n- [ ] Performance optimization\r\n- [ ] Mobile support\r\n\r\n### v1.2 (Future)\r\n- [ ] Real-time data streaming\r\n- [ ] Machine learning integration\r\n- [ ] Cloud rendering service\r\n- [ ] VR/AR support\r\n\r\n---\r\n\r\n**Start your mountain visualization journey! \ud83c\udfd4\ufe0f**\r\n\r\n[\u2b06 Back to top](#pymountain-\ud83c\udfd4\ufe0f)\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "\u529f\u80fd\u5f3a\u5927\u3001\u9ad8\u5ea6\u6a21\u5757\u5316\u7684Python\u8f6f\u4ef6\u5305\uff0c\u4e13\u6ce8\u4e8e\u5c71\u4f53\u5730\u5f62\u6570\u636e\u7684\u53ef\u89c6\u5316 | A powerful, highly modular Python package focused on mountain terrain data visualization",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/Miraitowa-la/PyMountain",
        "Issues": "https://github.com/Miraitowa-la/PyMountain/issues",
        "Repository": "https://github.com/Miraitowa-la/PyMountain"
    },
    "split_keywords": [
        "terrain",
        " visualization",
        " 3d",
        " contour",
        " mountain",
        " gis",
        " matplotlib"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9ab4902856782eb3db87dbd99a2386bd80b625692556a7375fef4fd2ab692564",
                "md5": "4384163cd8bd4c55aa557e175e2b66d8",
                "sha256": "c1634b84d33026076deb930a89adb0e98d8a0e31066b12e517ed500a2ce853ed"
            },
            "downloads": -1,
            "filename": "pymountain-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4384163cd8bd4c55aa557e175e2b66d8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 30790,
            "upload_time": "2025-08-08T06:15:17",
            "upload_time_iso_8601": "2025-08-08T06:15:17.535658Z",
            "url": "https://files.pythonhosted.org/packages/9a/b4/902856782eb3db87dbd99a2386bd80b625692556a7375fef4fd2ab692564/pymountain-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "15e51d8f6852a31ae4a930658900427c183b0e34f10cccb76266a80441a1b937",
                "md5": "11fa579ff355adc3db723fe48ec02512",
                "sha256": "0cb012d417033df8949e551cfdff233f9b5ca7bca6f3cce42da48aedd07909b3"
            },
            "downloads": -1,
            "filename": "pymountain-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "11fa579ff355adc3db723fe48ec02512",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 30878,
            "upload_time": "2025-08-08T06:15:19",
            "upload_time_iso_8601": "2025-08-08T06:15:19.413001Z",
            "url": "https://files.pythonhosted.org/packages/15/e5/1d8f6852a31ae4a930658900427c183b0e34f10cccb76266a80441a1b937/pymountain-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-08 06:15:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Miraitowa-la",
    "github_project": "PyMountain",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pymountain"
}
        
Elapsed time: 1.02735s