[Thread Prev][Thread Next][Index]

Re: [ferret_users] Pyferret, jupyter notebook and ferretmagic




However, the pyferret module needs to be found in order to use these pyferret methods.  If the pyferret module is not found when importing, then its location needs to be added to sys.path.  So something like the following, where ferdir is the (string) location of the PyFerret installation and ferdat is the (string) location of the datasets directory:
    import sys 
    sys.path.insert(1, '%s/lib/python%d.%d/site-packages' % (ferdir, sys.version_info[0], sys.version_info[1]))
    import pyferret
    pyferret.addenv(FER_DIR=ferdir, FER_DAT=ferdat)
    pyferret.start(journal=False, quiet=True, unmapped=True) 

Thanks for the help. It works now, great !

By the way : should it be FER_DAT or FER_DATA ?


Following what was done in the Finstall script, FER_DAT is not actually used by Ferret/PyFerret, but instead is used to assign/add values to FER_DATA ($FER_DAT/data), FER_DESCR ($FER_DAT/descr) and FER_GRIDS ($FER_DAT/grids) - which are used by Ferret/PyFerret.  (Note that FER_DIR has similar behavior - defining values for other environment variables which are used by Ferret/PyFerret.)

So FER_DAT if you want those subdirectories added to those three environment variables, or FER_DATA if you just want the directory given added to that one environment variable.

Best,
Karl

--
Karl M. Smith, Ph.D.
JISAO Univ. Wash. and PMEL NOAA
"The contents of this message are mine personally and do
not necessarily reflect any position of the Government
or the National Oceanic and Atmospheric Administration."

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

Privacy Policy | Disclaimer | Accessibility Statement