Downloading data in a date and time range
The following script will download data from instrument. The script includes a
date and time range, file duration (minutes), as well as the directory that the files
are saved to, all of which can be modified to suit your needs. This program uses the
Python
requests
libraries, so we'll begin by installing those.
1
Install the
requests
libraries.
Launch a terminal on Mac or command prompt on Windows. Type
pip install
requests
or
sudo pip install requests
in the command line tool. The ter-
minal will issue a few replies indicating success.
2
Create the python script to save the data.
Copy the following into a text file and save it to your computer's desktop (or
another directory) with a
.py
extension, like
import-datetime.py
.
import
datetime
import
requests
import
socket
slno =
'tgXX-01009.local'
ip = socket.
gethostbyname
(slno)
dl1 =
"http://"
+ ip+
":8080/ExportAdvancedData?tmin="
dl2 =
"&tmax="
tmz =
"-06:00"
dt = datetime.
datetime
(
2019
,
5
,
10
,
0
,
0
,
0
)
end = datetime.
datetime
(
2019
,
5
,
11
,
0
,
0
,
0
)
step = datetime.
timedelta
(minutes=
30
)
fls = []
ts5= []
while
dt <= end:
ts1 = dt.
strftime
(
'%Y-%m-%d %H:%M:%S'
)
ts3 = dt.
strftime
(
'%Y-%m-%d %H-%M-%S'
)
ts2 = ts1[
0
:
10
] +
"T"
+ts1[
11
:]
ts4 = ts1[
0
:
10
] +
"T"
+ts3[
11
:] +
".txt"
;
ts5.
append
(ts4)
fls.
append
(ts2)
dt += step
(fls)
for
i
in
range
(
0
,
len
(fls)-
1
,
1
):
Section 7. Communication with the MQTT protocol
7-9
Downloading data in a date and time range
Содержание LI-7820
Страница 1: ...LI 7820 N2O H2O Trace Gas Analyzer Instruction Manual ...
Страница 2: ......
Страница 10: ...viii ...
Страница 28: ...Section 2 Getting started 2 12 LI 7820 N O H O Gas Analyzer ...
Страница 36: ...Section 3 Applications of the LI 7820 3 8 LI 7820 N O H O Gas Analyzer ...
Страница 52: ...Section 4 Software overview 4 16 LI 7820 N O H O Gas Analyzer ...
Страница 66: ...Section 6 Maintenance 6 8 LI 7820 N O H O Gas Analyzer ...
Страница 84: ...Appendix B Additional safety information B 6 LI 7820 N O H O Gas Analyzer ...
Страница 91: ......