Commit de3bc133 authored by Theo Steininger's avatar Theo Steininger

Optimized GLSpace.weight

parent 40ed2574
......@@ -131,10 +131,9 @@ class GLSpace(Space):
def weight(self, x, power=1, axes=None, inplace=False):
nlon = self.nlon
nlat = self.nlat
vol = gl.vol(nlat) ** power
weight = np.array(list(itertools.chain.from_iterable(
itertools.repeat(x ** power, nlon)
for x in gl.vol(nlat))))
itertools.repeat(x, nlon) for x in vol)))
if axes is not None:
# reshape the weight array to match the input shape
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment