Popular recipes by Gerry Wiener http://code.activestate.com/recipes/users/825001/2005-05-23T15:28:15-07:00ActiveState Code RecipesExtracting a low resolution grid from a high resolution grid (Python)
2005-05-23T15:28:15-07:00Gerry Wienerhttp://code.activestate.com/recipes/users/825001/http://code.activestate.com/recipes/414084-extracting-a-low-resolution-grid-from-a-high-resol/
<p style="color: grey">
Python
recipe 414084
by <a href="/recipes/users/825001/">Gerry Wiener</a>
(<a href="/recipes/tags/graphics/">graphics</a>).
Revision 3.
</p>
<p>This recipe illustrates how to extract a low resolution grid from a high resolution grid using the Numeric package. It presents an inefficient but straightforward solution and then a more efficient solution that employs the functionality in Numeric.</p>
Closest elements in a target array for a given input array (Python)
2004-11-12T12:29:20-08:00Gerry Wienerhttp://code.activestate.com/recipes/users/825001/http://code.activestate.com/recipes/335390-closest-elements-in-a-target-array-for-a-given-inp/
<p style="color: grey">
Python
recipe 335390
by <a href="/recipes/users/825001/">Gerry Wiener</a>
(<a href="/recipes/tags/graphics/">graphics</a>).
</p>
<pre class="prettyprint"><code>Find the set of elements in input_array that are closest to
elements in target_array. Record the indices of the elements in
target_array that are within tolerance, tol, of their closest
match. Also record the indices of the elements in target_array
that are outside tolerance, tol, of their match.
For example, given an array of observations with irregular
observation times along with an array of times of interest, this
routine can be used to find those observations that are closest to
the times of interest that are within a given time tolerance.
</code></pre>
A numarray set complement (Python)
2004-11-13T00:59:19-08:00Gerry Wienerhttp://code.activestate.com/recipes/users/825001/http://code.activestate.com/recipes/334916-a-numarray-set-complement/
<p style="color: grey">
Python
recipe 334916
by <a href="/recipes/users/825001/">Gerry Wiener</a>
(<a href="/recipes/tags/graphics/">graphics</a>).
Revision 3.
</p>
<p>This recipe finds the complement of a set of indices from a specific arange(n) array. Suppose, for example, you are given a linear array with 10 elements and you want to extract the elements from this array that have indices other than [1, 3, 5]. You can then use this recipe to first find the complement of [1, 3, 5], and you can then use numarray.take() to extract the elements of interest.</p>
Using Import for Reading Configuration Files (Python)
2004-05-10T11:21:05-07:00Gerry Wienerhttp://code.activestate.com/recipes/users/825001/http://code.activestate.com/recipes/283531-using-import-for-reading-configuration-files/
<p style="color: grey">
Python
recipe 283531
by <a href="/recipes/users/825001/">Gerry Wiener</a>
(<a href="/recipes/tags/files/">files</a>).
</p>
<p>Here's a snippet using import for reading Python-based configuration files that are specified at runtime.</p>