我试图读取tdms文件从一个Azure数据湖到另一个,并转换他们在同一时间的地板。我设法在Azure中安装了包nptdms,并运行了下面的代码行
但我不知道如何在第二个代码行或第三个代码行中给出值path_to_file。
它不起作用。我相信nptdms包只是为就地编写的,它不适用于云语法。
我想知道有谁能在Azure平台上分享阅读tdms.files的经验。
发布于 2021-07-07 09:26:50
由于文件的大小可能更大,所以应该下载并存储在临时文件中,以便将文件路径传递给TdmsFile.open
或TdmsFile.read
。
tmp_file.name
是它在这里的道路。
from shutil import copyfileobj
from urllib.request import urlopen
from tempfile import NamedTemporaryFile
from nptdms import TdmsFile
with urlopen('http://www-personal.acfr.usyd.edu.au/zubizarreta/f/exampleMeasurements.tdms') as response:
with NamedTemporaryFile(delete=False) as tmp_file:
copyfileobj(response, tmp_file)
tdms_file = TdmsFile.open(tmp_file.name)
for group in tdms_file.groups():
group_name = group.name
print(f'Group name: {group_name}')
for channel in group.channels():
channel_name = channel.name
print(f'Channel name: {channel_name}')
https://stackoverflow.com/questions/68253193
复制相似问题