mscross / pysplit

A package for HYSPLIT air parcel trajectory analysis.
BSD 3-Clause "New" or "Revised" License
144 stars 79 forks source link

ValueError: Invalid literal for int() with base 10 : 'n' #76

Closed jon-maurer closed 3 years ago

jon-maurer commented 3 years ago

Hi I'm having a strange issue trying to run bulk trajectories and I was hoping someone could help me out. I'm using python 3.8.8 through Spyder on windows 10. I'm trying to run 72 hour back trajectories every 6 hours for Jan 2013. I have files from week 4 and 5 of December '12 and week 1 of Feb '13. No matter what I try I keep getting the error:

Traceback (most recent call last):

  File "C:\hysplit\HYSPLIT_Stuff\HYSPLIT_forAlex\Python_scripts\bulk_traj.py", line 161, in     pysplit.generate_bulktraj(basename, working_dir, storage_dir, meteo_dir,

  File "C:\Users\maurerj\Anaconda3\lib\site-packages\pysplit\trajectory_generator.py", line 138, in generate_bulktraj     meteofiles = _meteofinder(meteo_dir, meteo_bookends, m, y,

  File "C:\Users\maurerj\Anaconda3\lib\site-packages\pysplit\trajectory_generator.py", line 382, in _meteofinder     if int(each_file[file_number]) in meteo_bookends[0]:

ValueError: invalid literal for int() with base 10: 'n'


My files are all named according to the instructions in the script (gdas1.jan13.wk1) and are all .bin files (gdas1.jan13.wk1.bin). The only way I think this error could happen is if the function is mistaking the file extension for the end of the file name? I've tried to make sure that it's only reading the actual file by slicing the strings but still have no luck.

If anyone has any input I would appreciate it a ton! I'm completely at a loss here and running up against a deadline pretty soon.

mscross commented 3 years ago

Delete all of the .bin file extensions, that's my best immediate guess for fixing this. I've never seen GDAS files with any real file extension before and _meteofinder() is not set up to deal with that. Hope it's as simple as that!

jon-maurer commented 3 years ago

If I remove the .bin extension it changes the file type to whatever the week value is (.w4 for example). Does the gdas data need to be any particular file type? I've been manually downloading gdas 1 degree data from the ARL webpage.

mscross commented 3 years ago

image

No real file type, no extension, perfectly functional. Here's a screen clipping of my GDAS stash with file name, date modified, "file type", and size.

jon-maurer commented 3 years ago

Awesome! I'll give this a try!! Thank you so much for getting back to me.