Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Bewildered graphs

Reply
Thread Tools

Bewildered graphs

 
 
Mark Fenbers
Guest
Posts: n/a
 
      07-05-2003
I am investigating Python for the sake of ultimately generating hydrographs
(such as this: http://ahps.erh.noaa.gov/iln/ahps/Ri...gifs/prgo1.png)
on-the-fly from a web server cluster. I have not used Python previously and do
not yet know if Python is very useful for this or if I am wasting my time.

Quite frankly, I am a little bewildered. Not only is there Python, but there
are many extention modules which cloud up my view as to what I will need.
There's Scientific Python, which sounds promising, but there's also SciPy which
in itself has gnuplot, xplt and plt modules. I know enough about gnuplot to
know that it won't meet my needs because I need to be able to shade regions
above certain values such as done in yellow on the example hydrograph (the link
above). It also doesn't have many font options or the ability to place an image
such as the NOAA logo.

Can someone kindly guide me as to what I would most likely need to replicate the
graph shown via the link above?

Mark

 
Reply With Quote
 
 
 
 
Jeffrey.S.Whitaker@noaa.gov
Guest
Posts: n/a
 
      07-05-2003
On Sat, 5 Jul 2003, Mark Fenbers wrote:

> I am investigating Python for the sake of ultimately generating hydrographs
> (such as this: http://ahps.erh.noaa.gov/iln/ahps/Ri...gifs/prgo1.png)
> on-the-fly from a web server cluster. I have not used Python previously and do
> not yet know if Python is very useful for this or if I am wasting my time.
>
> Quite frankly, I am a little bewildered. Not only is there Python, but there
> are many extention modules which cloud up my view as to what I will need.
> There's Scientific Python, which sounds promising, but there's also SciPy which
> in itself has gnuplot, xplt and plt modules. I know enough about gnuplot to
> know that it won't meet my needs because I need to be able to shade regions
> above certain values such as done in yellow on the example hydrograph (the link
> above). It also doesn't have many font options or the ability to place an image
> such as the NOAA logo.
>
> Can someone kindly guide me as to what I would most likely need to replicate the
> graph shown via the link above?
>


Mark:

NCL (http://www.cgd.ucar.edu/nclapps/gsn/) will do what you need. I've
written a simple python module that allows you to embed NCL scripts in
python code (http://www.cdc.noaa.gov/~jsw/python/pyncl.html).

http://www.ccsm.ucar.edu/csm/support...cs/index.shtml has some
nice NCL plotting examples.

-Jeff


--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449
325 Broadway Web : http://www.cdc.noaa.gov/~jsw
Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124
 
Reply With Quote
 
 
 
 
John J. Lee
Guest
Posts: n/a
 
      07-05-2003
Mark Fenbers <(E-Mail Removed)> writes:

> I am investigating Python for the sake of ultimately generating
> hydrographs (such as this:
> http://ahps.erh.noaa.gov/iln/ahps/Ri...gifs/prgo1.png)
> on-the-fly from a web server cluster. I have not used Python
> previously and do not yet know if Python is very useful for this or
> if I am wasting my time.


I've done a lot of plotting with Python in the past. The issue is
really which plotting package(s) you pick rather than anything to do
with Python itself (and nobody here is likely to argue with your
choice of language, of course!).


> Quite frankly, I am a little bewildered. Not only is there Python,
> but there are many extention modules which cloud up my view as to
> what I will need.


Certainly a year or two ago there was no single free plotting package
around (Python or no Python) that was everything I needed -- and I was
usually plotting pretty straightforward graphs. Things may have
improved a bit since then, but I certainly think it's worth
considering using a commercial package (from Python). Presumably you
already use a package of some kind to plot these things? Most
commercial packages seem to have an API of some sort, so try googling
for a Python binding for it -- one may well already exist.

Otherwise, I'm out of date so can't give you a simple 'use this', but
in general:

Just to confuse you further, another option is to use a generic
plotting library, rather than one designed specifically for graphs.
If the format of your graphs isn't going to change, that might be a
reasonable choice. You end up with more code, but you avoid having to
figure out how to tickle exactly what you want out of a reluctant
plotting package. In particular, you can be sure you won't get stuck
in the 'so far and no further' situation that graphing packages can
leave you in.

I'd probably first run though the demos that invariably come with the
graphing packages, and if it wasn't fairly obvious that a) all the
necessary features were there in one of them and b) reasonably clear
the example code / docs c) lightweight enough not to bring your web
server to its knees, I'd try a generic plotting library. Ordered by
my guess of most appropriate first: PIL, PIDDLE, reportlab (nicer API
than PIDDLE; pdf output, but you could probably convert to .png easily
enough), plotutils, sketch.

Of the graph plotting packages, some that should get the job done:

Grace (grace_np.py)
API documentation poor last time I looked, but does everything you
could want, and has a (rather nasty) GUI interface too, so you can
tweak graphs for publication. If load on the web server is high, it
might be too heavyweight, though.

DISLIN (pxDislin)
You probably want the pxDislin binding, not the one distributed with
DISLIN itself.

Chaco
Haven't used this. Probably a nice API, but looks like it's still
not very capable.

Lots of others too, I'm afraid: PLPLOT, PGPLOT, gnuplot, Qwt,
scigraphica...


> There's Scientific Python, which sounds promising, but there's also
> SciPy which


I haven't used the plotting software from either (I don't think
Scientific Python had any plotting code when I used it). In general,
they do different things. One obvious difference is that Scientific
Python is (mostly, at least) new, pure Python code, where SciPy wraps
a lot of old, well-tested Fortan, C and C++ code (but no doubt there's
a fair amount of pure Python code there too). Both approaches have
pros and cons, and the particular codes in SciPy and Scientific Python
have different objectives, of course.


John
 
Reply With Quote
 
Will Stuyvesant
Guest
Posts: n/a
 
      07-05-2003
> [Mark Fenbers]
> I am investigating Python for the sake of ultimately generating hydrographs
> (such as this: http://ahps.erh.noaa.gov/iln/ahps/Ri...gifs/prgo1.png)
> on-the-fly from a web server cluster.


You are thinking about generating a .PNG or .JPG or .GIF or something
like that?

I have an idea: if your app is running on a web server cluster
already, how about generating dynamic web pages displaying the graph.
You could for example display this whole picture with SVG
(http://www.w3.org/TR/SVG/ ). Even a simple CGI script in Python
generating HTML plus CSS using "position: absolute" can do much like
this. Note the BIG advantage of such a web application: everybody can
use it with their browser; no installations, compilations,
configurations. And the best way to generate SVG or HTML with Python
from CGI is just using the string library and writing your own
functions for things you notice you do often.

[
I *know* they plan to deprecate the string library. But most web
hosting Pythons are still 1.5.2 :-!
]

--
Do you feel lucky punk?
Make my day.
 
Reply With Quote
 
Bengt Richter
Guest
Posts: n/a
 
      07-05-2003
On Sat, 05 Jul 2003 08:07:24 -0400, Mark Fenbers <(E-Mail Removed)> wrote:

>This is a multi-part message in MIME format.
>--------------3C30E07F2D1A81BA8EE2E6DB
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>
>I am investigating Python for the sake of ultimately generating hydrographs
>(such as this: http://ahps.erh.noaa.gov/iln/ahps/Ri...gifs/prgo1.png)
>on-the-fly from a web server cluster. I have not used Python previously and do
>not yet know if Python is very useful for this or if I am wasting my time.
>
>Quite frankly, I am a little bewildered. Not only is there Python, but there
>are many extention modules which cloud up my view as to what I will need.
>There's Scientific Python, which sounds promising, but there's also SciPy which
>in itself has gnuplot, xplt and plt modules. I know enough about gnuplot to
>know that it won't meet my needs because I need to be able to shade regions
>above certain values such as done in yellow on the example hydrograph (the link
>above). It also doesn't have many font options or the ability to place an image
>such as the NOAA logo.
>
>Can someone kindly guide me as to what I would most likely need to replicate the
>graph shown via the link above?
>

Have you asked them what they use to generate it? If it's free software, chances are
someone has done a Python interface (noaa.gov is paid for with taxes AFAIK, so it ought
to be free at least for US citizens, IWT

If not, it would at least make searching for a clone/workalike easier.

Regards,
Bengt Richter
 
Reply With Quote
 
Tim Churches
Guest
Posts: n/a
 
      07-05-2003
On Sat, 2003-07-05 at 22:07, Mark Fenbers wrote:
> I am investigating Python for the sake of ultimately generating hydrographs
> (such as this: http://ahps.erh.noaa.gov/iln/ahps/Ri...gifs/prgo1.png)
> on-the-fly from a web server cluster. I have not used Python previously and do
> not yet know if Python is very useful for this or if I am wasting my time..
>
> Quite frankly, I am a little bewildered. Not only is there Python, but there
> are many extention modules which cloud up my view as to what I will need.
> There's Scientific Python, which sounds promising, but there's also SciPy which
> in itself has gnuplot, xplt and plt modules. I know enough about gnuplot to
> know that it won't meet my needs because I need to be able to shade regions
> above certain values such as done in yellow on the example hydrograph (the link
> above). It also doesn't have many font options or the ability to place an image
> such as the NOAA logo.
>
> Can someone kindly guide me as to what I would most likely need to replicate the
> graph shown via the link above?


There are indeed many options. But you might want to have a look at the
delightfully named Ploticus (starring Russell Crowe...) at
http://ploticus.sourceforge.net/doc/Welcome.html

There is no Python interface for it, but Python is an ideal tool for
building Ploticus scripts on-the-fly and running Ploticus to create the
graphs on the Web server.

However, Ploticus has recently become available as a callable library
(libploticus) with a very simple C API which is just crying out for a
Python wrapper - and a set of Python classes to abstract the interface
on top of that. I would be happy to contribute to such a project, but am
not able to undertake the construction of a C language wrapper.

If you also need statistical analysis, I can recommend RPy (see
http://rpy.sf.net) which embeds the R statistical package in Python. R
does very, very nice graphics in all sorts of styles (see
http://www.r-project.org), although it can be overkill for some Web
server applications. Ploticus is very lightweight by comparison.

--

Tim C

PGP/GnuPG Key 1024D/EAF993D0 available from keyservers everywhere
or at http://members.optushome.com.au/tchur/pubkey.asc
Key fingerprint = 8C22 BF76 33BA B3B5 1D5B EB37 7891 46A9 EAF9 93D0



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQA/B1uZeJFGqer5k9ARAncLAJ4qOgC4y2PGbTUXsLKlKb2qZ+BRgA CgvN/1
fjyfg7b63oxWQTwgb5kd17k=
=bJlA
-----END PGP SIGNATURE-----

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A Guide To AES Encryption For The Terminally Bewildered Lawrence D'Oliveiro NZ Computing 0 09-26-2009 01:06 AM
PDM graphs marco74 Cisco 0 09-22-2005 03:37 PM
Bewildered: "my" variable drops out of scope John Doe Perl Misc 3 02-17-2004 08:00 PM
Confused and bewildered. DJ Miller ASP .Net 4 09-04-2003 06:10 PM
audio video application graphs srini VHDL 0 06-26-2003 07:10 AM



Advertisments