[gradsusr] Ascending order in GrADS!

Arlindo da Silva dasilva at alum.mit.edu
Wed Sep 7 17:16:34 EDT 2011


On Wed, Sep 7, 2011 at 3:14 PM, Anderlan Siqueira <
anderlansiqueira at gmail.com> wrote:

> Hello dear users,
>
> I want to sort the data for each grid point GrADS in ascending order.
> I have a file 50 times and I want the values for each point lies
> from smallest to largest. For example, for point 1: 3 4 5 7 8 9 would
> look like, 3 4 5 7 8 9. In this case also would have a resulting file
> with 50 time and each grid point with values in ascending order.
> This is the first time have the lowest time and 50 the highest values.
>
> Who can help me thank you.
>
> I read some things about Bubble sort.
>
>
This is something that would be very easy to do in pygrads, for example:

ga.open("model")
ga("set t 1 5")
ts = sort(ga.exp('ts'),axis=0)

At this point you can write ts to a file or send it back to grads with the
ga.imp() method. This requires that the data array fits in memory. You will
need to learn some python, something that would open lots of possibilities
for data analysis beyond what can be done with grads.  More info on pygrads
here:

     http://opengrads.org/wiki/index.php?title=Python_Interface_to_GrADS

BTW, PyGrADS works well with the Enthought Python Distribution (EPD), see:

     http://www.enthought.com/products/epd.php

  Arlindo

-- 
Arlindo da Silva
dasilva at alum.mit.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110907/3d8aeab1/attachment-0003.html 


More information about the gradsusr mailing list