Skip to content

Index out of bounds #20

@Anshita1Saxena

Description

@Anshita1Saxena

Hi authors,

While I was trying to run the visualize_events.py file, the code stuck with this issue: IndexError: index 4 is out of bounds for axis 0 with size 1

Environment Details:
NAME="Rocky Linux"
VERSION="8.7 (Green Obsidian)"
ID_LIKE="rhel centos fedora"

Details of setup:-
Since the cluster doesn't support the conda environment, I installed all the libraries with their latest version in virtualenv. I am attaching the libraries version file here. requirements.txt

Data Set and pre-trained model details:
Train Dataset
Inference Dataset
Pre-trained Model
I am using these files:- config_new.json and weights_new.pth

Details of execution:-
When I tried to ran the visualize_events.pyfunctionalities with the help ofexample.py` file.

The stack trace is given below:

Traceback (most recent call last):
  File "/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx512/Core/python/3.9.6/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx512/Core/python/3.9.6/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/project/60025/anshita/ClimateNet/climatenet/visualize_events.py", line 98, in spawn
    generatePNG(filename, input_data[int(i/8)].sel(variable="TMQ")[i%8],
  File "/localscratch/anshita.1386.0/env/lib/python3.9/site-packages/xarray/core/dataarray.py", line 816, in __getitem__
    return self.isel(indexers=self._item_key_to_dict(key))
  File "/localscratch/anshita.1386.0/env/lib/python3.9/site-packages/xarray/core/dataarray.py", line 1395, in isel
    variable = self._variable.isel(indexers, missing_dims=missing_dims)
  File "/localscratch/anshita.1386.0/env/lib/python3.9/site-packages/xarray/core/variable.py", line 1312, in isel
    return self[key]
  File "/localscratch/anshita.1386.0/env/lib/python3.9/site-packages/xarray/core/variable.py", line 860, in __getitem__
    data = as_indexable(self._data)[indexer]
  File "/localscratch/anshita.1386.0/env/lib/python3.9/site-packages/xarray/core/indexing.py", line 1263, in __getitem__
    return array[key]
IndexError: index 4 is out of bounds for axis 0 with size 1
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/project/60025/anshita/ClimateNet/example.py", line 32, in <module>
    visualize_events(event_masks, inference, 'pngs/')
  File "/project/60025/anshita/ClimateNet/climatenet/visualize_events.py", line 102, in visualize_events
    pool.map(spawn, range(len(event_masks)))
  File "/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx512/Core/python/3.9.6/lib/python3.9/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx512/Core/python/3.9.6/lib/python3.9/multiprocessing/pool.py", line 771, in get
    raise self._value
IndexError: index 4 is out of bounds for axis 0 with size 1

I also tried to print the associated values also, which is attached below:
image

Code values printed by me:
Line numbers: 90 and 91 of visualize_events.py file:
image

Please let me know in case you need further details of how I am running your code or any configuration-related details. I will wait and appreciate your attention to this issue.
Appreciate your response at the earliest.

Thank You.

Best regards,
Anshita Saxena

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions