Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
ReferenceModel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
Models
Python
ReferenceModel
Compare revisions
5d31f837eeb08a6f8ab30be5fc0d27e2cba841e6 to 27a4750bd9e350f95c620f3a1b1c8fb143c77d82
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
VIPS/models/python/referencemodel
Select target project
No results found
27a4750bd9e350f95c620f3a1b1c8fb143c77d82
Select Git revision
Branches
main
Tags
0.1.5
0.1.6
0.2.0
0.2.1
0.2.2
0.2.3
0.2.4
0.2.5
0.2.6
10 results
Swap
Target
VIPS/models/python/referencemodel
Select target project
VIPS/models/python/referencemodel
1 result
5d31f837eeb08a6f8ab30be5fc0d27e2cba841e6
Select Git revision
Branches
main
Tags
0.1.5
0.1.6
0.2.0
0.2.1
0.2.2
0.2.3
0.2.4
0.2.5
0.2.6
10 results
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (3)
Bumping dependency of vipscommon
· 28eb78bf
Tor-Einar Skog
authored
2 years ago
28eb78bf
Adjusting to namespace in result keys
· 3a74f016
Tor-Einar Skog
authored
2 years ago
3a74f016
bump version 0.2.2 -> 0.2.3
· 27a4750b
Tor-Einar Skog
authored
2 years ago
27a4750b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pyproject.toml
+3
-3
3 additions, 3 deletions
pyproject.toml
src/vips_reference_model/reference_model.py
+6
-6
6 additions, 6 deletions
src/vips_reference_model/reference_model.py
tests/test_reference_model.py
+1
-1
1 addition, 1 deletion
tests/test_reference_model.py
with
10 additions
and
10 deletions
pyproject.toml
View file @
27a4750b
...
...
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name
=
"vips_reference_model"
version
=
"0.2.
2
"
version
=
"0.2.
3
"
description
=
"Example VIPS model, showcasing functionality"
readme
=
"README.md"
authors
=
[
{
name
=
"Tor-Einar Skog"
,
email
=
"tor-einar.skog@nibio.no"
}
]
...
...
@@ -19,7 +19,7 @@ dependencies = [
"pydantic"
,
"pytz"
,
"pandas"
,
"vipscore_common @ git+https://gitlab.nibio.no/VIPS/vipscore-python-common.git@0.2.
2
"
"vipscore_common @ git+https://gitlab.nibio.no/VIPS/vipscore-python-common.git@0.2.
3
"
]
requires-python
=
">
=
3.9
"
...
...
@@ -28,7 +28,7 @@ requires-python = ">=3.9"
dev
=
[
"bumpver"
,
"pytest"
]
[tool.bumpver]
current_version
=
"0.2.
2
"
current_version
=
"0.2.
3
"
version_pattern
=
"MAJOR.MINOR.PATCH"
commit_message
=
"bump version {old_version} -> {new_version}"
commit
=
true
...
...
This diff is collapsed.
Click to expand it.
src/vips_reference_model/reference_model.py
View file @
27a4750b
...
...
@@ -75,15 +75,15 @@ class ReferenceModel(VIPSModel):
# Calculate day degrees from sowingDate and as far as weather data goes
# Adjusting for base temperature
self
.
df
[
"
TMContrib
"
]
=
self
.
df
[
"
TM
"
].
apply
(
get_temp_adjusted_for_base
,
args
=
(
5
,))
self
.
df
[
"
WEATHER.
TMContrib
"
]
=
self
.
df
[
"
TM
"
].
apply
(
get_temp_adjusted_for_base
,
args
=
(
5
,))
# Aggregating the day degrees
self
.
df
[
"
TMDD
"
]
=
self
.
df
[
"
TMContrib
"
].
cumsum
()
self
.
df
[
"
WEATHER.
TMDD
"
]
=
self
.
df
[
"
WEATHER.
TMContrib
"
].
cumsum
()
# Adding the thresholds to the data frame
self
.
df
[
"
THRESHOLD_LOW
"
]
=
ReferenceModel
.
THRESHOLD_LOW
self
.
df
[
"
THRESHOLD_MEDIUM
"
]
=
ReferenceModel
.
THRESHOLD_MEDIUM
self
.
df
[
"
THRESHOLD_HIGH
"
]
=
ReferenceModel
.
THRESHOLD_HIGH
self
.
df
[
"
%s.
THRESHOLD_LOW
"
%
self
.
MODEL_ID
]
=
ReferenceModel
.
THRESHOLD_LOW
self
.
df
[
"
%s.
THRESHOLD_MEDIUM
"
%
self
.
MODEL_ID
]
=
ReferenceModel
.
THRESHOLD_MEDIUM
self
.
df
[
"
%s.
THRESHOLD_HIGH
"
%
self
.
MODEL_ID
]
=
ReferenceModel
.
THRESHOLD_HIGH
# For each day: check accumulated day-degrees and decide warning status
self
.
df
[
"
WARNING_STATUS
"
]
=
self
.
df
[
"
TMDD
"
].
apply
(
self
.
determine_warning_status
)
self
.
df
[
"
WARNING_STATUS
"
]
=
self
.
df
[
"
WEATHER.
TMDD
"
].
apply
(
self
.
determine_warning_status
)
#print(self.df)
result
=
get_result_list_from_dataframe
(
self
.
df
)
#print(result)
...
...
This diff is collapsed.
Click to expand it.
tests/test_reference_model.py
View file @
27a4750b
...
...
@@ -58,7 +58,7 @@ class TestReferenceModel(unittest.TestCase):
self
.
assertIsNotNone
(
result_list
)
last_result
=
result_list
[
len
(
result_list
)
-
1
]
self
.
assertIsNotNone
(
result_list
[
0
].
valid_time_start
)
self
.
assertEqual
(
555.8507083333333
,
last_result
.
get_value
(
"
TMDD
"
))
self
.
assertEqual
(
555.8507083333333
,
last_result
.
get_value
(
"
WEATHER
"
,
"
TMDD
"
))
def
test_get_model_id
(
self
):
"""
...
...
This diff is collapsed.
Click to expand it.