Section 7. Communication with the MQTT protocol
url = dl1+fls[i]+tmz+dl2+fls[i+
1
]+tmz
(url +
"\n"
)
flnm = ts5[i]
(
"Downloading to File Name "
+ flnm +
" from "
+ url )
r = requests.
get
(url)
with
open
(
"C:/Users/User.Name/Documents/"
+
flnm,
'wb'
)
as
f:
f.
write
(r.content)
3
Modify the script for your instrument, computer, and date range:
A
Identify the instrument:
In
snlo='tgXX-01009.local'
, replace
tgXX-01009
with
the serial number from your instrument. The letters XX represent numbers.
B
Set the beginning time:
In
dt = datetime.datetime(2019,5, 10,0,0,0)
, spe-
cify the start date and time for the data to download.
2019,5, 10
is the year, month, and
day (YYYY,M, DD).
0,0,0
is the hour, minutes and seconds (H,M,S).
C
Set the ending time:
In
end = datetime.datetime(2019,5, 11,0,0,0)
, specify
the end date and time for the data to download.
D
Specify the file size (minutes):
In
step = datetime.timedelta(minutes=30)
,
change the value 30 to the number of minutes you want.
E
Set the directory to save the data:
In
with open("C:/User-
s/User.Name/Documents/" + flnm, 'wb')
, specify the directory.
4
Start the script from the terminal program or command prompt.
In the terminal program, change to the directory that has the
.py
file saved earlier.
Type
cd desktop
on Mac or type
cd C:\Users\User.Name\Desktop
if you saved
them to your desktop (
User.Name
is a placeholder, used as an example). Then type
python import-datetime.py
to launch the script. This script will create 48 text
files, each with 30 minutes of data recorded on May 5, 2019. The files will be created
and saved to the directory you specify.
Additional commands
Python scripts can be also used to set zero/span, reboot, or shutdown the instrument
by using the publish option available in the Paho MQTT python client similar to
mosquito_pub. To shutdown the instrument, send the command
client.
publish
(“licor/niobrara/system/shutdown”,”shutdown”)
7-10
LI-7815 CO₂/H₂O Gas Analyzer
Summary of Contents for LI-7815
Page 1: ...LI 7815 CO2 H2O Trace Gas Analyzer Instruction Manual...
Page 2: ......
Page 10: ...viii...
Page 30: ...Section 2 Getting started 2 14 LI 7815 CO H O Gas Analyzer...
Page 38: ...Section 3 Applications of the LI 7815 3 8 LI 7815 CO H O Gas Analyzer...
Page 42: ...Section 4 Software overview 4 4 LI 7815 CO H O Gas Analyzer...
Page 54: ...Section 4 Software overview 4 16 LI 7815 CO H O Gas Analyzer...
Page 62: ...Section 5 Troubleshooting 5 8 LI 7815 CO H O Gas Analyzer...
Page 70: ...Section 6 Maintenance 6 8 LI 7815 CO H O Gas Analyzer...
Page 88: ...Appendix B Additional safety information B 6 LI 7815 CO H O Gas Analyzer...
Page 92: ...Appendix C Specifications C 4 LI 7815 CO H O Gas Analyzer...
Page 97: ......