Calling Hysplit from external soft

General questions and postings pertaining to the use of HYSPLIT regardless of the platform. For platform specific questions, use the HYSPLIT Platform forums.
Post Reply
je.petit
Posts: 14
Joined: April 13th, 2016, 10:41 am
Registered HYSPLIT User: Yes

Calling Hysplit from external soft

Post by je.petit »

Hi all,

I would like to call backtraj calculations with Hysplit directly from an external software. I figured that if the CONTROL file is placed in the hysplit4/exec/ folder, and hyts_std run, a single calculation occurs. But then, how to take the SETUP.CFG file into account ? Indeed, I would like to add meteorological parameters along traj, and this being alone parametrizable from this file...
I feel like a batch file should be used, but I am very (very) new to batch coding.

Thanks for any king of help!
Cheers,
J-E
je.petit
Posts: 14
Joined: April 13th, 2016, 10:41 am
Registered HYSPLIT User: Yes

Re: Calling Hysplit from external soft

Post by je.petit »

Nevermind, just figured out that SETUP.CFG needs to be also in the exec folder. There may be a more robust to do it from a .bat file, but it is working! :)
glenn.rolph
Posts: 362
Joined: November 7th, 2012, 1:39 pm
Registered HYSPLIT User: Yes

Re: Calling Hysplit from external soft

Post by glenn.rolph »

You should not run HYSPLIT from the /exec directory. This could cause problems later on. You should be running HYSPLIT from the /working directory and SETUP.CFG and CONTROL need to be in the /working directory.
je.petit
Posts: 14
Joined: April 13th, 2016, 10:41 am
Registered HYSPLIT User: Yes

Re: Calling Hysplit from external soft

Post by je.petit »

okay, thanks for the info! so how do the parameters in CONTROL and SETUP get pushed to hyts_std?
As I don't understand (yet) batch language, I don't find the proper way to adapt existing .bat files to this case...
glenn.rolph
Posts: 362
Joined: November 7th, 2012, 1:39 pm
Registered HYSPLIT User: Yes

Re: Calling Hysplit from external soft

Post by glenn.rolph »

The HYSPLIT code knows to look in the directory you are running the model from for the CONTROL and SETUP.CFG, so you need to run your script from the working directory.

You can find an example of running the trajectory from a batch script in the examples/scripts/batch called Traj_run.bat. Copy Traj_run.bat to the working directory and modify it slightly to run as shown below:

echo 00 00 00 00 >CONTROL
echo 1 >>CONTROL
echo 40.0 -90.0 10.0 >>CONTROL
echo 48 >>CONTROL
echo 0 >>CONTROL
echo 10000.0 >>CONTROL
echo 1 >>CONTROL
echo ./ >>CONTROL
echo oct1618.BIN >>CONTROL
echo ./ >>CONTROL
echo tdump >>CONTROL

\hysplit4\exec\hyts_std
\hysplit4\exec\trajplot -itdump -oplot
je.petit
Posts: 14
Joined: April 13th, 2016, 10:41 am
Registered HYSPLIT User: Yes

Re: Calling Hysplit from external soft

Post by je.petit »

ok, so based on this example and what I'd like to do, I wrote this batch file, saved in the /working folder:

echo 16 03 01 00 >CONTROL
echo 1 >>CONTROL
echo 49.11 6.23 50 >>CONTROL
echo -72 >>CONTROL
echo 0 >>CONTROL
echo 10000 >>CONTROL
echo 3 >>CONTROL
echo C:/Users/je.petit/Downloads/Hysplit GDAS/ >>CONTROL
echo gdas1.mar16.w1 >>CONTROL
echo C:/Users/je.petit/Downloads/Hysplit GDAS/ >>CONTROL
echo gdas1.feb16.w5 >>CONTROL
echo C:/Users/je.petit/Downloads/Hysplit GDAS/ >>CONTROL
echo gdas1.feb16.w4 >>CONTROL
echo C:/Users/je.petit/Downloads/ >>CONTROL
echo trajMetz16030100 >>CONTROL

\hysplit4\exec\hyts_std

but then it doesn't do any calculations... am i doing smoething wrong ?
glenn.rolph
Posts: 362
Joined: November 7th, 2012, 1:39 pm
Registered HYSPLIT User: Yes

Re: Calling Hysplit from external soft

Post by glenn.rolph »

Look in the MESSAGE file for errors. It probably does not like the space in the name of the met file directory.
Post Reply

Return to “Users”