Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

329 refactor joined timeseries class to allow adding fields #360

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/sphinx/user_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Before starting, make sure you have installed TEEHR and its dependencies as desc

:doc:`Grouping and Filtering </user_guide/notebooks/06_grouping_and_filtering>` :download:`(download notebook) </user_guide/notebooks/06_grouping_and_filtering.ipynb>`

:doc:`Adding calculated fields </user_guide/notebooks/08_adding_calculated_fields>` :download:`(download notebook) </user_guide/notebooks/08_adding_calculated_fields.ipynb>`
mgdenno marked this conversation as resolved.
Show resolved Hide resolved

.. toctree::
:maxdepth: 2
:hidden:
Expand All @@ -40,4 +42,5 @@ Before starting, make sure you have installed TEEHR and its dependencies as desc
Read an Evaluation from S3 </user_guide/notebooks/07_read_from_s3>
Joining Timeseries </user_guide/tutorials/joining_timeseries>
Grouping and Filtering </user_guide/notebooks/06_grouping_and_filtering>
Adding calculated fields </user_guide/notebooks/08_adding_calculated_fields>
mgdenno marked this conversation as resolved.
Show resolved Hide resolved
Metrics </user_guide/metrics/metrics>
4 changes: 2 additions & 2 deletions docs/sphinx/user_guide/notebooks/02_loading_local_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@
"source": [
"Now we have data in all the tables required to conduct an evaluation. There is one more step to do before we can start \"slicing and dicing\" the data and looking at evaluation metrics - we need to generate the `joined_timeseries` data table. The `joined_timeseries` table is essentially a materialized view that joins the `primary_timeseries` and `secondary_timeseries` based on `location_id`, `value_time`, `variable_name` and `unit_name`, adds the `location_attributes`, and adds any user defined fields.\n",
"\n",
"Here we are going to execute the `create()` method on the `joined_timeseries` table class to generate the `joined_timeseries` \"materialized view\" from the data we just loaded into the domain, location and timeseries tables. The user defined fields to be added are defined as part of the evaluation in the `[evaluation_dir]/scripts/user_defined_fields.py` Python script. Note, it is possible to skip adding any user defined fields by setting `execute_udf=False` when calling the `create()` method. Creating user defined fields can be a powerful tool to allow per-location, per-timestep fields to be added to the materialized `joined_timeseries` table. This will be covered in more detail in future lessons. For now, lets just set `execute_udf=True` and execute the `user_defined_fields.py` script."
"Here we are going to execute the `create()` method on the `joined_timeseries` table class to generate the `joined_timeseries` \"materialized view\" from the data we just loaded into the domain, location and timeseries tables. The user defined fields to be added are defined as part of the evaluation in the `[evaluation_dir]/scripts/user_defined_fields.py` Python script. Note, it is possible to skip adding any user defined fields by setting `execute_scripts=False` when calling the `create()` method. Creating user defined fields can be a powerful tool to allow per-location, per-timestep fields to be added to the materialized `joined_timeseries` table. This will be covered in more detail in future lessons. For now, lets just set `execute_scripts=True` and execute the `user_defined_fields.py` script."
]
},
{
Expand All @@ -648,7 +648,7 @@
"metadata": {},
"outputs": [],
"source": [
"ev.joined_timeseries.create(execute_udf=True)"
"ev.joined_timeseries.create(execute_scripts=True)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@
"metadata": {},
"outputs": [],
"source": [
"ev.joined_timeseries.create(execute_udf=True)"
"ev.joined_timeseries.create(execute_scripts=True)"
]
},
{
Expand Down
1,149 changes: 1,149 additions & 0 deletions docs/sphinx/user_guide/notebooks/08_adding_calculated_fields.ipynb

Large diffs are not rendered by default.

254 changes: 252 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ arch = "^7.0.0"
pandera = {extras = ["pyspark"], version = "^0.20.4"}
netcdf4 = "1.6.5"
bokeh = "^3.5.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we'll remove bokeh as a dependency in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably. I think it will still be installed but as a dep to holoviews, not directly.

hvplot = "^0.11.1"

[tool.poetry.group.test.dependencies]
pytest = "^7.4.3"
Expand Down
3 changes: 3 additions & 0 deletions src/teehr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
JoinedTimeseriesFilter
)

from teehr.models.calculated_fields.row_level import RowLevelCalculatedFields # noqa
from teehr.models.calculated_fields.timeseries_aware import TimeseriesAwareCalculatedFields # noqa

# For docs
from teehr.evaluation.tables.base_table import ( # noqa
BaseTable,
Expand Down
Loading