SUBROUTINE RESHUFFLE(x,x2,iddif,jddif,idstart,idend, * jdstart,jdend,idim,jdim) C RESHUFFLE SHUFFLES A DATA ARRAY TO ALIGN THE DATA WITH C THE BEGINNING AND ENDING LONGITUDES. THIS VERSION IS C FOR REAL DATA c******************************************************** c c Passed Arrays c x - original data array c x2 - shuffled data array c iddif - number of horizontal spacings c jddif - number of vertical spacings c idstart - starting horizontal value c idend - ending horizontal value c jdstart - starting vertical value c jdend - ending vertical value c idim - total horizontal spacings c jdim - total vertical spacings c c********************************************************* dimension x(idim,jdim), x2(iddif,jddif) c********************************************************* c c i2 is the shuffled horizontal position c j2 is the shuffled vertical position c c Reset j2 to start and reset i2 every time through c the vertical loop c c********************************************************* j2=0 do 25 j=jdstart,jdend i2=0 j2=j2+1 c********************************************************* c c If the starting horizontal idices is less than the c ending value, simply substitute in values in output c array. c c********************************************************* if ( idstart .lt. idend ) then do 34 i=idstart,idend i2= i2+1 x2(i2,j2) = x(i,j) 34 continue else c********************************************************** c c If idstart is greater than idend, the values must rap around. c Run through all values from idstart to idim, placing c the values in their shuffled position in the temporary c array c c********************************************************** do 26 i=idstart,idim i2=i2+1 x2(i2,j2) = x(i,j) 26 continue c*********************************************************** c c Run through all values from 1 to idend c c*********************************************************** do 27 i=1,idend i2=i2+1 x2(i2,j2) = x(i,j) 27 continue endif 25 continue return end