Skip to content

Trend Analysis Module

This module includes functionalities related to trend_analysis.py code.

Overview

The trend_analysis module provides functions to gap filling and analyze trends in time series data.

Functions

1.extract_ts

Extracts time series data from the DataFrame for 5-day intervals.

Parameters

  • df: DataFrame containing the data.
  • dt_5days: List of 5-day intervals.

Returns: - Time series data and corresponding dates.

2.gapfill

Fills gaps in the time series data.

Parameters

  • ts: Time series data.
  • dates: List of dates corresponding to the time series data.
  • season_size: Size of the seasonal period.

Returns: - Filled time series data and updated dates.

3.sm_trend

Applies seasonal decomposition and trend smoothing to the time series data.

Parameters

  • ts: Time series data.
  • season_size: Size of the seasonal period.
  • seasonal_smooth: Size of the seasonal smoothing.

Returns: - Trend analysis results and column names.

4.run

Executes the trend analysis workflow for a given polygon ID.

Parameters

  • input_file: Input database file.
  • id_pol: ID of the polygon.
  • dt_5days: List of 5-day intervals.
  • season_size: Size of the seasonal period.
  • output_file: Output file path.