[Thread Prev][Thread Next][Index]

Re: [ferret_users] running ferret.jnl script in python



Dear Ranjan,

On Mon, Oct 17, 2022 at 4:44 PM Ranjan Kumar Sahu <ranzan998@xxxxxxxxx> wrote:
dear ferrters,
So, I am using python. There is a ferret.jnl script that needs to be run inside a python script.
you may ask, why?  The answer is, file handing(i.e, data variables and attributes ) is quite good in ferret, while python has its own upsides.
If there is any such way to do that, I would be glad to hear about it.

I'm sure there are a lot of more knowledgeable people about python than me, but . . . 

First of all, I'll assume you can run your ferret script, ferret.jnl, on the terminal (command line) as

pyferret -script ferret.jnl

Then, from within your python program, you do the same:

os.system("pyferret -script ferret.jnl")

or

import subprocess
subprocess.run(["pyferret", "-script", "ferret.jnl"])

See

https://stackoverflow.com/questions/89228/how-do-i-execute-a-program-or-call-a-system-command 

I'm sure there are ways to directly call Ferret's functionalities from within python without going through a ferret script (ferret.jnl).

Best regards,

Ryo


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement