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
f97d0eda
Commit
f97d0eda
authored
6 months ago
by
Wilbur, Spencer Franklin
Browse files
Options
Downloads
Plain Diff
Merge branch 'Except_204_Error_FDSN' into 'master'
204 Error Exception Handling See merge request
!339
parents
84a6f967
30cc1734
No related branches found
No related tags found
1 merge request
!339
204 Error Exception Handling
Pipeline
#489717
passed
6 months ago
Stage: init
Stage: test
Stage: integration
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
geomagio/edge/FDSNFactory.py
+38
-30
38 additions, 30 deletions
geomagio/edge/FDSNFactory.py
with
38 additions
and
30 deletions
geomagio/edge/FDSNFactory.py
+
38
−
30
View file @
f97d0eda
...
...
@@ -256,14 +256,12 @@ class FDSNFactory(TimeseriesFactory):
endtime
=
endtime
+
half_delta
,
attach_response
=
True
,
)
except
FDSNNoDataException
:
data
=
Stream
()
data
.
merge
()
if
channel
in
channel_rotations
:
data
=
self
.
_rotate_and_return_requested_channel
(
data
,
sncl
,
starttime
,
endtime
,
channel
)
if
data
.
count
()
==
0
and
add_empty_channels
:
data
+=
self
.
_get_empty_trace
(
starttime
=
starttime
,
...
...
@@ -275,39 +273,49 @@ class FDSNFactory(TimeseriesFactory):
network
=
sncl
.
network
,
location
=
sncl
.
location
,
)
# Skip further processing if the data is still empty
if
data
.
count
()
==
0
:
return
data
if
data
.
count
()
!=
0
:
TimeseriesUtility
.
pad_and_trim_trace
(
trace
=
data
[
0
],
starttime
=
starttime
,
endtime
=
endtime
)
if
channel
in
channel_rotations
:
data
=
self
.
_rotate_and_return_requested_channel
(
data
,
sncl
,
starttime
,
endtime
,
channel
)
for
trace
in
data
:
response
=
trace
.
stats
.
response
if
self
.
remove_sensitivity
is
not
None
:
if
self
.
remove_sensitivity_flag
==
"
remove_sensitivity
"
:
trace
.
remove_sensitivity
()
elif
self
.
remove_sensitivity_flag
==
"
remove_response
"
:
trace
.
remove_response
()
else
:
raise
ValueError
(
f
"
Warning: Unrecognized remove_sensitivity value
'
{
self
.
remove_sensitivity
}
'
. No sensitivity or response removal applied.
"
)
else
:
if
response
.
instrument_sensitivity
:
if
response
.
instrument_sensitivity
.
input_units
==
"
T
"
:
# some ASL stations produce data in Teslas, not nanoteslas
response
.
instrument_sensitivity
.
value
/=
1e9
response
.
instrument_sensitivity
.
input_units
=
"
nT
"
# apply total gain/sensitivity, ignore any frequency response
trace
.
remove_sensitivity
()
if
hasattr
(
trace
.
stats
,
"
response
"
)
and
trace
.
stats
.
response
is
not
None
:
response
=
trace
.
stats
.
response
if
self
.
remove_sensitivity
is
not
None
:
if
self
.
remove_sensitivity_flag
==
"
remove_sensitivity
"
:
trace
.
remove_sensitivity
()
elif
self
.
remove_sensitivity_flag
==
"
remove_response
"
:
trace
.
remove_response
()
else
:
raise
ValueError
(
f
"
Warning: Unrecognized remove_sensitivity value
'
{
self
.
remove_sensitivity
}
'
. No sensitivity or response removal applied.
"
)
else
:
# according to fdsn docs, if no instrument_sensitivity,
# the response must be an instrument_polynomial
# https://docs.fdsn.org/projects/stationxml/en/latest/reference.html#instrumentsensitivity
# Geomag Program observatories use 2nd order instrument_polynomial
# to capture both offset and scale, but no frequency response
data
.
remove_response
()
if
response
.
instrument_sensitivity
:
if
response
.
instrument_sensitivity
.
input_units
==
"
T
"
:
# some ASL stations produce data in Teslas, not nanoteslas
response
.
instrument_sensitivity
.
value
/=
1e9
response
.
instrument_sensitivity
.
input_units
=
"
nT
"
# apply total gain/sensitivity, ignore any frequency response
trace
.
remove_sensitivity
()
else
:
# according to fdsn docs, if no instrument_sensitivity,
# the response must be an instrument_polynomial
# https://docs.fdsn.org/projects/stationxml/en/latest/reference.html#instrumentsensitivity
# Geomag Program observatories use 2nd order instrument_polynomial
# to capture both offset and scale, but no frequency response
data
.
remove_response
()
else
:
self
.
_set_metadata
(
data
,
observatory
,
channel
,
type
,
interval
)
...
...
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