Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSCore-Python-Common
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
VIPSCore-Python-Common
Compare revisions
85f2f86c0bfbcf2ec8fc20ac708335930ad5c2e4 to 177c3d3285c6faab6842742641dc6a052039b24c
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
VIPS/vipscore-python-common
Select target project
No results found
177c3d3285c6faab6842742641dc6a052039b24c
Select Git revision
Branches
main
Tags
0.1.10
0.1.5
0.1.6
0.1.7
0.1.8
0.1.9
0.2.0
0.2.1
0.2.2
0.2.3
0.2.4
v0.5
v0.5.1
v0.5.2
v0.6.0
v0.6.1
v0.6.2
v0.6.3
v0.602
v0.9
21 results
Swap
Target
VIPS/vipscore-python-common
Select target project
VIPS/vipscore-python-common
1 result
85f2f86c0bfbcf2ec8fc20ac708335930ad5c2e4
Select Git revision
Branches
main
Tags
0.1.10
0.1.5
0.1.6
0.1.7
0.1.8
0.1.9
0.2.0
0.2.1
0.2.2
0.2.3
0.2.4
v0.5
v0.5.1
v0.5.2
v0.6.0
v0.6.1
v0.6.2
v0.6.3
v0.602
v0.9
21 results
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (3)
CamelCase aliases for ModelConfiguration fields
· 7be4e630
Tor-Einar Skog
authored
2 years ago
7be4e630
Comment clarification
· 08933ab3
Tor-Einar Skog
authored
2 years ago
08933ab3
Bugfix: enabling validTimeStart to be serialized
· 177c3d32
Tor-Einar Skog
authored
2 years ago
177c3d32
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/vipscore_common/data_utils.py
+1
-1
1 addition, 1 deletion
src/vipscore_common/data_utils.py
src/vipscore_common/entities.py
+7
-4
7 additions, 4 deletions
src/vipscore_common/entities.py
with
8 additions
and
5 deletions
src/vipscore_common/data_utils.py
View file @
177c3d32
...
...
@@ -67,7 +67,7 @@ def get_dataframe_from_weather_observations(weather_observations: list, timezone
def
get_result_list_from_dataframe
(
df
:
DataFrame
):
"""
Create a list of VIPS Result objects from a dataframe
Requires timeseries as index and a column named WARNING_STATUS with INT values ranging from 0-4 (see Result class)
Requires timeseries as index and a column named WARNING_STATUS with INT values ranging from 0-4 (see
entities.
Result class)
"""
result_list
=
[]
dictframe
=
df
.
to_dict
(
orient
=
"
index
"
)
...
...
This diff is collapsed.
Click to expand it.
src/vipscore_common/entities.py
View file @
177c3d32
...
...
@@ -25,7 +25,7 @@ along with VIPSCore-Python-Common. If not, see <http://www.nibio.no/licenses/>.
from
datetime
import
datetime
from
shapely.geometry
import
Point
,
Polygon
from
pydantic
import
BaseModel
,
validator
,
constr
,
Field
from
typing
import
Any
,
Union
,
ClassVar
,
Optional
from
typing
import
Any
,
ClassVar
,
Optional
import
pytz
class
Result
(
BaseModel
):
...
...
@@ -33,7 +33,7 @@ class Result(BaseModel):
Represents a set of DSS model result values for a given point in space (Point, Polygon, MultiPolygon) and time (Period or immediate)
"""
valid_time_start
:
datetime
=
Field
(
alias
=
"
validTimeStart
"
)
valid_time_end
:
Optional
[
datetime
]
=
Field
(
alias
=
"
validTime
Start
"
)
valid_time_end
:
Optional
[
datetime
]
=
Field
(
alias
=
"
validTime
End
"
)
valid_geometry
:
Optional
[
Any
]
=
Field
(
alias
=
"
validGeometry
"
)
warning_status
:
int
=
Field
(
alias
=
"
warningStatus
"
)
all_values
:
dict
=
Field
(
alias
=
"
allValues
"
)
...
...
@@ -73,8 +73,11 @@ class Result(BaseModel):
class
ModelConfiguration
(
BaseModel
):
"""
All the input data for the model.
"""
model_id
:
constr
(
min_length
=
10
,
max_length
=
10
)
config_parameters
:
dict
model_id
:
constr
(
min_length
=
10
,
max_length
=
10
)
=
Field
(
alias
=
"
modelId
"
)
config_parameters
:
dict
=
Field
(
alias
=
"
configParameters
"
)
class
Config
:
allow_population_by_field_name
=
True
# Can we do this and still serialize the object??
def
get_config_parameter_as_date
(
self
,
param_name
:
str
,
required
=
True
)
->
datetime
:
...
...
This diff is collapsed.
Click to expand it.