-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(website): adding code to generate figures for CEMS website
- Loading branch information
Pablo Vasconez
committed
Jul 30, 2024
1 parent
d77c9de
commit 3276db5
Showing
7 changed files
with
125 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import datetime | ||
import os | ||
from pathlib import Path | ||
|
||
import matplotlib.pyplot as plt | ||
import requests_mock | ||
from nuclei.client import NucleiClient | ||
|
||
from baec.measurements.io.zbase import measurements_from_zbase | ||
from baec.measurements.measured_settlement_series import MeasuredSettlementSeries | ||
from baec.model.fitcore import BASE_URL, FitCoreModelGenerator | ||
|
||
dirpath = Path("example/website/") | ||
if not dirpath.exists(): | ||
dirpath.mkdir(parents=True) | ||
|
||
# # Connect to the Measurements database | ||
# database = BaseTimeBucket( | ||
# credentials=Credentials(), | ||
# s3bucket="my_bucket", | ||
# ) | ||
|
||
# # Request data for a given company, project and rod_id | ||
# measurement_series = database.make_settlement_rod_measurement_series( | ||
# company="my_company", | ||
# project="my_project", | ||
# rod_id="my_rod_id", | ||
# ) | ||
|
||
|
||
# Create measurements from zbase csv file | ||
rod_id = "E990M" | ||
measurement_series = measurements_from_zbase( | ||
filepath_or_buffer=dirpath.joinpath("E990M.csv"), project_name="Example for website" | ||
) | ||
|
||
# Visualize the measurements | ||
fig = measurement_series.plot_xyz_time() | ||
# fig.set_size_inches(18.75, 7.5) | ||
fig.set_size_inches(15, 10) | ||
plt.savefig(dirpath.joinpath(f"measurements_{rod_id}.png")) | ||
|
||
|
||
# Create settlement series from measurements | ||
settlement_series = MeasuredSettlementSeries( | ||
series=measurement_series, | ||
start_date_time=datetime.datetime(2015, 1, 18), | ||
) | ||
|
||
# Visualize the settlements | ||
fig = settlement_series.plot_fill_settlement_time() | ||
fig.set_size_inches(15, 7.5) | ||
plt.savefig(dirpath.joinpath(f"settlements_{rod_id}.png")) | ||
|
||
|
||
# os.environ[ | ||
# "NUCLEI_TOKEN" | ||
# ] = ## | ||
|
||
# Fit a simple Koppejan model to the settlements | ||
model = FitCoreModelGenerator( | ||
series=settlement_series, | ||
client=NucleiClient(), | ||
) | ||
|
||
fig = model.plot_fill_settlement_time() | ||
|
||
fig.set_size_inches(15, 7.5) | ||
plt.savefig(dirpath.joinpath(f"model_fit_{rod_id}.png")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
E990M,10/30/2014,0,-0.034,-2.034,-0.950,0.000,0.000,0.000,105939.239,449028.510 | ||
E990M,11/5/2014,0,-0.066,-2.066,-0.998,0.032,-0.016,0.342,105939.190,449028.848 | ||
E990M,11/13/2014,0,-0.066,-2.066,-0.994,0.032,-0.012,0.466,105939.472,449028.914 | ||
E990M,11/21/2014,0,-0.103,-2.103,-1.018,0.069,0.001,0.549,105939.528,449028.977 | ||
E990M,12/18/2014,0,-0.135,-2.135,-0.790,0.101,0.261,0.313,105939.270,449028.199 | ||
E990M,1/7/2015,0,-0.155,-2.155,-0.861,0.121,0.210,0.171,105939.330,449028.365 | ||
E990M,1/16/2015,0,1.795,-2.205,-0.557,0.171,0.564,0.124,105939.209,449028.390 | ||
E990M,1/21/2015,0,1.736,-2.264,-0.608,0.230,0.572,0.520,105939.640,449028.179 | ||
E990M,1/28/2015,1,1.503,-2.497,-0.036,0.463,1.377,0.477,105939.703,449028.400 | ||
E990M,2/4/2015,1,3.207,-2.793,1.180,0.759,2.889,0.440,105939.512,449028.165 | ||
E990M,2/11/2015,1,2.967,-3.033,0.923,0.999,2.872,0.461,105939.584,449028.204 | ||
E990M,2/19/2015,1,2.871,-3.129,0.827,1.095,2.872,0.209,105939.338,449028.694 | ||
E990M,2/27/2015,1,2.806,-3.194,0.730,1.160,2.840,0.347,105939.535,449028.692 | ||
E990M,3/6/2015,1,2.725,-3.275,0.628,1.241,2.819,0.289,105939.405,449028.746 | ||
E990M,3/13/2015,1,2.676,-3.324,0.577,1.290,2.817,0.544,105939.716,449028.772 | ||
E990M,3/20/2015,1,2.627,-3.373,0.562,1.339,2.851,0.509,105939.608,449028.160 | ||
E990M,3/27/2015,1,2.594,-3.406,0.503,1.372,2.825,0.295,105939.405,449028.754 | ||
E990M,4/3/2015,1,2.564,-3.436,0.511,1.402,2.863,0.458,105939.602,449028.230 | ||
E990M,4/10/2015,1,2.528,-3.472,0.461,1.438,2.849,0.275,105939.345,449028.764 | ||
E990M,5/1/2015,1,2.468,-3.532,0.404,1.498,2.852,0.152,105939.343,449028.399 | ||
E990M,5/12/2015,1,2.419,-3.581,0.385,1.547,2.882,0.291,105939.520,449028.436 | ||
E990M,5/23/2015,1,2.394,-3.606,0.374,1.572,2.896,0.248,105939.444,449028.370 | ||
E990M,5/28/2015,1,2.370,-3.630,0.831,1.596,3.377,0.170,105939.404,449028.468 | ||
E990M,6/2/2015,1,2.342,-3.658,0.787,1.624,3.361,0.164,105939.397,449028.467 | ||
E990M,6/10/2015,1,2.308,-3.692,0.776,1.658,3.384,0.156,105939.395,449028.503 | ||
E990M,6/17/2015,1,2.276,-3.724,0.726,1.690,3.366,0.146,105939.384,449028.494 | ||
E990M,6/23/2015,1,2.248,-3.752,0.731,1.718,3.399,0.137,105939.371,449028.475 | ||
E990M,7/3/2015,1,2.223,-3.777,0.761,1.743,3.454,0.200,105939.430,449028.451 | ||
E990M,7/13/2015,1,2.191,-3.809,0.705,1.775,3.430,0.124,105939.342,449028.579 | ||
E990M,7/23/2015,1,2.164,-3.836,0.659,1.802,3.411,0.114,105939.350,449028.534 | ||
E990M,7/30/2015,1,2.148,-3.852,0.683,1.818,3.451,0.131,105939.366,449028.544 | ||
E990M,8/14/2015,1,2.109,-3.891,0.637,1.857,3.444,0.126,105939.352,449028.566 | ||
E990M,8/20/2015,1,2.115,-3.885,0.652,1.851,3.453,0.130,105939.363,449028.549 | ||
E990M,8/26/2015,1,2.112,-3.888,0.696,1.854,3.500,0.119,105939.349,449028.556 | ||
E990M,9/8/2015,1,2.082,-3.918,0.583,1.884,3.417,0.138,105939.356,449028.584 | ||
E990M,9/15/2015,1,2.064,-3.936,0.584,1.902,3.436,0.103,105939.337,449028.542 | ||
E990M,9/22/2015,1,2.045,-3.955,0.611,1.921,3.482,0.114,105939.342,449028.558 | ||
E990M,9/29/2015,1,2.039,-3.961,0.616,1.927,3.493,0.122,105939.349,449028.563 | ||
E990M,10/6/2015,1,2.025,-3.975,0.568,1.941,3.459,0.113,105939.341,449028.559 | ||
E990M,10/13/2015,1,2.013,-3.987,0.582,1.953,3.485,0.128,105939.353,449028.569 | ||
E990M,10/22/2015,1,2.014,-3.986,0.510,1.952,3.412,0.164,105939.329,449028.647 | ||
E990M,10/28/2015,1,2.001,-3.999,0.485,1.965,3.400,0.043,105939.256,449028.550 | ||
E990M,11/5/2015,1,2.000,-4.000,0.459,1.966,3.375,0.040,105939.253,449028.547 | ||
E990M,11/9/2015,1,1.981,-4.019,0.434,1.985,3.369,0.060,105939.221,449028.567 | ||
E990M,11/10/2015,1,2.008,-3.992,0.433,1.958,3.341,0.155,105939.295,449028.654 | ||
E990M,11/16/2015,1,1.972,-4.028,0.395,1.994,3.339,0.106,105939.199,449028.608 | ||
E990M,11/25/2015,1,1.955,-4.045,0.389,2.011,3.350,0.193,105939.204,449028.700 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters