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
1e6e8a3d
Verified
Commit
1e6e8a3d
authored
2 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Remove deprecated pandas loffset usage
parent
1436beb0
No related branches found
Branches containing commit
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/nc.py
+8
-3
8 additions, 3 deletions
aosstower/level_b1/nc.py
with
8 additions
and
3 deletions
aosstower/level_b1/nc.py
+
8
−
3
View file @
1e6e8a3d
...
...
@@ -18,6 +18,7 @@ from metobscommon.util.nc import (
write_vars
,
)
from
netCDF4
import
Dataset
from
pandas.tseries.frequencies
import
to_offset
from
aosstower
import
schema
from
aosstower.level_00
import
parser
...
...
@@ -108,7 +109,8 @@ def create_giant_netcdf(
# 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
()
new_frame
=
frame
.
resample
(
"
5S
"
,
closed
=
"
right
"
).
mean
()
new_frame
.
index
=
frame
.
index
+
to_offset
(
"
5S
"
)
# 2 minute rolling average of 5 second data (5 seconds * 24 = 120 seconds = 2 minutes)
winds_frame_5s
=
new_frame
[[
"
wind_speed
"
,
"
wind_east
"
,
"
wind_north
"
]]
...
...
@@ -123,9 +125,12 @@ def create_giant_netcdf(
if
summary
:
frame
=
summary_over_interval
(
new_frame
,
interval_width
)
else
:
frame
=
new_frame
.
resample
(
interval_width
,
closed
=
"
right
"
,
loffset
=
interval_width
).
mean
()
frame
=
new_frame
.
resample
(
interval_width
,
closed
=
"
right
"
).
mean
()
frame
.
index
=
frame
.
index
+
to_offset
(
interval_width
)
frame
[
"
wind_dir
"
]
=
calc
.
wind_vector_degrees
(
frame
[
"
wind_east
"
],
frame
[
"
wind_north
"
])
frame
[
"
gust
"
]
=
new_frame
[
"
gust
"
].
resample
(
interval_width
,
closed
=
"
right
"
,
loffset
=
interval_width
).
max
()
new_gust
=
new_frame
[
"
gust
"
].
resample
(
interval_width
,
closed
=
"
right
"
).
max
()
new_gust
.
index
=
new_gust
.
index
+
to_offset
(
interval_width
)
frame
[
"
gust
"
]
=
new_gust
frame
=
frame
.
fillna
(
np
.
nan
)
if
start
and
end
:
...
...
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