Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
JOSSOUD Olivier
WIM Collect
Commits
6c3f6454
Commit
6c3f6454
authored
Jan 31, 2020
by
JOSSOUD Olivier
Browse files
QuickViz. Correct source file path.
parent
a93ace6a
Pipeline
#58087
passed with stages
in 1 minute and 48 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
wimcollect/quickviz.py
wimcollect/quickviz.py
+3
-4
wimcollect/tests/test_quickviz.py
wimcollect/tests/test_quickviz.py
+10
-0
No files found.
wimcollect/quickviz.py
View file @
6c3f6454
...
...
@@ -16,10 +16,8 @@ class Visualizator(utils.LogConfig):
self
.
base_dir
=
self
.
config
[
self
.
object_id
][
"root_dir"
]
def
create_data_source_file
(
self
,
site_id
:
str
,
picarro_id
:
str
,
day
:
datetime
.
date
):
source_dir
=
os
.
path
.
join
(
self
.
config
[
"LOCAL"
][
"base_dir"
],
site_id
,
"picarro"
,
picarro_id
,
str
(
day
.
year
))
source_filename
=
site_id
+
"_"
+
picarro_id
+
"_"
+
day
.
strftime
(
"%Y%m%d"
)
+
".lzma"
source_filepath
=
os
.
path
.
join
(
source_dir
,
source_filename
)
source_filepath
=
utils
.
get_standard_filepath
(
self
.
config
[
"LOCAL"
][
"base_dir"
],
site_id
,
"picarro"
,
picarro_id
,
day
.
strftime
(
"%Y%m%d"
),
"lzma"
)
if
not
os
.
path
.
exists
(
source_filepath
):
self
.
logger
.
error
(
"Failed to open source file "
+
source_filepath
,
day
.
strftime
(
"%Y-%m-%d"
))
return
...
...
@@ -38,11 +36,12 @@ class Visualizator(utils.LogConfig):
df
.
to_csv
(
calib_filepath
,
index
=
False
,
date_format
=
'%Y-%m-%dT%H:%M:%S.%fZ'
)
return
True
def
get_data
(
self
,
dat_files
:
list
)
->
pd
.
DataFrame
:
dateparse
=
lambda
x
:
pd
.
datetime
.
strptime
(
x
,
'%Y-%m-%d %H:%M:%S.%f'
)
day_df
=
pd
.
DataFrame
()
for
dat_file
in
dat_files
:
print
(
dat_file
)
df
=
pd
.
read_csv
(
dat_file
,
delim_whitespace
=
True
,
parse_dates
=
{
'datetime'
:
[
'DATE'
,
'TIME'
]},
...
...
wimcollect/tests/test_quickviz.py
0 → 100644
View file @
6c3f6454
import
datetime
from
unittest
import
TestCase
import
wimcollect.quickviz
as
quickviz
class
TestVisualizator
(
TestCase
):
def
test_create_data_source_file
(
self
):
vizu
=
quickviz
.
Visualizator
()
self
.
assertTrue
(
vizu
.
create_data_source_file
(
"DDU"
,
"HIDS2189"
,
datetime
.
date
(
2020
,
1
,
29
)))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment