Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AossTower
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
MetObs
AossTower
Commits
b794c931
Commit
b794c931
authored
8 years ago
by
kgao
Browse files
Options
Downloads
Patches
Plain Diff
Added qc variables
parent
83689402
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
aosstower/level_b1/daily/nc.py
+45
-2
45 additions, 2 deletions
aosstower/level_b1/daily/nc.py
with
45 additions
and
2 deletions
aosstower/level_b1/daily/nc.py
+
45
−
2
View file @
b794c931
...
...
@@ -12,6 +12,24 @@ from datetime import timedelta as delta
LOG
=
logging
.
getLogger
(
__name__
)
def
filterArray
(
array
,
valid_min
,
valid_max
):
qcControl
=
[]
for
value
in
array
:
if
value
==
float
(
-
999
):
qcControl
.
append
(
np
.
byte
(
0b1
))
elif
value
<
valid_min
:
qcControl
.
append
(
np
.
byte
(
0b10
))
elif
value
>
valid_min
:
qcControl
.
append
(
np
.
byte
(
0b100
))
else
:
qcControl
.
append
(
np
.
byte
(
0b0
))
return
np
.
array
(
qcControl
)
# The purpose of this function is to write the dimensions
# for the nc file
# no parameters
...
...
@@ -109,13 +127,31 @@ def createVariables(ncFile, firstStamp, chunksizes, zlib):
variable
.
valid_min
=
float
(
varTup
[
5
])
variable
.
valid_max
=
float
(
varTup
[
6
])
qcVariable
=
ncFile
.
createVariable
(
'
qc_
'
+
entry
,
'
b
'
,
dimensions
=
(
'
time
'
),
fill_value
=
0b0
,
zlib
=
zlib
,
chunksizes
=
chunksizes
)
qcVariable
.
long_name
=
'
data quality
'
qcVariable
.
valid_range
=
np
.
byte
(
0b1
),
np
.
byte
(
0b1111
)
qcVariable
.
flag_masks
=
np
.
byte
(
0b1
),
np
.
byte
(
0b10
),
np
.
byte
(
0b100
),
np
.
byte
(
0b1000
)
flagMeaning
=
[
'
value is equal to missing_value
'
,
'
value is less than the valid min
'
,
'
value is greater than the valid max
'
,
'
difference between current and previous values exceeds valid_delta.
'
]
qcVariable
.
flag_meaning
=
'
,
'
.
join
(
flagMeaning
)
#create global attributes
ncFile
.
source
=
'
surface observation
'
ncFile
.
conventions
=
'
ARM-1.2 CF-1.6
'
ncFile
.
institution
=
'
UW SSEC
'
ncFile
.
featureType
=
'
timeSeries
'
ncFile
.
data_level
=
'
a0
'
ncFile
.
datastream
=
'
aoss.tower.nc.la0.v00
'
ncFile
.
data_level
=
'
b1
'
#monthly files end with .month.nc
#these end with .day.nc
ncFile
.
datastream
=
'
aoss.tower.y_nc.b1.v00
'
ncFile
.
software_version
=
'
00
'
#generate history
...
...
@@ -255,6 +291,13 @@ def writeVars(ncFile, frame):
dataArray
=
np
.
asarray
(
dataList
)
fileVar
[
varName
][:]
=
dataArray
if
parser
.
database
[
varName
][
5
]
!=
''
:
valid_min
=
float
(
parser
.
database
[
varName
][
5
])
valid_max
=
float
(
parser
.
database
[
varName
][
6
])
fileVar
[
'
qc_
'
+
varName
][:]
=
filterArray
(
dataArray
,
valid_min
,
valid_max
)
return
ncFile
...
...
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