geodat.arrays

geodat.arrays.apply_along_axis(func, axis, arr, chunk_size=10000, do_parallel=True, *args, **kwargs)[source]

This seems to be about 3 times faster than numpy.apply_along_axis

geodat.arrays.find_1d(arr, criterion, nresult=1, result_func=<function <lambda> at 0x4206de8>, fillvalue=None)[source]

arr (numpy.array) criterion (function that returns boolean), e.g. lambda v: v > 2 nresult (str) - number of results (1 means return the first result) result_func (function that accepts (int,value))- by default returns the

index i and the value x i.e. lambda i,x: (i,x)
geodat.arrays.find_ind(arr, axis, func)[source]

Find the first index where func(arr) is true along axis func has to return a numpy boolean array

geodat.arrays.find_ind2(arr, axis, func, nresult=1)[source]

Find the index(indices) of the first nresult value(s) that fulfils func

geodat.arrays.find_loc(arr, axis, value, x, kind='linear', bounds_error=False, **kwargs)[source]

Find the x along an axis where arr == value using scipy.interpolation.interp1d

geodat.arrays.find_loc2(arr, axis, value, x)[source]

Find the x along an axis where arr == value using linear interpolation arr is assumed to be monotonic along the selected axis

geodat.arrays.find_loc2p1(arr, axis, value, x, masked_value=None)[source]

Find the x along an axis where arr == value using linear interpolation arr is assumed to be monotonic along the selected axis

geodat.arrays.find_loc3(arr, axis, value, x, kind='linear', bounds_error=False, **kwargs)[source]

Find the x along an axis where arr == value using scipy.interpolation.interp1d

geodat.arrays.find_max(arr, axis)[source]

Just to make sure it replicates the builtin numpy function

geodat.arrays.find_value(arr, axis, func, nresult=1)[source]

Find the first nresult values that fulfils func

geodat.arrays.fix_longitude(axis, modulo=360.0)[source]

Add modulo (default 360.) in-place to the points beyond which discontinuity occurs

Arguments: axis – numpy 1d array

geodat.arrays.getSlice(axis, lower, upper, modulo=None)[source]

Given a numpy array, return a slice that extracts the entries where lower<=array<=upper.

The function also takes an optional argument “modulo” For example, x = numpy.arange(12) getSlice(x,4,9,modulo=6) returns slice(5,

geodat.arrays.getSlice_chunk(arr, niter=10, istep=None, idim_iter=0)[source]

A generator that run the func iteratively in chunk Iterate through the idim_iter-th dimension along arr arr = numpy.array niter = number of iteration (or minus 1) iarg_iter = the index of which element in args is to be iterated over istep would over-run niter For example, x = numpy.arange(34).reshape(17,2) gen = getSlice_chunk(x,niter=3,idim_iter=0) gen.next() —> slice(0,5) gen.next() —> slice(5,10) gen.next() —> slice(10,15) gen.next() —> slice(15,17)

geodat.arrays.is_strict_monotonic_func(axis)[source]

Check whether axis is a strictly monotonic function

Parameters:axis (1d numpy.ndarray) –
Returns:bool
Fork me on GitHub