Numerical tools
Generate all combinations of grid point coordinates from x and y axes
Parameters: |
|
---|---|
Returns: |
|
Example
x = [1, 2, 3] y = [10, 20]
Ensure that sequence is a numeric array.
Parameters: |
|
---|---|
Raises: | Exception |
Returns: | An array of A if it is found to be of a numeric type |
Return type: | numpy.ndarray |
Note
that numpy.array(A, dtype) will sometimes copy. Use ‘copy=False’ to copy only when required.
This function is necessary as array(A) can cause memory overflow.
Approximation to ERF
Parameters: | z (numpy.ndarray, float) – input array or scalar to perform erf on |
---|---|
Returns: | the approximate error |
Return type: | numpy.ndarray, float |
from: http://www.cs.princeton.edu/introcs/21function/ErrorFunction.java.html Implements the Gauss error function. erf(z) = 2 / sqrt(pi) * integral(exp(-t*t), t = 0..z)
Fractional error in math formula less than 1.2 * 10 ^ -7. although subject to catastrophic cancellation when z in very close to 0 from Chebyshev fitting formula for erf(z) from Numerical Recipes, 6.2
Source: http://stackoverflow.com/questions/457408/ is-there-an-easily-available-implementation-of-erf-for-python
Convert geotransform to coordinate axes
Parameters: |
|
---|---|
Returns: | Two vectors (longitudes and latitudes) representing the grid defined by the geotransform. The values are offset by half a pixel size to correspond to pixel registration. I.e. If the grid origin (top left corner) is (105, 10) and the resolution is 1 degrees in each direction, then the vectors will take the form longitudes = [100.5, 101.5, ..., 109.5] latitudes = [0.5, 1.5, ..., 9.5] |
Convert grid data to point data
Parameters: |
|
---|
Cumulative Log Normal Distribution Function
Parameters: |
|
---|---|
Returns: | An approximation of the cdf of the normal |
Return type: | numpy.ndarray |
Note
CDF of the normal distribution is defined as frac12 [1 + erf(frac{x - mu}{sigma sqrt{2}})], x in R
Does element comparison within a tolerance, excludes overlapped NaN.
Parameters: |
|
---|---|
Raises: | |
Returns: | The result of the allclose on non NaN elements |
Return type: | bool |
Cumulative Normal Distribution Function
Parameters: |
|
---|---|
Returns: | An approximation of the cdf of the normal |
Return type: | numpy.ndarray |
CDF of the normal distribution is defined as frac12 [1 + erf(frac{x - mu}{sigma sqrt{2}})], x in R