Skip to main content
Learn how to process your data and run turbulence intensity adjustments using TACT.

Quick Start

from tact import TACT
from tact.utils.load_data import load_data
from tact.utils.setup_processors import setup_processors

# 1. Load your data
data = load_data("your_data.csv")

# 2. Set up processors
binning_proc, ti_proc, stats_proc = setup_processors("config.json")

# 3. Process data
data = binning_proc.process(data)
data = ti_proc.process(data)

# 4. Run adjustment
tact = TACT()
results = tact.adjust(
    data=data,
    method="ss-sf",  # Recommended method
    parameters={"split": True, "config_path": "config.json"}
)

# 5. Access results
adjusted_data = results["adjusted_data"]
print(f"Adjusted {len(adjusted_data)} observations")

Step-by-Step Workflow

1

Load Data

Import your CSV file using TACT’s data loader:
from tact.utils.load_data import load_data

data = load_data("path/to/your/data.csv")
print(f"Loaded {len(data)} rows")
print(f"Columns: {data.columns.tolist()}")
What it does:
  • Reads CSV into pandas DataFrame
  • Validates column existence
  • Handles timestamps automatically
2

Set Up Processors

Create processors using your config file:
from tact.utils.setup_processors import setup_processors

binning_proc, ti_proc, stats_proc = setup_processors("config.json")
Returns three processors:
  • binning_proc: Bins data by wind speed
  • ti_proc: Calculates turbulence intensity metrics
  • stats_proc: Computes statistical summaries
3

Process Data

Apply processors to prepare data:
# Apply binning
data = binning_proc.process(data)

# Calculate TI metrics
data = ti_proc.process(data)

# Optional: Compute statistics
data = stats_proc.process(data)
Processing order matters! Always apply in this sequence:
  1. Binning first
  2. TI calculation second
  3. Statistics last (optional)
4

Run Adjustment

Choose a method and run the adjustment:
from tact import TACT

tact = TACT()
results = tact.adjust(
    data=data,
    method="ss-sf",  # or "ssws", "sswsstd", "baseline"
    parameters={
        "split": True,              # Use train/test split
        "config_path": "config.json"
    }
)
Method options:
  • ss-sf: Recommended for most cases
  • sswsstd: Dual WS+SD adjustment
  • ssws: Wind speed only
  • baseline: No adjustment (reference)
5

Access Results

Extract the adjusted data and statistics:
# Get adjusted dataset
adjusted_data = results["adjusted_data"]

# View regression results (if applicable)
if "reg_results" in results:
    print(results["reg_results"])

# Check statistics
if "all_stats" in results:
    print(results["all_stats"])

Method Selection

Parameters Guide

parameters={"split": True, "config_path": "config.json"}
What it does:
  • Splits data into training (70%) and testing (30%) sets
  • Trains regression on training data
  • Applies adjustment to test data
When to use:
  • For SS-SF, SSWS, SSWSStd methods
  • When you have sufficient data (500+ points)
  • ❌ Not needed for baseline method
When split=False:
  • Uses all data for both training and testing
  • May lead to overfitting
  • Only recommended for small datasets
parameters={"config_path": "path/to/config.json"}
Required for: All methodsWhat it contains:
  • Column name mappings
  • Binning configuration
  • Method-specific parameters
Path options:
  • Relative: "config.json" (same directory as script)
  • Absolute: "/full/path/to/config.json"
Some methods accept additional parameters:
# Example: Custom parameters (if supported)
parameters={
    "split": True,
    "config_path": "config.json",
    "custom_param": value  # Method-specific
}
Check each method’s API documentation for available parameters.

Output Structure

The adjust() method returns a dictionary with these keys:
{
    "adjusted_data": pd.DataFrame,  # Main output - adjusted dataset
    "reg_results": pd.DataFrame,    # Regression statistics (if applicable)
    "all_stats": pd.DataFrame       # Summary statistics (if applicable)
}

Adjusted Data Columns

The returned DataFrame includes original columns plus:
ColumnDescription
adjTI_RSD_TIAdjusted turbulence intensity
adjRepTI_RSD_RepTIAdjusted representative TI
RSD_adjWSAdjusted wind speed (SSWSStd only)
RSD_adjSDAdjusted std deviation (SSWSStd only)

Save Results

# Save adjusted data
adjusted_data = results["adjusted_data"]
adjusted_data.to_csv("adjusted_results.csv", index=False)
print("Saved to adjusted_results.csv")

Common Workflows

# Run one method and save results
from tact import TACT
from tact.utils.load_data import load_data
from tact.utils.setup_processors import setup_processors

# Load and process
data = load_data("data.csv")
bp, tp, sp = setup_processors("config.json")
data = bp.process(tp.process(data))

# Run SS-SF
tact = TACT()
results = tact.adjust(data, "ss-sf", {"split": True, "config_path": "config.json"})

# Save
results["adjusted_data"].to_csv("ss_sf_results.csv", index=False)

Next Steps