Skip to main content

裂缝网络分析

项目描述

文件状态 PyPI 状态 CI测试 覆盖范围 粘合剂 芝诺多

fractopo是一个 Python 模块,其中包含用于验证和分析直线和裂缝跟踪图(裂缝网络)的工具。

<图> fractopo 概述 <图说明>

fractopo 概述

</figcaption> </figure>
  • 完整文档托管在阅读文档上:

安装

pip诗歌安装仅支持基于linuxMacOS的操作系统。对于Windows使用 (ana)conda安装。

对于pip诗歌:省略 –dev 或 [dev] 进行常规安装。如果您想测试/开发或以其他方式安装所有开发 python 依赖项,请保留。

康达

  • 仅支持Windows的安装方法!

# Create new environment for fractopo (recommended)
conda env create fractopo-env
conda activate fractopo-env
# Available on conda-forge channel
conda install -c conda-forge fractopo

该模块位于PyPI上。

# Non-development installation
pip install fractopo

或在本地进行开发:

git clone https://github.com/nialov/fractopo
cd fractopo
# Omit [dev] from end if you do not want installation for development
pip install --editable .[dev]

诗歌

用法:

poetry add fractopo

对于开发:

git clone https://github.com/nialov/fractopo --depth 1
cd fractopo
poetry install

用法

fractopo有两个主要用例:

  1. 验证线纹和裂缝轨迹数据

  2. 线纹和裂缝轨迹数据分析

验证是为了确保数据对分析有效,并且是至关重要的,因为分析无法考虑轨迹之间不同类型的几何和拓扑不一致。

输入数据

读取和写入空间文件类型是在geopandas中完成的,您应该查看geopandas文档以了解更高级的读写用例:

GeoPackages 中带有跟踪和区域数据的简单示例:

import geopandas as gpd

# Trace data is in a file `traces.gpkg` in current working directory
# Area data is in a file `areas.gpkg` in current working directory
trace_data = gpd.read_file("traces.gpkg")
area_data = gpd.read_file("areas.gpkg")

跟踪验证

可以使用 验证对象验证跟踪和目标区域数据以进行进一步分析。

from fractopo import Validation

validation = Validation(
    trace_data,
    area_data,
    name="mytraces",
    allow_fix=True,
)

# Validation is done explicitly with `run_validation` method
validated_trace_data = validation.run_validation()

跟踪验证也可以作为命令行脚本访问, fractopo tracevalidate比通过 Python 调用更易于使用。请注意,fractopo的所有子命令都可以通过在fractopo之后附加它们来使用。

tracevalidate始终需要描绘跟踪数据的目标区域。

# Get full up-to-date script help

fractopo tracevalidate --help

# Basic usage example:

fractopo tracevalidate /path/to/trace_data.shp /path/to/target_area.shp\
   --output /path/to/validated_trace_data.shp

# Or with automatic saving to validated/ directory

fractopo tracevalidate /path/to/trace_data.shp /path/to/target_area.shp\
   --summary

几何和拓扑迹网络分析

追踪和目标区域数据 ( GeoDataFrames ) 被传递到 Network对象中,该对象具有用于返回和可视化追踪数据的不同参数和属性的属性和功能。

from fractopo import Network

# Initialize Network object and determine the topological branches and nodes
network = Network(
    trace_data,
    area_data,
    # Give the Network a name!
    name="mynetwork",
    # Specify whether to determine topological branches and nodes
    # (Required for almost all analysis)
    determine_branches_nodes=True,
    # Specify the snapping distance threshold to define when traces are
    # snapped to each other
    snap_threshold=0.001,
    # If the target area used in digitization is a circle, the knowledge can
    # be used in some analysis
    circular_target_area=True,
    # Analysis on traces can be done for the full inputted dataset or the
    # traces can be cropped to the target area before analysis (cropping
    # recommended)
    truncate_traces=True,
)

# Properties are easily accessible
# e.g.
network.branch_counts
network.node_counts

# Plotting is done by plot_ -prefixed methods
network.plot_trace_lengths()

网络分析也可作为命令行脚本使用,但在分析网络时建议使用 Python 界面(例如jupyter labipython )以访问所有可用的分析和绘图方法。命令行入口点在它产生的输出中是自以为是的。命令行入口点的简要示例:

fractopo network /path/to/trace_data.shp /path/to/area_data.shp\
   --name mynetwork

# Use --help to see all up-to-date arguments and help
fractopo network --help

有关更多示例和帮助,请参阅完整文档:

引用

引用这个软件:

Ovaskainen, N., Nordbäck, N., Skyttä, P. and Engström, J., 2022. A new
subsampling methodology to optimize the characterization of
two-dimensional bedrock fracture networks. Journal of Structural Geology,
p.104528.

发展

  • 突破性的变化是可能的和预期的。

fractopo的开发依赖项包括:

  • 诗歌

    • 用于处理 Python 包依赖项。

    # Use poetry run to execute poetry installed cli tools such as invoke,
    # nox and pytest.
    poetry run <cmd>
  • 做事

    • 替代Makefile的通用任务执行器

    • 了解任务依赖关系,即使按照任务之间的依赖关系确定的顺序运行任务,也可以并行运行任务。例如,requirements.txt 是运行测试的要求,因此创建 requirements.txt 的任务将始终在测试任务之前运行。

    # Tasks are defined in dodo.py
    # To list doit tasks from command line
    poetry run doit list
    # To run all tasks in parallel (recommended before pushing and/or
    # committing)
    # 8 is the number of cpu cores, change as wanted
    # -v 0 sets verbosity to very low. (Errors will always still be printed.)
    poetry run doit -n 8 -v 0
  • 氮氧化物

    • noxtox的替代品。两者都是为了创建可重现的 Python 环境来进行测试、在本地制作文档等。

    # To list available nox sessions
    # Sessions are defined in noxfile.py
    poetry run nox --list
  • 复印机

    • 复印机是一个项目模板。许多 Python 项目都遵循类似的框架来测试、创建文档以及文件和配置的整体放置。copier允许创建一个模板项目(例如https://github.com/nialov/nialov-py-template),它可以首先克隆为您自己的包的框架,其次从模板中提取更新到您已经启动的项目。

    # To pull copier update from github/nialov/nialov-py-template
    poetry run copier update
  • pytest

    • pytest是一个 Python 测试运行器。它用于运行定义的测试以检查包是否按预期执行。./tests中定义的测试 包含许多回归测试(使用 pytest-regressions完成),这使得几乎不可能向fractopo添加改变函数和方法结果的特性。

    # To run tests implemented in ./tests directory and as doctests
    # within project itself:
    poetry run pytest
  • 覆盖范围

    # To check coverage of tests
    # (Implemented as nox session!)
    poetry run nox --session test_pip
  • 狮身人面像

    • 从./docs_src中的文件创建文档。

    # To create documentation
    # (Implemented as nox session!)
    poetry run nox --session docs

非常感谢上述软件包的所有维护者!

执照

版权所有 © 2020,尼古拉斯·奥瓦斯凯宁。


项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

fractopo-0.4.0.tar.gz (102.7 kB 查看哈希)

已上传 source

内置分布

fractopo-0.4.0-py3-none-any.whl (108.4 kB 查看哈希)

已上传 py3