Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MockWeatherDataSource
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
MaDiPHS
MockWeatherDataSource
Commits
ff87ac8e
Commit
ff87ac8e
authored
2 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Handle wrong period
parent
d7e44f80
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
app/models.py
+0
-1
0 additions, 1 deletion
app/models.py
app/weatherdata_utils.py
+4
-4
4 additions, 4 deletions
app/weatherdata_utils.py
with
4 additions
and
5 deletions
app/models.py
+
0
−
1
View file @
ff87ac8e
...
...
@@ -16,7 +16,6 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from
datetime
import
datetime
from
_datetime
import
date
from
shapely
import
wkb
from
shapely.geometry
import
Point
...
...
This diff is collapsed.
Click to expand it.
app/weatherdata_utils.py
+
4
−
4
View file @
ff87ac8e
...
...
@@ -7,14 +7,14 @@ from models import WeatherData
def
filter_period
(
weather_data
,
time_start
,
time_end
):
# Get the start and end index
#print(time_start)
start_index
=
weather_data
.
get_index_from_epoch_seconds
(
WeatherData
.
to_epoch_seconds
(
time_start
))
start_index
=
max
(
0
,
weather_data
.
get_index_from_epoch_seconds
(
WeatherData
.
to_epoch_seconds
(
time_start
))
)
#print(start_index)
end_index
=
weather_data
.
get_index_from_epoch_seconds
(
WeatherData
.
to_epoch_seconds
(
time_end
))
end_index
=
min
(
weather_data
.
get_index_from_epoch_seconds
(
weather_data
.
timeEnd
),
weather_data
.
get_index_from_epoch_seconds
(
WeatherData
.
to_epoch_seconds
(
time_end
))
)
for
lwd
in
weather_data
.
locationWeatherData
:
lwd
.
data
=
lwd
.
data
[
start_index
:
end_index
]
# Adjust timeStart and timeEnd
weather_data
.
timeStart
=
W
eather
D
ata
.
t
o_epoch_seconds
(
time_start
)
weather_data
.
timeEnd
=
W
eather
D
ata
.
t
o_epoch_seconds
(
time_end
)
weather_data
.
timeStart
=
w
eather
_d
ata
.
t
imeStart
+
(
start_index
*
weather_data
.
interval
)
weather_data
.
timeEnd
=
w
eather
_d
ata
.
t
imeStart
+
(
end_index
*
weather_data
.
interval
)
return
weather_data
def
filter_params
(
weather_data
,
params
):
...
...
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