ZigongXu / time_converter

0 stars 0 forks source link

Unsupported lunar day from day 38+ #1

Open juld88 opened 1 month ago

juld88 commented 1 month ago

Windows 11. LNDData() with any lunar day past day 38 returns the error:

ValueError Traceback (most recent call last) Cell In[48], line 1 ----> 1 LNDData(38)

File ~\AppData\Roaming\Python\Python312\site-packages\lnd_loader\lnd.py:68, in LNDData.init(self, start, end, filename, incomplete_packets, ignore_l2) 64 raise ValueError('You are trying to pass a string to the start parameter. ' 65 'Probably you actually want to use LNDData(filename=\'...\').') 67 # convert offset-naive times to UTC ---> 68 start = self._convert_input_to_dt(start, end=False) 69 end = self._convert_input_to_dt(end, end=True) 71 if filename is None:

File ~\AppData\Roaming\Python\Python312\site-packages\lnd_loader\lnd.py:270, in LNDData._convert_input_to_dt(time, end) 268 if time is not None: 269 if isinstance(time, int): --> 270 time = Time((time, dt.time(23, 59, 59) if end else dt.time(0, 0)), 'ce4lst').to('dt') 271 elif isinstance(time, Time): 272 time = time.to('dt')

File ~\AppData\Roaming\Python\Python312\site-packages\time_converter__init.py:96, in Time.init__(self, value, unit) 94 else: 95 converter = self._get_converter(unit, type(value)) ---> 96 self.dt = converter.convert_to_datetime(value)

File ~\AppData\Roaming\Python\Python312\site-packages\time_converter\converters\change4__init__.py:73, in Change4LocalTimeConverter.convert_to_datetime(self, value) 71 data = self._load_data() 72 if value[0] < 1 or value[0] >= data['LD'].max(): ---> 73 raise ValueError('unsupported lunar day: {}'.format(value[0])) 75 masked_data = data[(data['LD'] == value[0]) & (data['time'] >= value[1])] 76 if len(masked_data) == 0:

ValueError: unsupported lunar day: 38

Caused by change4_localtime.dat file only containing dates up to lunar day 37?

ZigongXu commented 1 month ago

I realized this version has been updated! You can download the lunar day date time file to replace the previous one