Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aeri_quality_control
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
aeri
aeri_quality_control
Commits
08444b25
Commit
08444b25
authored
8 years ago
by
Coda Phillips
Browse files
Options
Downloads
Patches
Plain Diff
Create netcdf by atomic move and fix frame merge
parent
c7434f7b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.py
+7
-3
7 additions, 3 deletions
main.py
with
7 additions
and
3 deletions
main.py
+
7
−
3
View file @
08444b25
...
...
@@ -7,7 +7,8 @@ import pandas as pd
import
numpy
as
np
from
zipfile
import
ZipFile
from
io
import
BytesIO
from
tempfile
import
mkstemp
from
shutil
import
move
from
electronic_checks
import
electronic_checks
from
global_checks
import
global_checks
...
...
@@ -36,7 +37,8 @@ def save_quality(frame, qc_path):
frame
=
frame
.
ix
[
pd
.
notnull
(
frame
.
sum_index
)].
set_index
(
'
sum_index
'
).
sort_index
()
# Define the netcdf
ncdf
=
netCDF4
.
Dataset
(
qc_path
,
'
w
'
)
*
_
,
temp
=
mkstemp
()
ncdf
=
netCDF4
.
Dataset
(
temp
,
'
w
'
)
time
=
ncdf
.
createDimension
(
'
time
'
,
len
(
frame
))
base_time
=
ncdf
.
createVariable
(
'
base_time
'
,
'
i8
'
,
())
time_offset
=
ncdf
.
createVariable
(
'
time_offset
'
,
'
i8
'
,
(
'
time
'
,))
...
...
@@ -59,6 +61,8 @@ def save_quality(frame, qc_path):
qc_percent
[:]
=
frame
[
'
qc_percent
'
].
values
qc_notes
[:]
=
frame
[
'
qc_notes
'
].
fillna
(
''
).
values
ncdf
.
close
()
move
(
temp
,
qc_path
)
def
read_frame
(
cxs_file
,
sum_file
):
...
...
@@ -145,7 +149,7 @@ def update_all(ftp_dir, sci_dir, parameters=None):
parameters
=
{}
# check for spikes in interferograms and add that quality column to housekeeping frame
# merging by datetimes is not expected to work, will probably interleave with SUM records
frame_with_spikes
=
frame
.
merge
(
spike_check
(
igms
,
parameters
),
on
=
'
datetime
'
,
how
=
'
outer
'
,
sort
=
True
)
frame_with_spikes
=
frame
.
merge
(
spike_check
(
igms
,
parameters
),
on
=
'
datetime
'
,
how
=
'
outer
'
,
suffixes
=
(
''
,
'
_igm
'
),
sort
=
True
)
# Propogate spike data to surrounding records
# Only propogate presence of spikes, not abscence
frame_with_spikes
.
ix
[
frame_with_spikes
.
spike_check
==
False
]
=
pd
.
np
.
nan
...
...
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