> ## Documentation Index
> Fetch the complete documentation index at: https://code.dcycle.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Calculate Emissions Overview

> Learn how to calculate emissions across different activities and operations

# Calculate Emissions Overview

Dcycle helps you calculate emissions across all aspects of your organization's operations. This guide explains when and how to use each calculation method.

## Emission Calculation Methods

<CardGroup cols={2}>
  <Card title="GLEC v3.0 Framework" icon="route" href="/guides/emissions/glec-tutorial">
    Complete logistics emissions reporting for carriers and shippers (GLEC v3.0 / ISO 14083)
  </Card>

  <Card title="Logistics & Shipments" icon="truck" href="/guides/emissions/logistics-tutorial">
    Calculate transport emissions following ISO 14083 standard
  </Card>

  <Card title="Fleet & Vehicles" icon="car" href="/guides/emissions/ghg-protocol-tutorial#calculating-mobile-combustion">
    Track fuel consumption and vehicle emissions
  </Card>

  <Card title="Facilities & Operations" icon="building" href="/guides/emissions/facilities-tutorial">
    Monitor energy use and on-site emissions
  </Card>

  <Card title="Supply Chain" icon="boxes-stacked" href="/guides/emissions/supply-chain-tutorial">
    Track purchased goods and supplier emissions
  </Card>
</CardGroup>

## Quick Decision Guide

Use this flowchart to determine which method to use:

```
Are you tracking...

├─ Transportation of goods?
│  └─ Use: Logistics API (ISO 14083)
│     Example: Calculating emissions of transportation and distribution of goods for a client
│
├─ Your company vehicles?
│  └─ Use: Fleet/Vehicles API
│     Example: Calculate the emissions generated by your fleet of vehicles
│
├─ Facility energy consumption?
│  └─ Use: Invoices or Facilities API
│     Example: Office electricity, warehouse heating
│
├─ Purchased products/services?
│  └─ Use: Purchases API
│     Example: Raw materials, office supplies
│
└─ Waste disposal?
   └─ Use: Wastes API
      Example: Recycling, landfill, incineration
```

## Data Requirements

Different calculation methods require different data:

### Minimum Data Required

| Method         | Essential Data              | Optional Data              |
| -------------- | --------------------------- | -------------------------- |
| **Logistics**  | Origin, destination, weight | Vehicle type, year         |
| **Fleet**      | Fuel type, quantity         | Vehicle specs, odometer    |
| **Facilities** | Energy type, consumption    | Building size, equipment   |
| **Purchases**  | Product category, amount    | Supplier, custom factors   |
| **Waste**      | Waste type, quantity        | Disposal method, treatment |

### Data Accuracy Levels

The more specific your data, the more accurate your calculations:

<Steps>
  <Step title="Level 1: Spend-Based (Lowest accuracy)">
    ```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    # Only know the cost
    purchase = {
        "category": "office_supplies",
        "spend_amount": 5000,
        "spend_currency": "EUR"
    }
    # Accuracy: ±50-100%
    ```
  </Step>

  <Step title="Level 2: Generic Activity Data">
    ```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    # Know physical quantities
    purchase = {
        "category": "paper",
        "quantity": 1000,
        "unit": "kg"
    }
    # Accuracy: ±20-40%
    ```
  </Step>

  <Step title="Level 3: Specific Product Data">
    ```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    # Know exact product and supplier
    purchase = {
        "product": "recycled_paper_A4",
        "supplier_id": "supplier-uuid",
        "quantity": 1000,
        "unit": "kg"
    }
    # Accuracy: ±10-20%
    ```
  </Step>

  <Step title="Level 4: Supplier-Verified Data (Highest accuracy)">
    ```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
    # Have supplier EPD or custom factor
    purchase = {
        "product": "recycled_paper_A4",
        "supplier_id": "supplier-uuid",
        "custom_emission_factor_id": "factor-uuid",
        "quantity": 1000,
        "unit": "kg"
    }
    # Accuracy: ±5-15%
    ```
  </Step>
</Steps>

## Common Calculation Patterns

### Pattern 1: Bulk Operations

For large datasets, use bulk upload endpoints:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Upload monthly fleet consumption
csv_url = api.get_bulk_upload_url(type="vehicle_consumptions")

# Upload CSV file
upload_csv_to_s3(csv_url, "fleet_january_2024.csv")

# Poll for results
status = api.check_upload_status(upload_id)
```

**Best for**:

* Monthly utility bills
* Fleet fuel card data
* Historical data migration

[Bulk Upload APIs →](/api-reference/introduction)

### Pattern 2: Real-Time Calculations

For instant results, use synchronous endpoints:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Calculate single shipment
result = api.calculate_shipment(
    origin="Madrid, Spain",
    destination="Barcelona, Spain",
    load=1000,
    load_unit="kg",
    toc="van_diesel"
)

# Immediate response with CO2e
print(f"Emissions: {result['co2e']} kg CO2e")
```

**Best for**:

* Quote calculators
* Route optimization
* User-facing features

### Pattern 3: Batch Processing

For scheduled jobs:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Process daily orders
for order in daily_orders:
    emissions = api.calculate_shipment(
        origin=order.warehouse,
        destination=order.customer_address,
        load=order.weight,
        # ...
    )

    # Store with order
    order.co2e = emissions['co2e']
    order.save()
```

**Best for**:

* Nightly batch jobs
* Order processing pipelines
* Scheduled reports

## Combining Multiple Sources

Most organizations need to track emissions from multiple sources:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Calculate total organizational emissions

# Scope 1: Fleet
fleet_emissions = sum(vehicle_consumptions)

# Scope 2: Purchased electricity
electricity_emissions = sum(electricity_invoices)

# Scope 3: Logistics + Purchases
logistics_emissions = sum(shipments)
purchase_emissions = sum(purchases)

# Total
total_scope1 = fleet_emissions
total_scope2 = electricity_emissions
total_scope3 = logistics_emissions + purchase_emissions

total_emissions = total_scope1 + total_scope2 + total_scope3
```

<Info>
  Dcycle's reporting endpoints can aggregate emissions automatically across all sources. See the [Logistics Reports API](/api-reference/logistics/get-report) for examples.
</Info>

## Handling Missing Data

When you don't have complete data, use these strategies:

### Strategy 1: Use Defaults

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Don't know vehicle type? Use category default
shipment = api.calculate_shipment(
    origin="Madrid",
    destination="Barcelona",
    load=1000,
    load_unit="kg",
    toc="rigid"  # Generic truck category
)
```

### Strategy 2: Estimate from Similar Activities

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Estimate office electricity from building size
invoice = {
    "type": "electricity",
    "consumption_estimate": building_sqm * 150,  # kWh/sqm/year
    "unit": "kWh",
    "period": "2024-01"
}
```

### Strategy 3: Use Industry Averages

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Use spend-based factor as last resort
purchase = {
    "category": "IT_services",
    "spend_amount": 50000,
    "spend_currency": "EUR"
    # Dcycle applies appropriate spend-based factor
}
```

### Strategy 4: Request Supplier Data

For significant emissions sources, request EPD or LCA data:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
# Once you have supplier data, create custom factor
custom_factor = api.create_custom_emission_factor(
    group_id="suppliers-2024",
    ef_name="Aluminum - Supplier ABC",
    emission_factor_values=[
        {"gas_type": "CO2", "value": 2.15},
        {"gas_type": "CH4", "value": 0.008}
    ],
    additional_docs="EPD No. ABC-2024-001"
)

# Use in future calculations
purchase = {
    "product": "aluminum_sheet",
    "custom_emission_factor_id": custom_factor.id,
    "quantity": 1000,
    "unit": "kg"
}
```

[Custom Emission Factors Guide →](/guides/advanced/custom-emission-factors)

## Validation and Quality Checks

Before submitting data, validate:

### Common Validation Checks

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
def validate_shipment_data(data):
    """Validate shipment data before submission"""

    # Check required fields
    assert data.get('origin'), "Origin is required"
    assert data.get('destination'), "Destination is required"
    assert data.get('load') > 0, "Load must be positive"

    # Sanity checks
    if data['load'] > 30000:  # 30 tons
        print("⚠️  Warning: Very heavy load, double-check")

    # Distance check (after geocoding)
    if estimated_distance < 10:  # km
        print("⚠️  Warning: Very short distance")

    return True
```

### Response Validation

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
response = api.calculate_shipment(data)

# Validate response
if response['co2e'] == 0:
    print("❌ Error: Zero emissions calculated")

if response.get('distance_km', 0) == 0:
    print("❌ Error: Zero distance calculated")

# Log for audit
log_calculation(
    input=data,
    output=response,
    timestamp=datetime.now()
)
```

## Next Steps

Choose a tutorial based on your primary use case:

<CardGroup cols={2}>
  <Card title="Logistics Tutorial" icon="truck" href="/guides/emissions/logistics-tutorial">
    Calculate transport emissions (ISO 14083)
  </Card>

  <Card title="GHG Protocol Tutorial" icon="car" href="/guides/emissions/ghg-protocol-tutorial#calculating-mobile-combustion">
    Track company vehicle emissions
  </Card>

  <Card title="Facilities Tutorial" icon="building" href="/guides/emissions/facilities-tutorial">
    Monitor facility energy and emissions
  </Card>

  <Card title="Supply Chain Tutorial" icon="boxes-stacked" href="/guides/emissions/supply-chain-tutorial">
    Track purchased goods emissions
  </Card>
</CardGroup>

## Advanced Topics

<CardGroup cols={2}>
  <Card title="Custom Emission Factors" icon="chart-line" href="/guides/advanced/custom-emission-factors">
    Use supplier-specific factors
  </Card>

  <Card title="Core Concepts" icon="book" href="/docs/core-concepts">
    Understand emission scopes and factors
  </Card>

  <Card title="Quickstart" icon="rocket" href="/docs/quickstart">
    Get your API key and start
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    Complete API documentation
  </Card>
</CardGroup>
