mscross / pysplit

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

bulk_trajgen_example.py with GDAS1 #96

Open taeyoon91 opened 1 year ago

taeyoon91 commented 1 year ago

I am trying to run pysplit on windows 10 with GDAS1 datasets. I got GDAS files from ARL FTP(/archives/gdas1) to try an example on your github, but I think it was not working with ARL's GDAS Format.

First of all, I got a message:

HYSPLIT - Initialization HYSPLIT version: hysplit.v5.2.1 Last Changed Date: 2022-05-16 Calculation Started ... please be patient ERROR sfcinp: ASCDATA.CFG file not found! See MESSAGE file for more information Traceback (most recent call last): File "c:\ACCLab\hysplit\bulk_trajgen_example.py", line 20, in pysplit.generate_bulktraj(basename, working_dir, storage_dir, meteo_dir, File "C:\Users\eomta\miniconda3\envs\ACCLab\lib\site-packages\pysplit\trajectory_generator.py", line 169, in generate_bulktraj _reversetraj_whilegen(trajname, run, hysplit, output_rdir, File "C:\Users\eomta\miniconda3\envs\ACCLab\lib\site-packages\pysplit\trajectory_generator.py", line 230, in _reversetraj_whilegen day = int(data[4]) ValueError: invalid literal for int() with base 10: '42.820'

When I checked the data variable: ['7', '1', '1', '11', '42.820', '-75.540', '500.0']

So, I changed it on 'pysplit/trajectory_generator.py' and it worked, Change -------------------------------------------- def _reversetraj_whilegen(....) ..... year = int(data[2]) -> int(data[0])
mon = int(data[3]) -> int(data[1])
day = int(data[4]) -> int(data[2])
hour = int(data[5]) -> int(data[3])
lat = float(data[9]) -> int(data[4])
lon = float(data[10]) -> int(data[5])
alt = float(data[11]) -> int(data[6])
......

As a result of the example code(bulk_trajgen_example.py), I got a file on "working\colgatejan0500winter2007010111" Content -------------------------------------------------------- 6 1 GDAS 7 1 1 0 0 GDAS 7 1 8 0 0 GDAS 7 1 15 0 0 GDAS 7 1 22 0 0 GDAS 7 1 29 0 0 GDAS 7 2 1 0 0 1 BACKWARD OMEGA
7 1 1 11 42.820 -75.540 500.0 1 PRESSURE

but, I got a next error message, and I can't deal this:

HYSPLIT - Initialization HYSPLIT version: hysplit.v5.2.1 Last Changed Date: 2022-05-16 Calculation Started ... please be patient ERROR sfcinp: ASCDATA.CFG file not found! See MESSAGE file for more information Traceback (most recent call last): File "c:\ACCLab\hysplit\bulk_trajgen_example.py", line 20, in pysplit.generate_bulktraj(basename, working_dir, storage_dir, meteo_dir, File "C:\Users\eomta\miniconda3\envs\ACCLab\lib\site-packages\pysplit\trajectory_generator.py", line 173, in generate_bulktraj _cliptraj(output_cdir, trajname) File "C:\Users\eomta\miniconda3\envs\ACCLab\lib\site-packages\pysplit\trajectory_generator.py", line 309, in _cliptraj if len(contents[ind + 1]) > len(contents[ind + 2]): IndexError: list index out of range

As you can see, there is no line affer PRESSURE string at last on the file (colgatejan0500winter2007010111) content..

How can I solve this problem?