Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
geomag-algorithms
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
ghsc
National Geomagnetism Program
geomag-algorithms
Commits
1f851918
Commit
1f851918
authored
3 years ago
by
Cain, Payton David
Browse files
Options
Downloads
Patches
Plain Diff
Raise value error with HTTPException
parent
3a9d06c9
No related branches found
No related tags found
2 merge requests
!146
Release CMO metadata to production
,
!91
Residual Calculation for Web Service
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
geomagio/api/ws/algorithms.py
+4
-8
4 additions, 8 deletions
geomagio/api/ws/algorithms.py
geomagio/residual/Reading.py
+6
-2
6 additions, 2 deletions
geomagio/residual/Reading.py
with
10 additions
and
10 deletions
geomagio/api/ws/algorithms.py
+
4
−
8
View file @
1f851918
...
...
@@ -33,11 +33,7 @@ def get_dbdt(
@router.post
(
"
/algorithms/residual
"
,
response_model
=
Reading
)
def
calculate_residual
(
reading
:
Reading
,
adjust_reference
:
bool
=
True
):
missing_types
=
reading
.
get_missing_measurement_types
()
if
len
(
missing_types
)
!=
0
:
missing_types
=
"
,
"
.
join
(
t
.
value
for
t
in
missing_types
)
raise
HTTPException
(
status_code
=
400
,
detail
=
f
"
Missing
{
missing_types
}
measurements in input reading
"
,
)
return
calculate
(
reading
=
reading
,
adjust_reference
=
adjust_reference
)
try
:
return
calculate
(
reading
=
reading
,
adjust_reference
=
adjust_reference
)
except
ValueError
as
e
:
raise
HTTPException
(
status_code
=
400
,
detail
=
str
(
e
))
This diff is collapsed.
Click to expand it.
geomagio/residual/Reading.py
+
6
−
2
View file @
1f851918
...
...
@@ -8,10 +8,14 @@ from pydantic import BaseModel
from
..
import
TimeseriesUtility
from
..TimeseriesFactory
import
TimeseriesFactory
from
.Absolute
import
Absolute
from
.Calculation
import
DECLINATION_TYPES
,
INCLINATION_TYPES
,
MARK_TYPES
from
.Measurement
import
Measurement
,
average_measurement
from
.Diagnostics
import
Diagnostics
from
.MeasurementType
import
MeasurementType
from
.MeasurementType
import
(
MeasurementType
,
DECLINATION_TYPES
,
INCLINATION_TYPES
,
MARK_TYPES
,
)
class
Reading
(
BaseModel
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment