Re: reorder problem

From: Mary Haley (haley AT ucar.edu)
Date: Mon Aug 29 2005 - 16:46:00 MDT

  • Next message: jerry: "plot resource"

    On Mon, 29 Aug 2005, Chao Luo wrote:

    > I have some troubles to reorder the data. I have two dimensional soil
    > moisture data. The original data are ordered N->S and start 180. I want
    > to reorder latitude from N->S to S->N, and first longitude from 180.0 to
    > 0.0.
    >
    > Thanks for any help offered!
    >
    > Chao
    >

    Dear Chao,

    First, to reverse the order of a particular dimension, you can use
    the (::-1) syntax. For example, if "t" is an array whose dimensions
    are lat x lon, and you want to reverse the latitude values, you
    would use:

        tnew = t(::-1,:)

    To additionally reorder your longitude values so that they start at a
    different longitude point, you should use the contributed function
    "lonPivot":

         http://www.ncl.ucar.edu/Document/Functions/Contributed/lonPivot.shtml

    You need to load the "contributed.ncl" script to have access to this
    function.

    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

    ...

       tnew = lonPivot(t(::-1,:),180.)

    --Mary

    _______________________________________________
    ncl-talk mailing list
    ncl-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Mon Aug 29 2005 - 17:02:39 MDT