Skip to content

Commit

Permalink
made the carbon map a include lat and lon per ip
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoldverg committed Mar 28, 2024
1 parent 6e4e75d commit 2721f50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion _version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.17'
__version__ = '1.0.18'
4 changes: 2 additions & 2 deletions pmeter/pmeter_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ def compute_carbon_per_ip(ip_df, store_format=False, save_time=False):
params=params, headers=headers)
carbon_data_json = resp.json()
carbon_intensity = carbon_data_json['carbonIntensity']
carbon_ip_map[cur_ip] = carbon_intensity
carbon_ip_map[cur_ip] = {"carbon_intensity": carbon_intensity, "lat": cur_lat, "lon": cur_long}
print(f"Lat:{cur_lat} Lon:{cur_long} IP:{cur_ip} CarbonIntensity:{carbon_intensity}")
resp_list.append(resp)
carbon_intensity_path_total = 0
for ip in carbon_ip_map:
carbon_intensity_path_total += carbon_ip_map[ip]
carbon_intensity_path_total += carbon_ip_map[ip]['carbon_intensity']
avg_carbon_network_path = carbon_intensity_path_total / len(carbon_ip_map)
print("Average Carbon cost for network path: ", avg_carbon_network_path)
carbon_ip_map['time'] = datetime.now().isoformat()
Expand Down

0 comments on commit 2721f50

Please sign in to comment.