Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Esperanto-mega opened this issue Apr 16, 2023 · 1 comment
Open

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

Esperanto-mega opened this issue Apr 16, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Esperanto-mega
Copy link

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 Esperanto-mega added the bug Something isn't working label Apr 16, 2023
@jjjj32481
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants