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
445bf446
Unverified
Commit
445bf446
authored
7 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Fix netcdf creation of dewpoint when it isn't in the input files
parent
069ff562
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aosstower/level_b1/calc.py
+5
-1
5 additions, 1 deletion
aosstower/level_b1/calc.py
aosstower/level_b1/nc.py
+5
-0
5 additions, 0 deletions
aosstower/level_b1/nc.py
with
10 additions
and
1 deletion
aosstower/level_b1/calc.py
+
5
−
1
View file @
445bf446
...
...
@@ -3,9 +3,11 @@ import math
import
numpy
as
np
try
:
import
pandas
as
pd
from
pandas
import
Series
except
ImportError
:
# expected to use for isinstance
pd
=
None
Series
=
np
.
ndarray
NaN
=
float
(
'
nan
'
)
...
...
@@ -33,7 +35,9 @@ def dewpoint(tempC, relhum):
dp
=
1.0
/
(
1.0
/
(
273.15
+
tempC
)
-
gasconst
*
np
.
log
((
0.0
+
relhum
)
/
100
)
/
(
latheat
-
tempC
*
2397.5
))
return
min
(
dp
-
273.15
,
tempC
)
if
pd
is
not
None
and
isinstance
(
dp
,
pd
.
Series
):
return
pd
.
concat
([
dp
-
273.15
,
tempC
],
axis
=
1
).
min
(
axis
=
1
)
return
np
.
min
(
dp
-
273.15
,
tempC
)
def
relhum
(
airTempK
,
dewpointTempK
):
...
...
This diff is collapsed.
Click to expand it.
aosstower/level_b1/nc.py
+
5
−
0
View file @
445bf446
...
...
@@ -402,6 +402,11 @@ def create_giant_netcdf(input_files, output_fn, zlib, chunk_size,
# Add wind direction components so we can average wind direction properly
frame
[
'
wind_east
'
],
frame
[
'
wind_north
'
],
_
=
calc
.
wind_vector_components
(
frame
[
'
wind_speed
'
],
frame
[
'
wind_dir
'
])
if
'
air_temp
'
in
frame
and
'
rh
'
in
frame
and
'
dewpoint
'
in
database
:
LOG
.
info
(
"'
dewpoint
'
is missing from the input file, will calculate it from air temp and relative humidity
"
)
frame
[
'
dewpoint
'
]
=
calc
.
dewpoint
(
frame
[
'
air_temp
'
],
frame
[
'
rh
'
])
# round up each 1 minute group so data at time T is the average of data
# from T - 1 (exclusive) to T (inclusive).
new_frame
=
frame
.
resample
(
'
5S
'
,
closed
=
'
right
'
,
loffset
=
'
5S
'
).
mean
()
...
...
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