graph_weather icon indicating copy to clipboard operation
graph_weather copied to clipboard

The attribute 'dayofyear' in line 428 of train/run.py

Open Esperanto-mega opened this issue 1 year ago • 1 comments

Original Traceback (most recent call last): File "/home/data/yh/miniconda/envs/nudt/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop data = fetcher.fetch(index) File "/home/data/yh/miniconda/envs/nudt/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 32, in fetch data.append(next(self.dataset_iter)) File "/home/data/yh/nudt/graph_weather-main/train/run.py", line 428, in iter day_of_year = data["timestamps"][0].dayofyear / 366.0 AttributeError: 'datetime.datetime' object has no attribute 'dayofyear'

I think the attribute used here should be 'day' instead.

Esperanto-mega avatar Apr 16 '23 05:04 Esperanto-mega

Replace the code "day_of_year = data["timestamps"][0].dayofyear / 366.0" in the iter() function of the XrDataset with the following lines can tackle this issue. date = data["timestamps"][0] day_of_year = ((date-datetime.datetime(date.year,1,1)).days+1) / 366.0

jjjj32481 avatar Oct 29 '23 06:10 jjjj32481