[Thread Prev][Thread Next][Index]

[ferret_users] Yes, pyferret is for ferret users!

Hi all

We've had some recent conversations with Ferret users who haven't updated to PyFerret because they don't know Python, or they're worried that they'll have to change all their existing ferret scripts, or think that PyFerret is difficult to install. None of these is the case.  Please try PyFerret and spread the word among your colleagues.

-- You don't need to know Python. PyFerret opens with the familiar "yes?" prompt. It runs Ferret commands and Ferret scripts. It has all of the functions of Ferret and is developed and maintained right along with Ferret so anything that's in Ferret is always in PyFerret. As with Ferret, you can also run big jobs in a "batch" mode without an open graphics window.  (You can also go into python from Ferret. If you do know python, write in with your examples and use cases!)

-- PyFerret is backwards compatible. The Ferret commands you use, including graphics commands, will work the same as in Ferret.  There are some extra options and expanded capabilities, but you can look into those later and just run your existing scripts as always.  Here's a good old fashioned Ferret session based on the FAQ on climatological anomalies.

yes? cancel mode logo
yes? use monthly_navy_winds
yes? let/title="`uwnd,return=title`" uwnd_of_interest = uwnd[t=15-jan-1983:15-jan-1991]
yes? let uwnd_climatology = uwnd_of_interest[gt=month_reg@mod]

yes? set window/aspect=0.4/size=0.4
yes? plot/x=180/y=40 uwnd_of_interest
yes? plot/x=180/y=40/overlay/nolab uwnd_climatology[t=15-jan-1983:15-jan-1991]

yes? annotate/norm/x=0.5/y=1.3/siz=.3/halign=0  "Climatological Anomaly Example"

yes? frame/file=line_plot.gif

If you run that with Ferret, it makes line_plot.gif (also attached to this message):

Ferret plot
Now, save those commands to a .jnl file and run it with PyFerret, just adding one line first to choose a different font:
> mv ferret.jnl anomaly_script.jnl

> pyferret
        PyFerret v7.4 (optimized)
        Linux 2.6.32-696.18.7.el6.x86_64 - 04/27/18
        27-Jun-18 16:05    

set text/font=helvetica
yes? go anomaly_script.jnl

PyFerret runs the script, and saves the image not as a .gif file but a .png.  Here's line_plot.png:

PyFerret plot

-- Installation is the same as for Ferret. Go to the PyFerret Downloads pages in the Ferret web pages which will take you to the GitHub Release page, https://github.com/NOAA-PMEL/PyFerret/releases (just as the Ferret Downloads page has links that take you to https://github.com/NOAA-PMEL/Ferret/releases), get the tar file, and run an install script. There are environment settings that need to be made, and a script is generated to make those settings. You can keep classic-Ferret installed, and run it with the same environment settings.

For lots more, see the PyFerret section in the green left-hand menu of the main Ferret Documentation page. In particular, for Ferret users:

https://ferret.pmel.noaa.gov/Ferret/documentation/pyferret/why-use-pyferret, including
  • Improved graphics
    • Unrestricted image size (display windows have scroll bars if appropriate)
    • Ability to directly save images in common formats (PNG, PS, PDF)
    • Interactive controls on display windows for scaling and saving
    • Precise control of line widths and text sizes
    • Control of color opacity and background color
    • On-the-fly animation works again ("Backing Store" not required)
    • Better-looking text when using Ferret's traditional fonts
    • Text drawn using standard fonts available on your machine
  • Many new statistical functions, taking advantage of SciPy's package of statistical functions
  • Shapefiles support functions, taking advantage of the PyShp package
https://ferret.pmel.noaa.gov/Ferret/documentation/pyferret/example-sessions-ferret  a few details about setup and some example sessions

https://ferret.pmel.noaa.gov/Ferret/documentation/pyferret/pyferret-quick-start-notes  new options from the Ferret command line: startup options; window settings; control over fonts and special symbols in text; new options for plot windows; control over line thickness and color; graphics output options such as png and svg.

And so on.  Throughout the Ferret manual, all PyFerret-specific information is set apart with a pink background,  as in this page about options for the FRAME command. Or check out this about embedding special characters in labels, or this on font and text settings.

Happy PyFerret-ing!


Attachment: line_plot.gif
Description: GIF image

Attachment: line_plot.png
Description: PNG image

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

Privacy Policy | Disclaimer | Accessibility Statement