npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

if-electricitymaps

v0.1.2

Published

Electricity Maps plugin for Impact Framework.

Readme

Electricity Maps Carbon Intensity

Electricity Maps provides historical, real-time, and forecastsed electricity data for more than 150 countries worldwide. Electricity Maps' API is used by leading companies around the world to power carbon-aware decisions. Read more...

Overview

The ElectricityMapsCarbonIntensity plugin uses the Electricity Maps API to compute the average carbon intensity of electricity consumption for a given time period.

Electricity Maps' carbon intensity calculation follows a peer-reviewed methodology to trace back all electricity flows and calculate the carbon intensity of the electricity grid mix adjusted for electricity imports and exports. This provides the most accurate calculation of emissions from electricity consumption.

This plugin can be used to monitor or account for emissions resulting from electricity consumption. The intensity / emissions are aggregated over the duration of the event using hourly data from the API.

Prerequisites

This plugin requires a Commercial API token from Electricity Maps for authentication.

Environment Variables: Set the EMAPS_TOKEN environment variable to your API token.

EMAPS_TOKEN: <your_token>

Inputs

The plugin requires the following inputs:

  • timestamp: Timestamp of the recorded event (2021-01-01T00:00:00Z) RFC3339
  • longitude: Longitude of the software system connected to a grid (12.5683). Required if zone is not provided.
  • latitude: Latitude of the software system connected to a grid (55.6761). Required if zone is not provided.
  • zone: Zone identifier of the grid (e.g. PJM). Required if latitude and longitude are not provided.
  • duration: Duration of the recorded event in seconds (e.g. 3600 for one hour). A single event can last at most 10 days, so the maximum value of this parameter is 864000.
  • (optional) power_consumption: You can provide the average power consumption in kWh for the duration of the event. This will allow the plugin to calulate the total emissions for the event. If this input is not provided, the plugin will calculate the average carbon intensity of the grid for the duration of the event and return the value in units of gCO2eq.

Usage

In Typescript

Configure the API token environment variable before running the code.

export EMAPS_TOKEN=your_token
const plugin = ElectricityMapsCarbonIntensity();
const inputs = [
  {
    timestamp: '2024-03-18T01:36:00Z',
    longitude: 12.5683,
    latitude: 55.6761,
    duration: 3600,
  },
];
const outputs = await plugin.execute(inputs);

Manifest usage

Configure the API token environment variable before running the code.

export EMAPS_TOKEN=your_token

Example Input

name: electricitymaps-demo
description: example usage of electricitymaps model
tags:
initialize:
  plugins:
    if-electricitymaps:
      method: ElectricityMapsCarbonIntensity
      path: 'https://github.com/electricitymaps/if-electricitymaps'
tree:
  children:
    child:
      pipeline:
        compute:
          - if-electricitymaps
      inputs:
        - timestamp: '2024-03-18T01:36:00Z'
          longitude: 12.5683
          latitude: 55.6761
          duration: 3600
        - timestamp: '2024-03-18T01:36:00Z'
          longitude: 12.5683
          latitude: 55.6761
          duration: 3600
          power_consumption: 100

Outputs

The model returns the average carbon intensity of the grid for the duration of the event. If the power consumption is provided, the model will also return the total emissions for the event.

In JSON (from Typescript):

[
  {
    "carbon_intensity": 0.3,
    "unit": "kgCO2eq/kWh",
  },
  {
    "carbon_intensity": 0.3,
    "unit": "kgCO2eq",
  }
]

In YAML (from Manifest):

outputs:
  - timestamp: '2024-03-18T01:36:00Z'
    longitude: 12.5683
    latitude: 55.6761
    duration: 3600
    carbonIntensity: 64.4
    unit: gCO2eq
  - timestamp: '2024-03-18T01:36:00Z'
    longitude: 12.5683
    latitude: 55.6761
    duration: 3600
    power_consumption: 100
    carbonIntensity: 6440.000000000001
    unit: gCO2eq/kWh