@@ -5089,15 +5089,16 @@ def shiftgrid(lon0,datain,lonsin,start=True,cyclic=360.0):
5089
5089
5090
5090
def addcyclic (* arr ,** kwargs ):
5091
5091
"""
5092
- Adds cyclic (wraparound) points in longitude to one or several arrays,
5093
- the last array being longitudes in degrees. E .g.
5092
+ Adds cyclic (wraparound) points in longitude to one or several arrays,
5093
+ the last array being longitudes in degrees. e .g.
5094
5094
5095
5095
``data1out, data2out, lonsout = addcyclic(data1,data2,lons)``
5096
5096
5097
5097
============== ====================================================
5098
5098
Keywords Description
5099
5099
============== ====================================================
5100
- axis the dimension longitude is in (default right-most)
5100
+ axis the dimension representing longitude (default -1,
5101
+ or right-most)
5101
5102
cyclic width of periodic domain (default 360)
5102
5103
============== ====================================================
5103
5104
"""
@@ -5120,7 +5121,7 @@ def _addcyclic_lon(a):
5120
5121
# select the right numpy functions
5121
5122
npsel = np .ma if np .ma .is_masked (a ) else np
5122
5123
# get cyclic longitudes
5123
- clon = (np .take (a ,[0 ],axis = axis )
5124
+ clon = (np .take (a ,[0 ],axis = axis )
5124
5125
+ cyclic * np .sign (np .diff (np .take (a ,[0 ,- 1 ],axis = axis ),axis = axis )))
5125
5126
# ensure the values do not exceed cyclic
5126
5127
clonmod = npsel .where (clon <= cyclic ,clon ,np .mod (clon ,cyclic ))
0 commit comments