From: Arlindo da S. <da...@al...> - 2008-01-04 15:36:24
|
All, I just placed a pygrads tarball on http://opengrads.org/pre-rel if you would like to give it a try. (So far tested on Mac OS X, Mandriva 2008 and Fedora 7). % tar xvfz pygrads-1.0.6.tar.gz and take a look at the README for installation info, requirements etc. You you want to run the examples: % cd pygrads-1.0.6/examples % ./galab_examples.py this will generate a bunch of .png files. If you have imagemagick installed, you can see a "slide show" with the command: % animate -delay 300 *.png Notice that the "galab examples" require Matplotlib with the basemap toolkit, see the README. Pat: would you consider packaging pygrads for Fedora? It already has all the requirements. I believe that if you enter % python setup.py bdist_rpm it will create the RPM for you, but you may need to tweak setup.py to specify the dependencies. Arlindo -- Arlindo da Silva da...@al... |
From: Arlindo da S. <da...@al...> - 2008-01-10 01:08:49
|
On Jan 9, 2008 8:44 AM, Mike Fiorino <mfi...@gm...> wrote: > dear arlindo, > > i'm back in the office after the holidays in CA and finally grabbed the > latest pygrads... i also install PIL.. > How about the basemaps. Because the map datasets it is a relatively large tarball they do not include it in the standard Matplotlib, you need an additional install. See the readme file. > > when i try running the examples: > > kishou.nhc.noaa.gov[W2]:/home/work/wxmap2/trunk/src/opengrads/pygrads- > 1.0.6/examples > 208 > ./galab_examples.py > Traceback (most recent call last): > File "./galab_examples.py", line 149, in ? > ga = GaLab(Bin='gradsnc',Window=False,Echo=False) > NameError: name 'GaLab' is not defined > This usually means that you do not have some of the dependencies. I designed the grads package in a way that when you import it, only imports modules that *can* are imported; in retrospect, it is perhaps too quiet. Here is how to diagnose the problem: start pygrads and at the ga-> prompt type "import galab", the error messages should tell you what you are missing. > > also in checked the tests/grads_tests.sh and it looks hardwired for a > particular grads/src? > Yeah, "grads_tests.sh" is something Pat introduced specifically for the "make check" in autotools. Run "grads_tests.py" instead. Outside the GrADS build environment you will need to specify the location of your grads binaries. Type "grads_tests.py -h" for more info. However, these tests are meant to test the grads binaries and only uses module gacore.py. > > some news from CA: > > bob drach says the lab is finally acting on converted lats to > opensource; not sure when but at least it's in the works. This is great news! Pat will finally be able to have a complete Fedora package. > > bob was very interested in pygrads, especially passing data to/from > grads/python. bob also was surprised that you think perl is faster with > numbers the python and numpy, his impression was that python was on par > with other languages. I read this in a couple of places, including a article implementing fractal algorithms. Although to be taken with a grain of salt, I heard the same in the PDL list as well. It would be nice to come up with a benchmark relevant to our problem. I like Matplotlib, but performance is lousy compared to GrADS. > i'm glad to see you getting into python, i have a > lot of legacy grads scripts that i would like to convert over... > It would be nice to inline them. Something like: def test(arg): return ga.inline(arg, """ function test(arg) i = 3*arg return i """) So, >>> print test(7) 21 We just need a version of run that reads from stdin. (I am avoiding exchange files for performance reasons). It may be less work than convert a bunch of scripts... > > thanks and best regards, mike > Let me know if basemaps fixes your problem. Cheers! Arlindo -- Arlindo da Silva da...@al... |
From: Arlindo da S. <da...@al...> - 2008-01-14 19:45:59
|
On Jan 4, 2008 10:36 AM, Arlindo da Silva <da...@al...> wrote: > All, > > I just placed a pygrads tarball on http://opengrads.org/pre-rel if you > would like to give it a try. (So far tested on Mac OS X, Mandriva 2008 and > Fedora 7). > I just replaced the tarball with v1.0.7 that includes bug fixes I did over the weekend. I also included ganum_examples.py which exercises the NumPy dependent portion of the package, in particular the EOF calculator and the least square estimator. Another important update is that I redesigned the class that represents a grads field in python. GaField is now a subclass of the numpy.ma.MaskedArrayclass and most of the algebraic operators have been overloaded (some issues with slicing still remains but it is not critical). This greatly simplifies the syntax: ts = ga.exp('ts') # export 'ts' to python ts = ts - 273 # change units in python ga.imp('tc',ts) # put it back into grads as defined variable "tc" You can display it in GrADS: ga("display tc") or with Matplotlib: ga.imshow(ts) The "grid" attribute containing coordinate variables and the like are now fairly hidden. Also, GaField are masked arrays, so it works pretty much as in GrADS v2. One last feature is that the grads object is now "callable", so these 2 are equivalent: ga.cmd("display ts") ga("display ts") I have not update the wiki, but the docstrings should be current. Arlindo -- Arlindo da Silva da...@al... |