Skip to content

Commit 822ea19

Browse files
author
Jeff Whitaker
committed
Revert "Merge pull request #138 from j08lue/master" in light of issue
139. This reverts commit 4b459b0, reversing changes made to a68aeb3.
1 parent 4b459b0 commit 822ea19

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

Changelog

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ version 1.0.8 (not yet released)
66
ability to fill counties with specified matplotlib color argument.
77
* fix drawgreatcircle bug so that lines exiting and reentering a projection
88
region don't draw horizontally across the map.
9-
* change addcyclic so that it works for ND-arrays with an optional 'axis' parameter.
109

1110
version 1.0.7 (git tag v1.0.7rel)
1211
---------------------------------

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,4 @@ Jeff Whitaker <[email protected]>
108108

109109
##Thanks
110110

111-
Special thanks to John Hunter, Andrew Straw, Eric Firing, Rob Hetland, Scott Sinclair, Ivan Lima, Erik Andersen, Michael Hearne, Jesper Larsen, Ryan May, David Huard, Mauro Cavalcanti, Chris Murphy, Pierre Gerard-Marchant, Christoph Gohlke, Eric Bruning, Stephane Raynaud, Tom Loredo, Patrick Marsh, Jonas Bluethgen, Phil Elson, and Henry Hammond for valuable contributions.
111+
Special thanks to John Hunter, Andrew Straw, Eric Firing, Rob Hetland, Scott Sinclair, Ivan Lima, Erik Andersen, Michael Hearne, Jesper Larsen, Ryan May, David Huard, Mauro Cavalcanti, Chris Murphy, Pierre Gerard-Marchant, Christoph Gohlke, Eric Bruning, Stephane Raynaud, Tom Loredo, Patrick Marsh, Phil Elson, and Henry Hammond for valuable contributions.

lib/mpl_toolkits/basemap/__init__.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5087,25 +5087,28 @@ def shiftgrid(lon0,datain,lonsin,start=True,cyclic=360.0):
50875087
dataout[...,i0_shift:] = datain[...,start_idx:i0+start_idx]
50885088
return dataout,lonsout
50895089

5090-
def addcyclic(*arr,**axiskwarg):
5090+
def addcyclic(arrin,lonsin):
50915091
"""
5092-
``arrout, lonsout = addcyclic(arrin,lonsin,axis=-1)``
5093-
adds cyclic (wraparound) points in longitude to one or several arrays,
5094-
(e.g. ``arrin`` and ``lonsin``),
5095-
where ``axis`` sets the dimension longitude is in (optional, default: right-most).
5092+
``arrout, lonsout = addcyclic(arrin, lonsin)``
5093+
adds cyclic (wraparound) point in longitude to ``arrin`` and ``lonsin``,
5094+
assumes longitude is the right-most dimension of ``arrin``.
50965095
"""
5097-
# get axis keyword argument (default: -1)
5098-
axis = axiskwarg.get('axis',-1)
5099-
# define function for a single grid array
5100-
def _addcyclic(a):
5101-
aT = np.swapaxes(a,0,axis)
5102-
idx = np.append(np.arange(aT.shape[0]),0)
5103-
return np.swapaxes(aT[idx],axis,0)
5104-
# process array(s)
5105-
if len(arr) == 1:
5106-
return _addcyclic(arr[0])
5096+
nlons = arrin.shape[-1]
5097+
newshape = list(arrin.shape)
5098+
newshape[-1] += 1
5099+
if ma.isMA(arrin):
5100+
arrout = ma.zeros(newshape,arrin.dtype)
51075101
else:
5108-
return map(_addcyclic,arr)
5102+
arrout = np.zeros(newshape,arrin.dtype)
5103+
arrout[...,0:nlons] = arrin[:]
5104+
arrout[...,nlons] = arrin[...,0]
5105+
if ma.isMA(lonsin):
5106+
lonsout = ma.zeros(nlons+1,lonsin.dtype)
5107+
else:
5108+
lonsout = np.zeros(nlons+1,lonsin.dtype)
5109+
lonsout[0:nlons] = lonsin[:]
5110+
lonsout[nlons] = lonsin[-1] + lonsin[1]-lonsin[0]
5111+
return arrout,lonsout
51095112

51105113
def _choosecorners(width,height,**kwargs):
51115114
"""

0 commit comments

Comments
 (0)