Skip to content
Prev 369557 / 398503 Next

Reversing one dimension of an array, in a generalized case

Thanks to all for responses/.  There was a question of exactly what was wanted.  It is the generalization of the obvious example I gave,
so that

junk[1,1,1 ] = junk1[1,10,1]
junk[1,2,1]  = junk1[1,9,1]

etc.

The genesis of this is the program is downloading data from a variety of sources on (time, altitude, lat, lon) coordinates,  but all the coordinates are not always there, and sometime the latitude coordinates go from north to south and sometimes from south to north.  I want to always return the data going from south to north, so if I find that the data is north to south,  I have to first reverse the array with the coordinate values (easy enough),  and then reverse the one dimension in the data array that corresponds to latitude. The downloaded information tells me which dimension is latitude plus how many coordinates are in the data.

As I the said,  I haven't done extensive testing on what Bert sent,  but on a toy 3-dimensional example I have it appeared to do what I want.

Thanks again,

-Roy
**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new street address***
110 McAllister Way
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: Roy.Mendelssohn at noaa.gov www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected" 
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.