Skip to content

Commit

Permalink
Merge pull request #216 from microsoft/216/datasourceDocMatrix
Browse files Browse the repository at this point in the history
Datasource Selection Documentation
  • Loading branch information
vaughanknight committed Jan 10, 2023
2 parents b1a9232 + f9d75c3 commit 4ee5b41
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
9 changes: 6 additions & 3 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ If set to `WattTime` or `ElectricityMaps`, the configuration specific to that da
"ElectricityMaps": {
"Type": "ElectricityMaps",
"APITokenHeader": "auth-token",
"APIToken": "myAwesomeToken"
"APIToken": "myAwesomeToken",
"BaseURL": "https://api.electricitymap.org/v3/"
},
"Json": {
"Type": "Json",
Expand Down Expand Up @@ -374,7 +375,8 @@ DataSources__Configurations__WattTime__Password="wattTimePassword"
"ElectricityMaps": {
"Type": "ElectricityMaps",
"APITokenHeader": "auth-token",
"APIToken": "token"
"APIToken": "token",
"BaseURL": "https://api.electricitymap.org/v3/"
}
}
}
Expand All @@ -397,7 +399,8 @@ DataSources__Configurations__WattTime__Password="wattTimePassword"
"ElectricityMaps": {
"Type": "ElectricityMaps",
"APITokenHeader": "auth-token",
"APIToken": "token"
"APIToken": "token",
"BaseURL": "https://api.electricitymap.org/v3/"
}
}
}
Expand Down
37 changes: 37 additions & 0 deletions docs/selecting-a-data-source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Selecting a Data Source

The Carbon Aware SDK includes access to various data sources of carbon aware data, including WattTime, ElectricityMaps, and a custom JSON source. These matrices are an attempt to track what features of the Carbon Aware SDK are enabled for which data sources.

## Contents

- [Type of Data Sources and Configuration](#type-of-data-sources-and-configuration)
- [Data Source Methods Available](#data-source-methods-available)
- [Location Coverage](#location-coverage)

## Type of Data Sources and Configuration

In the CarbonAware SDK configuration, you can set what data source to use as the `EmissionsDataSource` and the `ForecastDataSource`. There are also certain configuration fields that must be set in order to access the raw data.
| Type | WattTime | ElectricityMaps | JSON |
|--------------------------|-----------|-----------------|------|
| Is Emissions DataSource | ✅ | ✅ | ✅ |
| Is Forecast DataSource | ✅ | ✅ | ❌ |
| Makes HTTP(s) call | ✅ | ✅ | ❌ |
| Can Use Custom Data | ❌ | ❌ | ✅ |
| Supports Trial + Full Account | ✅ | ✅ (*[different config required](./configuration.md#electricitymaps-configuration)) | N/A |

## Data Source Methods Available

Not all data sources support all the routes provided in the interfaces (`IEmissionsDataSource`/`IForecastDataSource`).

| Methods | WattTime | ElectricityMaps | JSON | CLI Usage | Web Api Usage | SDK Usage
|--------------|:-----------:|:-----------------:|:------:|:-:|:-:|:-:|
| GetCarbonIntensityAsync | ✅ | ✅ | ✅ |`emissions`|`emissions/bylocation` or `emissions/bylocations` or `emissions/bylocations/best` or `emissions/average`‑`carbon`‑`intensity` or `emissions/average`‑`carbon`‑`intensity/batch`|`GetEmissionsDataAsync(...)` or `GetBestEmissionsDataAsync(...)` or `GetAverageCarbonIntensityDataAsync(...)`|
| GetCurrentForecastAsync | ✅ | ✅ | ❌ |`emissions`‑`forecasts`|`forecasts/current`|`GetCurrentForecastAsync(...)`|
| GetForecastByDateAsync | ✅ | ❌ | ❌ |`emissions`‑`forecasts` ‑‑`requested`‑`at`|`forecasts/batch` with `requestedAt` field|`GetForecastByDateAsync(...)`|

## Location Coverage

Different data sources provide both different features (as outlined above) but also coverage of different geographic areas. It's important to note that each data source may have different region names, which are handled through the location config.

- For `WattTime`, see their [interactive coverage map](https://www.watttime.org/explorer) to find the relevant zone.
- For `ElectricityMaps`, see their [live map app](https://app.electricitymaps.com/map?utm_source=electricitymaps.com&utm_medium=website&utm_campaign=banner) to find the relevant zone and see current data coming in.

0 comments on commit 4ee5b41

Please sign in to comment.