Skip to main content

The bfast-ray package provides a highly-efficient parallel implementation for the `Breaks For Additive Season and Trend (BFASTmonitor) proposed by Verbesselt et al. The implementation is based on Ray

Project description

bfast-ray

image

The bfast-ray package provides a highly-efficient parallel implementation for the `Breaks For Additive Season and Trend (BFASTmonitor) proposed by Verbesselt et al. The implementation is based on Ray

This package is adapted from https://github.com/diku-dk/bfast, with credit to mortvest.

Dependencies

============

  • numpy==1.25.2
  • pandas==2.0.3
  • scikit-learn==1.3.0
  • scipy==1.11.2
  • matplotlib==3.7.2
  • wget==3.2
  • ray==2.6.1

Input args

  • start_monitor:Python 标准库中的 datetime类型的数据(用datetime库解析字符串)

  • freq: 季节性变化的观测频次。比如,监测变量NDWI是按年度变化的,采样数据是某一天的均值,那么freq就设置为365;采样数据是某一月的均值,那么freq就设置为12

  • k : 谐波级数,傅立叶分解的精度

  • hfrac: 用多少observation 来计算时间序列的 均值和方差。 moving window the比例 限制为0.25, 0.5, 1

  • trend : bool值, 是否使用offset值

  • level: 监测的明显水平(和 ROC,如果选择)过程,即概率类型 I 错误。

  • verbose: int 中间过程输不输出

  • backend: str, 'python' or 'python-ray'

  • address: str, e.g.:"ray://xxx.xx.xx.xx:xxxxx"

  • ray_remote_args: dic, e.g.: {"resources": {"customResources": 1}, "batch_size":10}

Output

breaks: 数组。 -2代表 没有充分的历史数据。 -1代表该pixel没有break 。所有其他非负数据对应于第一个在监控期间检测到的中断的索引序号

means: 每一个MOSUM 过程的mean值(例如考虑NDMI指数时,像素的正平均值对应于植被的增加,)

timers : dict 是个字典,包含拟合过程不同阶段的运行时测量值。

共三个

use example

k = 3
freq = 365
trend = False
hfrac = 0.25
level = 0.05
start_monitor = datetime(2010, 1, 1)

model = BFASTMonitor(
            start_monitor,
            freq=freq,
            k=k,
            hfrac=hfrac,
            trend=trend,
            level=level,
            # backend='python',
            backend='python-ray',
            cluster_address = "ray://xx.xx.xx.xx:xxxxx",
            ray_remote_args= {"resources": {"xxxx": xx}, "batch_size":1}
        )


model.fit(data, dates, nan_value=-32768)

breaks = model.breaks
means = model.means
timers = model.timers

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bfast-ray-0.0.4.tar.gz (28.2 kB view details)

Uploaded Source

Built Distribution

bfast_ray-0.0.4-py2.py3-none-any.whl (27.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file bfast-ray-0.0.4.tar.gz.

File metadata

  • Download URL: bfast-ray-0.0.4.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for bfast-ray-0.0.4.tar.gz
Algorithm Hash digest
SHA256 6df47242cf3bcc127e80ebdf19ed97d7f2fc8549e3154bb89c832d7ba4596494
MD5 5e9ae690a19d140d4e751864c3042e93
BLAKE2b-256 80e21e0436f65e5a784eafbfe66cbe539e2a0bbdf0ae98319713502f860707b0

See more details on using hashes here.

File details

Details for the file bfast_ray-0.0.4-py2.py3-none-any.whl.

File metadata

  • Download URL: bfast_ray-0.0.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for bfast_ray-0.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9abdb875c0615f1be0d1cae147fc69c19727c6e30cba10fbd2e214b6a5cc4b2c
MD5 c880e6bd7310234ec8ad8fdb14b57199
BLAKE2b-256 8c4bf164062f64bfba0637629aba58b6c10444b60a2c22fe018800ad008269e6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page