Skip to content

Commit b086396

Browse files
committed
refactor(ElectricityMaps): unify ElectricityMaps and ElectricityMapsFree
1 parent 13e252d commit b086396

File tree

45 files changed

+53
-1380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+53
-1380
lines changed

casdk-docs/docs/architecture/c-sharp-client-library.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ The following namespaces are included:
4848

4949
There are two main classes that represents the data fetched from the data
5050
sources (i.e `Static Json`, [WattTime](https://www.watttime.org),
51-
[ElectricityMaps](https://www.electricitymaps.com), and
52-
[ElectricityMapsFree](https://www.co2signal.com/)):
51+
[ElectricityMaps](https://www.electricitymaps.com)):
5352

5453
- `EmissionsData`
5554
- `EmissionsForecast`

casdk-docs/docs/architecture/data-sources.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ sidebar_position: 3
77

88
Data sources allow developers easily integrate different data providers into the
99
carbon aware SDK ([WattTime](https://www.wattime.org),
10-
[ElectricityMaps](https://www.electricitymaps.com/),
11-
[ElectricityMapsFree](https://www.co2signal.com/) etc) to be made available to
10+
[ElectricityMaps](https://www.electricitymaps.com/), etc) to be made available to
1211
all higher-level user-interfaces (WebAPI, CLI, etc), while avoiding the details
1312
of how to interact with any specific provider.
1413

casdk-docs/docs/overview/enablement.md

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ sidebar_position: 3
1313
* SDK
1414
* Use cases
1515

16-
2. [How to Use Carbon Aware SDK](#2-how-to-use-carbon-aware-sdk)
16+
2. [How to Use Carbon Aware SDK](#2-how-to-use-carbon-aware-sdk)
1717

1818
2.1 [Pre-requisites](#21-pre-requisites)
1919
* Data sources
@@ -23,13 +23,13 @@ sidebar_position: 3
2323
* Setup
2424
* Usage
2525

26-
2.3 [WebAPI](#23-webapi)
26+
2.3 [WebAPI](#23-webapi)
2727
* Setup
2828
* Deploying with container
2929
* Deploying with Kubernetes
3030
* Usage
3131
* Calling WebAPI using CLI
32-
* Calling WebAPI using client libraries
32+
* Calling WebAPI using client libraries
3333

3434
2.4 [Configurations](#24-configurations)
3535

@@ -43,16 +43,16 @@ you different data than the WebAPI for the same query). We provide a number of
4343
different endpoints to provide the most flexibility to integrate to your
4444
environment:
4545

46-
* CLI
46+
* CLI
4747
You can run the application using the [CLI](/src/CarbonAware.CLI) and refer
48-
to more documentation [here](../tutorial-basics/carbon-aware-cli.md).
48+
to more documentation [here](../tutorial-basics/carbon-aware-cli.md).
4949

50-
* WebAPI
50+
* WebAPI
5151
You can build a container containing the [WebAPI](/src/CarbonAware.WebApi)
5252
and connect via REST requests and refer to more documentation
5353
[here](../tutorial-basics/carbon-aware-webapi.md).
5454

55-
* SDK
55+
* SDK
5656
You can reference the [Carbon Aware C# Library](/src/GSF.CarbonAware) in your
5757
projects and make use of its functionalities and features.
5858

@@ -75,7 +75,6 @@ We support various data sources of carbon aware data:
7575

7676
* [WattTime](https://www.watttime.org/)
7777
* [ElectricityMaps](https://www.electricitymaps.com/)
78-
* [ElectricityMapsFree](https://www.co2signal.com/)
7978
* JSON file
8079

8180
There are a few constraints to select data sources to some functions of
@@ -91,7 +90,7 @@ providers into the carbon aware SDK.
9190
* Alternatively:
9291
* Docker
9392
* VSCode and its [Remote Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
94-
* WebAPI
93+
* WebAPI
9594
* Docker
9695
* VSCode and its [Remote Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
9796

@@ -127,20 +126,13 @@ VSCode Remote Containers (Dev Container). To run locally:
127126
or
128127

129128
```bash
129+
export DataSources__EmissionsDataSource="ElectricityMaps"
130130
export DataSources__ForecastDataSource="ElectricityMaps"
131131
export DataSources__Configurations__ElectricityMaps__Type="ElectricityMaps"
132132
export DataSources__Configurations__ElectricityMaps__APITokenHeader="auth-token"
133133
export DataSources__Configurations__ElectricityMaps__APIToken="<YOUR_ELECTRICITYMAPS_TOKEN>"
134134
```
135135

136-
or
137-
138-
```bash
139-
export DataSources__EmissionsDataSource="ElectricityMapsFree"
140-
export DataSources__Configurations__ElectricityMapsFree__Type="ElectricityMapsFree"
141-
export DataSources__Configurations__ElectricityMapsFree__token="<CO2SIGNAL_TOKEN>"
142-
```
143-
144136
4. Run the CLI using `dotnet run`
145137

146138
The CLI will ask you to at minimum provide a `--location (-l)` parameter.
@@ -269,19 +261,13 @@ First we need to set up the GitHub repository
269261
or
270262

271263
```bash
264+
export DataSources__EmissionsDataSource="ElectricityMaps"
272265
export DataSources__ForecastDataSource="ElectricityMaps"
273266
export DataSources__Configurations__ElectricityMaps__Type="ElectricityMaps"
274267
export DataSources__Configurations__ElectricityMaps__APITokenHeader="auth-token"
275268
export DataSources__Configurations__ElectricityMaps__APIToken="<YOUR_ELECTRICITYMAPS_TOKEN>"
276269
```
277270

278-
or
279-
280-
```bash
281-
export DataSources__EmissionsDataSource="ElectricityMapsFree"
282-
export DataSources__Configurations__ElectricityMapsFree__Type="ElectricityMapsFree"
283-
export DataSources__Configurations__ElectricityMapsFree__token="<CO2SIGNAL_TOKEN>"
284-
```
285271

286272
6. In the VSCode Terminal:
287273
7. Change directory to: `cd src/CarbonAware.WebApi/src`

casdk-docs/docs/quickstart.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,13 @@ VSCode Remote Containers (Dev Container). To run locally:
5555
or
5656

5757
```bash
58+
export DataSources__EmissionsDataSource="ElectricityMaps"
5859
export DataSources__ForecastDataSource="ElectricityMaps"
5960
export DataSources__Configurations__ElectricityMaps__Type="ElectricityMaps"
6061
export DataSources__Configurations__ElectricityMaps__APITokenHeader="auth-token"
6162
export DataSources__Configurations__ElectricityMaps__APIToken="<YOUR_ELECTRICITYMAPS_TOKEN>"
6263
```
6364

64-
or
65-
66-
```bash
67-
export DataSources__EmissionsDataSource="ElectricityMapsFree"
68-
export DataSources__Configurations__ElectricityMapsFree__Type="ElectricityMapsFree"
69-
export DataSources__Configurations__ElectricityMapsFree__token="<CO2SIGNAL_TOKEN>"
70-
```
7165

7266
1. Run the CLI using `dotnet run`
7367

@@ -213,19 +207,13 @@ First we need to set up the GitHub repository
213207
or
214208

215209
```bash
210+
export DataSources__EmissionsDataSource="ElectricityMaps"
216211
export DataSources__ForecastDataSource="ElectricityMaps"
217212
export DataSources__Configurations__ElectricityMaps__Type="ElectricityMaps"
218213
export DataSources__Configurations__ElectricityMaps__APITokenHeader="auth-token"
219214
export DataSources__Configurations__ElectricityMaps__APIToken="<YOUR_ELECTRICITYMAPS_TOKEN>"
220215
```
221216

222-
or
223-
224-
```bash
225-
export DataSources__EmissionsDataSource="ElectricityMapsFree"
226-
export DataSources__Configurations__ElectricityMapsFree__Type="ElectricityMapsFree"
227-
export DataSources__Configurations__ElectricityMapsFree__token="<CO2SIGNAL_TOKEN>"
228-
```
229217

230218
6. In the VSCode Terminal:
231219
7. Change directory to: `cd src/CarbonAware.WebApi/src`

casdk-docs/docs/tutorial-basics/carbon-aware-webapi.md

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ client generation
3636
- [ElectricityMaps](#electricitymaps)
3737
- [Locations](#electricitymaps-locations)
3838
- [Exception Handling](#electricitymaps-exception-handling)
39-
- [ElectricityMapsFree](#electricitymapsfree)
40-
- [Locations](#locations)
41-
- [Exception Handling](#exception-handling)
4239

4340
## Endpoints
4441

@@ -491,9 +488,9 @@ specification
491488
dotnet build --configuration Release --no-restore
492489
dotnet tool run swagger tofile --output ./wwwroot/api/v1/swagger.yaml --yaml bin/Release/net8.0/CarbonAware.WebApi.dll v1
493490
```
494-
1. The `CarbonAware.WebApi/src/wwwroot/api/v1/swagger.yaml` file contains the supported
491+
1. The `CarbonAware.WebApi/src/wwwroot/api/v1/swagger.yaml` file contains the supported
495492
OpenApi specification.
496-
1. Use for instance [swagger editor](https://editor.swagger.io) to see and try
493+
1. Use for instance [swagger editor](https://editor.swagger.io) to see and try
497494
the endpoint routes.
498495

499496
## Data Sources
@@ -550,24 +547,3 @@ Data Source will forward the response code and message back to the caller. Refer
550547
to the
551548
[ElectricityMapsHttpClientException](../src/CarbonAware.DataSources/CarbonAware.DataSources.ElectricityMaps/src/Client/ElectricityMapsClientHttpException.cs)
552549
class for documentation on expected error codes.
553-
554-
### ElectricityMapsFree
555-
556-
#### Locations
557-
558-
Each ElectricityMapsFree emissions data point is associated with a particular
559-
named country code. While the ElectricityMapsFree endpoint supports calling with
560-
lat/long geoposition as well, the result will always be a corresponding country
561-
code.
562-
They provide a
563-
[route on their parent API (ElectricityMaps)](https://static.electricitymaps.com/api/docs/index.html#zones)
564-
which can be queried to list all the country codes you have access to given your
565-
token.
566-
567-
#### Exception Handling
568-
569-
If ElectricityMapsFree responds with a 4XX or 5XX status code the
570-
ElectricityMapsFree Data Source will forward the response code and message back
571-
to the caller. Refer to the
572-
[ElectricityMapsFreeHttpClientException](../src/CarbonAware.DataSources/CarbonAware.DataSources.ElectricityMapsFree/src/Client/ElectricityMapsFreeClientHttpException.cs)
573-
class for documentation on expected error codes.

casdk-docs/docs/tutorial-basics/containerization.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,6 @@ carbon_aware v1 6293e2528bf2 About an hour ago 230MB
4949
> carbon_aware:v1
5050
```
5151

52-
or the [ElectricityMapsFree](https://www.co2signal.com/) provider
53-
54-
```sh
55-
docker run --rm -p 8000:8080 \
56-
> -e DataSources__EmissionsDataSource="ElectricityMapsFree" \
57-
> -e DataSources__Configurations__ElectricityMapsFree__Type="ElectricityMapsFree" \
58-
> -e DataSources__Configurations__ElectricityMapsFree__token="<YOUR_CO2SIGNAL_TOKEN>" \
59-
> carbon_aware:v1
60-
```
61-
6252
1. Verify that the WebApi is responding to requests using an HTTP client tool
6353
(e.g. `postman`, `curl`)
6454

casdk-docs/docs/tutorial-extras/carbon-aware-library.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ same configuration
3030
- [ElectricityMaps](#electricitymaps)
3131
- [Locations](#locations)
3232
- [Exception Handling](#exception-handling)
33-
- [ElectricityMapsFree](#electricitymapsfree)
34-
- [Locations](#locations)
35-
- [Exception Handling](#exception-handling)
3633

3734
## EmissionsHandler Functions
3835

@@ -469,24 +466,3 @@ Data Source will forward the response code and message back to the caller. Refer
469466
to the
470467
[ElectricityMapsHttpClientException](../src/CarbonAware.DataSources/CarbonAware.DataSources.ElectricityMaps/src/Client/ElectricityMapsClientHttpException.cs)
471468
class for documentation on expected error codes.
472-
473-
### ElectricityMapsFree
474-
475-
#### Locations
476-
477-
Each ElectricityMapsFree emissions data point is associated with a particular
478-
named country code. While the ElectricityMapsFree endpoint supports calling with
479-
lat/long geoposition as well, the result will always be a corresponding country
480-
code.
481-
They provide a
482-
[route on their parent API (ElectricityMaps)](https://static.electricitymaps.com/api/docs/index.html#zones)
483-
which can be queried to list all the country codes you have access to given your
484-
token.
485-
486-
#### Exception Handling
487-
488-
If ElectricityMapsFree responds with a 4XX or 5XX status code the
489-
ElectricityMapsFree Data Source will forward the response code and message back
490-
to the caller. Refer to the
491-
[ElectricityMapsFreeHttpClientException](../src/CarbonAware.DataSources/CarbonAware.DataSources.ElectricityMapsFree/src/Client/ElectricityMapsFreeClientHttpException.cs)
492-
class for documentation on expected error codes.

casdk-docs/docs/tutorial-extras/configuration.md

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
- [BaseUrl](#baseurl)
1717
- [Emission Factor Type](#emission-factor-type)
1818
- [Disable Estimations](#disable-estimations)
19-
- [ElectricityMapsFree Configuration](#electricitymapsfree-configuration)
20-
- [API Token](#api-token)
21-
- [BaseUrl](#baseurl)
2219
- [Cache](#cache)
2320
- [CarbonAwareVars](#carbonawarevars)
2421
- [Tracing and Monitoring Configuration](#tracing-and-monitoring-configuration)
@@ -30,7 +27,6 @@
3027
- [Configuration for Emissions data Using WattTime](#configuration-for-emissions-data-using-watttime)
3128
- [Configuration for Forecast data Using ElectricityMaps](#configuration-for-forecast-data-using-electricitymaps)
3229
- [Configuration for Emissions data using ElectricityMaps and Forecast data using WattTime](#configuration-for-emissions-data-using-electricitymaps-and-forecast-data-using-watttime)
33-
- [Configuration for Emissions data using ElectricityMapsFree and Forecast data using WattTime](#configuration-for-emissions-data-using-electricitymapsfree-and-forecast-data-using-watttime)
3430
- [Configuration For Emissions data Using JSON](#configuration-for-emissions-data-using-json)
3531
- [Configuration Using WattTime and Defined Location Source Files](#configuration-using-watttime-and-defined-location-source-files)
3632

@@ -296,44 +292,6 @@ See the
296292
[ElectricityMaps API Documentation](https://static.electricitymaps.com/api/docs/index.html#estimations)
297293
for more details.
298294

299-
### ElectricityMapsFree Configuration
300-
301-
If using the ElectricityMapsFree data source, ElectricityMapsFree configuration
302-
is required.
303-
304-
**With an account token:**
305-
306-
> **NOTE** The ElectricityMapsFree API does not currently support access to
307-
> historical forecasts. This means that functionality such as the CLI
308-
> `emissions-forecasts` > `--requested-at` flag and the API `/forecasts/batch` >
309-
> `requestedAt` input will respond with a `NotImplemented` error.
310-
>
311-
> The ElectricityMapsFree API also does not currently support access to
312-
> historical emissions data. It only supports getting the single latest
313-
> emissions data point for the given location.
314-
>
315-
> If either of these restrictions are an issue, a data source that has support
316-
> for historical forecasts, such as [WattTime](#watttime-configuration) or
317-
> historical emissions, such as
318-
> [ElectricityMaps](#electricitymaps-configuration) may be preferable.
319-
320-
```json
321-
{
322-
"token": "<api-token>",
323-
"baseUrl": "https://api.co2signal.com/v1/"
324-
}
325-
```
326-
327-
#### API Token
328-
329-
The ElectricityMapsFree token you receive with your account.
330-
331-
#### BaseUrl
332-
333-
The url to use when connecting to ElectricityMapsFree. Defaults to
334-
"https://api.co2signal.com/v1/" but can be overridden in the config if needed
335-
(such as to enable integration testing scenarios).
336-
337295
## Cache
338296

339297
Frequent access to data sources could cause problems such as performance trouble
@@ -434,7 +392,7 @@ The scraping endpoint is `<ROOT_PATH>/metrics` like this:
434392
http://localhost/metrics
435393
```
436394

437-
By default, the exposed data are latest ones within last 24 hours. If you would like to change the period
395+
By default, the exposed data are latest ones within last 24 hours. If you would like to change the period
438396
in some reasones, you can configure the value like this:
439397

440398
```json
@@ -613,28 +571,6 @@ DataSources__Configurations__WattTime__Password="wattTimePassword"
613571
}
614572
```
615573

616-
## Configuration for Emissions data using ElectricityMapsFree and Forecast data using WattTime
617-
618-
```json
619-
"DataSources": {
620-
"EmissionsDataSource": "ElectricityMapsFree",
621-
"ForecastDataSource": "WattTime",
622-
"Configurations": {
623-
"WattTime": {
624-
"Type": "WattTime",
625-
"Username": "username",
626-
"Password": "password",
627-
"BaseURL": "https://api2.watttime.org/v2/",
628-
},
629-
"ElectricityMapsFree": {
630-
"Type": "ElectricityMapsFree",
631-
"token": "token",
632-
"BaseURL": "https://api.co2signal.com/v1/"
633-
}
634-
}
635-
}
636-
```
637-
638574
### Configuration For Emissions data Using JSON
639575

640576
```json

casdk-docs/docs/tutorial-extras/containerization.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,6 @@ carbon_aware v1 6293e2528bf2 About an hour ago 230MB
4949
> carbon_aware:v1
5050
```
5151

52-
or the [ElectricityMapsFree](https://www.co2signal.com/) provider
53-
54-
```sh
55-
docker run --rm -p 8000:80 \
56-
> -e DataSources__EmissionsDataSource="ElectricityMapsFree" \
57-
> -e DataSources__Configurations__ElectricityMapsFree__Type="ElectricityMapsFree" \
58-
> -e DataSources__Configurations__ElectricityMapsFree__token="<YOUR_CO2SIGNAL_TOKEN>" \
59-
> carbon_aware:v1
60-
```
61-
6252
1. Verify that the WebApi is responding to requests using an HTTP client tool
6353
(e.g. `postman`, `curl`)
6454

0 commit comments

Comments
 (0)