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
c4c4855d
Commit
c4c4855d
authored
3 years ago
by
Cain, Payton David
Browse files
Options
Downloads
Patches
Plain Diff
response NaNs as null
parent
66f1bf34
No related branches found
No related tags found
3 merge requests
!166
Merge branch master into production
,
!158
Merge branch 'master' into 'production'
,
!148
Scale value error
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
geomagio/api/ws/algorithms.py
+6
-3
6 additions, 3 deletions
geomagio/api/ws/algorithms.py
geomagio/residual/Diagnostics.py
+1
-2
1 addition, 2 deletions
geomagio/residual/Diagnostics.py
with
7 additions
and
5 deletions
geomagio/api/ws/algorithms.py
+
6
−
3
View file @
c4c4855d
from
os
import
name
import
json
from
fastapi
import
APIRouter
,
Depends
,
HTTPException
from
starlette.responses
import
Response
from
...
import
TimeseriesFactory
from
...algorithm
import
DbDtAlgorithm
from
...residual
import
(
calculate
,
...
...
@@ -44,6 +44,9 @@ def get_dbdt(
)
def
calculate_residual
(
reading
:
Reading
,
adjust_reference
:
bool
=
True
):
try
:
return
calculate
(
reading
=
reading
,
adjust_reference
=
adjust_reference
)
calculated
=
calculate
(
reading
=
reading
,
adjust_reference
=
adjust_reference
).
json
()
return
json
.
loads
(
calculated
.
replace
(
"
NaN
"
,
"
null
"
))
except
ValueError
as
e
:
raise
HTTPException
(
status_code
=
400
,
detail
=
str
(
e
))
This diff is collapsed.
Click to expand it.
geomagio/residual/Diagnostics.py
+
1
−
2
View file @
c4c4855d
from
typing
import
Optional
from
.Measurement
import
Measurement
from
pydantic
import
BaseModel
...
...
@@ -14,4 +13,4 @@ class Diagnostics(BaseModel):
"""
inclination
:
float
meridian
:
float
meridian
:
Optional
[
float
]
=
None
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