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:
    > http://www.rap.ucar.edu/~gthompsn/test/nh_snow.gif
    >
    > 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

    Greg,

    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:

    http://ngwww.ucar.edu/ngdoc/ng/ref/ncl/NclVariables.html#NamedSubscripting

    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.

    --Mary

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



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