asammdf icon indicating copy to clipboard operation
asammdf copied to clipboard

The time of x x-axis is advace 8hour compare china

Open zhoubo-lab opened this issue 5 years ago • 9 comments

Dear:

  1. when I Concatenate dat, the dat tims is advace 8hour compare in china.
  2. For example: The real date of dat is 13:41:12 , But after Concatenate using Asammdf tool the date will become 05:43:12.
  3. So I think it is time zone is different between your location and china, do you think so? or what is root cause do you think. 4: is it possible to change it to correct date after concatenatigng dat? image image Thanks very much.

zhoubo-lab avatar Jul 28 '20 05:07 zhoubo-lab

I check the code. it seem here(the following figure) need to be change. But at this moment, I do not konw how to modify it.

image

C:\A_miniConda_py37\Lib\site-packages\asammdf\blocks\v2_v3_blocks.py (1 hit) Line 2568: * tz_offset - int : UTC time offset in hours (= GMT time zone) C:\A_miniConda_py37\Lib\site-packages\asammdf\blocks\v4_blocks.py (2 hits) Line 4672: * tz_offset - int : UTC time offset in hours (= GMT time zone) Line 4800: * tz_offset - int : UTC time offset in hours (= GMT time zone) C:\A_miniConda_py37\Lib\site-packages\asammdf\blocks_pycache_\v2_v3_blocks.cpython-37.pyc (1 hit) Line 967: * tz_offset - int : UTC time offset in hours (= GMT time zone) C:\A_miniConda_py37\Lib\site-packages\asammdf\blocks_pycache_\v4_blocks.cpython-37.pyc (2 hits) Line 1430: * tz_offset - int : UTC time offset in hours (= GMT time zone) Line 1489: * tz_offset - int : UTC time offset in hours (= GMT time zone) C:\A_miniConda_py37\Lib\site-packages\asammdf\gui\widgets\file.py (1 hit) Line 433: 1, self.mdf.header.start_time.strftime("%d-%b-%Y %H:%M:%S + %fus UTC") C:\A_miniConda_py37\Lib\site-packages\asammdf\gui\widgets\tabular.py (2 hits) Line 208: ts = ts.tz_convert("UTC").to_datetime64() Line 306: index = df.index.tz_localize("UTC").tz_convert(LOCAL_TIMEZONE) C:\A_miniConda_py37\Lib\site-packages\asammdf\gui\widgets_pycache_\file.cpython-37.pyc (1 hit) Line 43: C:\A_miniConda_py37\Lib\site-packages\asammdf\gui\widgets_pycache_\tabular.cpython-37.pyc (1 hit) Line 73: ? C:\A_miniConda_py37\Lib\site-packages\asammdf\mdf.py (2 hits) Line 1045: .tz_localize("UTC") Line 1139: .tz_localize("UTC") C:\A_miniConda_py37\Lib\site-packages\asammdf_pycache_\mdf.cpython-37.pyc (1 hit) Line 353: ChannelGroup_r?

zhoubo-lab avatar Jul 28 '20 06:07 zhoubo-lab

I try to fix it, Unlucky, I did not fix it. if you want my data. please let me konw, I will share with you to reappear the issue.

zhoubo-lab avatar Jul 28 '20 07:07 zhoubo-lab

Hello, in the first plot the time stamps are extracted using the asammdf package?

danielhrisca avatar Jul 28 '20 15:07 danielhrisca

Hello I use the asammdf plot is OK the time is OK. But I use other tool to open data is NOK. So I guess the time in data is UTC, when open by asammdf plot the time is transfer local time. But when use other tool, the time do not tranfter. Right? is it possible transfer timestramp to local time when Concatenate several dats? it is also very helpful.

zhoubo-lab avatar Jul 29 '20 01:07 zhoubo-lab

can you share the snippet that you use to generate the new file?

danielhrisca avatar Jul 29 '20 07:07 danielhrisca

Hi As the following script show.

import datetime from asammdf import MDF as zb_import import os from asammdf import Signal,MDF import numpy as np import glob

Paht_dat_folder = r"L:\009_P*.dat*" Paht_dat_name =glob.glob(Paht_dat_folder)

Paht_dat_name_target = r"L:\009_P\A01_02_03_BST.mf4"

merge_mdf=MDF.concatenate(Paht_dat_name, version='4.10', sync=True, add_samples_origin=True) merge_mdf.save(Paht_dat_name_target,compression=2, overwrite=True)

zhoubo-lab avatar Jul 29 '20 13:07 zhoubo-lab

What is the output of this snippet?

Paht_dat_folder = r"L:\009_P*.dat*"
Paht_dat_name =glob.glob(Paht_dat_folder)
for pth in Paht_dat_name:
    print(MDF(pth).start_time)

danielhrisca avatar Aug 10 '20 05:08 danielhrisca

pin @zhoubo-lab

danielhrisca avatar Dec 08 '20 07:12 danielhrisca

@zhoubo-lab can you check with the latest development branch?

danielhrisca avatar Jan 19 '21 09:01 danielhrisca

re-open if necessary

danielhrisca avatar Sep 01 '22 08:09 danielhrisca

@zhoubo-lab the development branch code might have a fix for your problem. Please check

danielhrisca avatar Sep 15 '22 10:09 danielhrisca