pysplit icon indicating copy to clipboard operation
pysplit copied to clipboard

Problem loading 'hysplitfile'

Open cross85 opened this issue 5 years ago • 4 comments

I'm using the 0.35 version of pysplit. I run it once without a problem, but now with another run of hysplit I get this error message:

File "C:\Miniconda3\envs\pysplitenv\lib\site-packages\pysplit\hy_processor.py", line 63, in make_trajectorygroup
    data, path, head, datetime, multitraj = load_hysplitfile(hyfile)

  File "C:\Miniconda3\envs\pysplitenv\lib\site-packages\pysplit\hyfile_handler.py", line 146, in load_hysplitfile
    if len(contents[ind + 1]) > len(contents[ind + 2]):

IndexError: list index out of range

This happens when I run this line from the cluster analysis docs/examples/hysplit_clustering.py trajgroup = pysplit.make_trajectorygroup(r'C:/hysplit4/E-3/endpts/fdump*')

the fdump* files seems to be ok, and I run Hysplit with no problem, so I can't figure out what could be the problem here.

cross85 avatar Jun 11 '19 00:06 cross85

When file loading fails here, that means you have a file that has a header and at most one line of data: The loader found "PRESSURE" at line ind, and this if statement is an attempt to determine whether your t=0 consists of the next one or next two lines in the file.

mscross avatar Jun 11 '19 05:06 mscross

Thanks, as you said, it was a couple of file without trajectories. If anyone has the same problem an a lot of files, the easiest way I found to know which file is making the problem, is adding print(filename) to this file hyfile_handler.py like this:

    with open(filename, 'r') as hyfile:

        contents = hyfile.readlines()
        print(filename)

        skip = False
        atdata = False

So the las name of the list is the file without trajectories. After you solve the problem, you can delete that line.

cross85 avatar Jul 12 '19 16:07 cross85

Hello, I got the same problem as yours. In my case, I followed your method to determine which file is making problem, and I found that the files named the last hours in last day of every month I assigned are problem files (i.e. umnjan0500winter2011013123 & umnjul0500summer2012073123). What should I do next, to solve this problem?

tingvan avatar Nov 23 '19 13:11 tingvan

Hi @tingvan, you can just delete the files and create the INFILE again. There will be no problem, because you won't use them to create the clusters anyways.

cross85 avatar Dec 09 '19 16:12 cross85