Re: reorder array indicies

From: Mary Haley (haley AT XXXXXX)
Date: Mon Feb 24 2003 - 13:18:23 MST

  • Next message: Paul Nutter: "Converting Time in NetCDF Reanalysis"

    > I know I've seen this answer before and I apologize for repeating this
    > type of question. I need help re-ordering my 2-D array. There's a trick
    > to doing this without a doubly-nested do loop (expensive) but I cannot
    > recall how.
    > I ingest a 2-D array from a variable within a GRIB file:
    > snow = file1->SNO_D_GDS5_SFC
    > and it creates the following plot:
    > I can easily rotate the map 90 degrees clockwise but I also need to
    > rotate the data grid the same amount. Thanks for any help offerred.
    > -- Greg Thompson NCAR/RAP


    If I'm understanding your question correctly, here's how you would
    reorder your array (I'm assuming your array is 2D in this case):

       snow = file1->SNO_D_GDS5_SFC
       snow!0 = "x"
       snow!1 = "y"

       snow_reorder = snow(y|:,x|:)

    For more info, see:

    Of course, if the dimensions are already named, then you can skip the
    naming of the dimensions, and just use the dimension names that
    already exist.


    ncl-talk mailing list
    ncl-talk AT

    This archive was generated by hypermail 2b29 : Mon Feb 24 2003 - 13:19:26 MST