@@ -5087,23 +5087,25 @@ def shiftgrid(lon0,datain,lonsin,start=True,cyclic=360.0):
5087
5087
dataout [...,i0_shift :] = datain [...,start_idx :i0 + start_idx ]
5088
5088
return dataout ,lonsout
5089
5089
5090
- def addcyclic (arr ,axis = - 1 ):
5090
+ def addcyclic (* arr ,** axiskwarg ):
5091
5091
"""
5092
- ``arrout, lonsout = addcyclic(( arrin, lonsin) ,axis=-1)``
5092
+ ``arrout, lonsout = addcyclic(arrin,lonsin,axis=-1)``
5093
5093
adds cyclic (wraparound) points in longitude to one or several arrays,
5094
5094
(e.g. ``arrin`` and ``lonsin``),
5095
- where ``axis`` sets the dimension longitude is in (default: right-most).
5095
+ where ``axis`` sets the dimension longitude is in (optional, default: right-most).
5096
5096
"""
5097
+ # get axis keyword argument (default: -1)
5098
+ axis = axiskwarg .get ('axis' ,- 1 )
5097
5099
# define function for a single grid array
5098
5100
def _addcyclic (a ):
5099
5101
aT = np .swapaxes (a ,0 ,axis )
5100
5102
idx = np .append (np .arange (aT .shape [0 ]),0 )
5101
5103
return np .swapaxes (aT [idx ],axis ,0 )
5102
- # process eventual list/tuple of arrays
5103
- if isinstance (arr , list ) or isinstance ( arr , tuple ) :
5104
- return map ( _addcyclic , arr )
5104
+ # process array(s)
5105
+ if len (arr ) == 1 :
5106
+ return _addcyclic ( arr [ 0 ] )
5105
5107
else :
5106
- return _addcyclic ( arr )
5108
+ return map ( _addcyclic , arr )
5107
5109
5108
5110
def _choosecorners (width ,height ,** kwargs ):
5109
5111
"""
0 commit comments