@@ -4919,7 +4919,8 @@ def shiftgrid(lon0,datain,lonsin,start=True,cyclic=360.0):
4919
4919
lon0 starting longitude for shifted grid
4920
4920
(ending longitude if start=False). lon0 must be on
4921
4921
input grid (within the range of lonsin).
4922
- datain original data.
4922
+ datain original data with longitude the right-most
4923
+ dimension.
4923
4924
lonsin original longitudes.
4924
4925
============== ====================================================
4925
4926
@@ -4958,20 +4959,12 @@ def shiftgrid(lon0,datain,lonsin,start=True,cyclic=360.0):
4958
4959
lonsout [0 :i0_shift ] = lonsin [i0 :]
4959
4960
else :
4960
4961
lonsout [0 :i0_shift ] = lonsin [i0 :]- cyclic
4961
- if datain .ndim == 2 :
4962
- dataout [:,0 :i0_shift ] = datain [:,i0 :]
4963
- elif datain .ndim == 1 :
4964
- dataout [0 :i0_shift ] = datain [i0 :]
4965
- else :
4966
- raise ValueError ('data must be 1d or 2d with longitude as 2nd dim' )
4962
+ dataout [...,0 :i0_shift ] = datain [...,i0 :]
4967
4963
if start :
4968
4964
lonsout [i0_shift :] = lonsin [start_idx :i0 + start_idx ]+ cyclic
4969
4965
else :
4970
4966
lonsout [i0_shift :] = lonsin [start_idx :i0 + start_idx ]
4971
- if datain .ndim == 2 :
4972
- dataout [:,i0_shift :] = datain [:,start_idx :i0 + start_idx ]
4973
- elif datain .ndim == 1 :
4974
- dataout [i0_shift :] = datain [start_idx :i0 + start_idx ]
4967
+ dataout [...,i0_shift :] = datain [...,start_idx :i0 + start_idx ]
4975
4968
return dataout ,lonsout
4976
4969
4977
4970
def addcyclic (arrin ,lonsin ):
0 commit comments