PageRenderTime 47ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/docs/1.1.8/classes/generated/cf.Data.__hash__.html

https://bitbucket.org/cfpython/cfpython.bitbucket.org
HTML | 215 lines | 171 code | 14 blank | 30 comment | 0 complexity | 31b643572561e0d5ad71289a38932313 MD5 | raw file
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>cf.Data.__hash__ &mdash; Documentation</title>
  7. <link rel="stylesheet" href="../../_static/classic.css" type="text/css" />
  8. <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: '../../',
  12. VERSION: '1.1.8',
  13. COLLAPSE_INDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true
  16. };
  17. </script>
  18. <script type="text/javascript" src="../../_static/jquery.js"></script>
  19. <script type="text/javascript" src="../../_static/underscore.js"></script>
  20. <script type="text/javascript" src="../../_static/doctools.js"></script>
  21. <script type="text/javascript" src="../../_static/copybutton.js"></script>
  22. <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
  23. <link rel="top" title="Documentation" href="../../index.html" />
  24. <link rel="up" title="cf.Data" href="../cf.Data.html" />
  25. <link rel="next" title="cf.Data.__len__" href="cf.Data.__len__.html" />
  26. <link rel="prev" title="cf.Data.__deepcopy__" href="cf.Data.__deepcopy__.html" />
  27. </head>
  28. <body role="document">
  29. <div class="related" role="navigation" aria-label="related navigation">
  30. <h3>Navigation</h3>
  31. <ul>
  32. <li class="right" style="margin-right: 10px">
  33. <a href="../../genindex.html" title="General Index"
  34. accesskey="I">index</a></li>
  35. <li class="right" >
  36. <a href="cf.Data.__len__.html" title="cf.Data.__len__"
  37. accesskey="N">next</a> |</li>
  38. <li class="right" >
  39. <a href="cf.Data.__deepcopy__.html" title="cf.Data.__deepcopy__"
  40. accesskey="P">previous</a> |</li>
  41. <li><a target="_blank" href="http://cfpython.bitbucket.org">cf-python 1.1.8</a> &raquo;</li>
  42. <!--
  43. <li><a target="_blank" href="http://cfpython.bitbucket.org">cf-python</a> &raquo;</li>
  44. <li><select onchange="location = this.options[this.selectedIndex].value;">
  45. <option value="../../../1.0/index.html">1.0
  46. <option value="../../../0.9.9/index.html">0.9.9
  47. <option value="../../../0.9.8.3/index.html">0.9.8.3
  48. <option value="../../../archive.html">Archive
  49. </select>
  50. </li>
  51. -->
  52. <li class="nav-item nav-item-0"><a href="../../index.html">Documentation</a> &raquo;</li>
  53. <li class="nav-item nav-item-1"><a href="../../reference.html" >Reference manual</a> &raquo;</li>
  54. <li class="nav-item nav-item-2"><a href="../../class.html" >Classes of the <code class="docutils literal"><span class="pre">cf</span></code> module</a> &raquo;</li>
  55. <li class="nav-item nav-item-3"><a href="../cf.Data.html" accesskey="U">cf.Data</a> &raquo;</li>
  56. </ul>
  57. </div>
  58. <div class="document">
  59. <div class="documentwrapper">
  60. <div class="bodywrapper">
  61. <div class="body" role="main">
  62. <div class="section" id="cf-data-hash">
  63. <h1>cf.Data.__hash__<a class="headerlink" href="#cf-data-hash" title="Permalink to this headline">Âś</a></h1>
  64. <dl class="method">
  65. <dt id="cf.Data.__hash__">
  66. <code class="descclassname">Data.</code><code class="descname">__hash__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://bitbucket.org/cfpython/cf-python/src/v1.1.8/cf/data/data.py#data/data.py-533"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cf.Data.__hash__" title="Permalink to this definition">Âś</a></dt>
  67. <dd><p>The built-in function <a class="reference external" href="http://docs.python.org/2.7/library/functions.html#hash" title="(in Python v2.7)"><code class="xref py py-obj docutils literal"><span class="pre">hash</span></code></a></p>
  68. <p>Generating the hash temporarily realizes the entire array in memory,
  69. which may not be possible for large arrays.</p>
  70. <p>The hash value is dependent on the data type and shape of the data
  71. array. If the array is a masked array then the hash value is
  72. independent of the fill value and of data array values underlying any
  73. masked elements.</p>
  74. <p>The hash value may be different if regenerated after the data array
  75. has been changed in place.</p>
  76. <p>The hash value is not guaranteed to be portable across versions of
  77. Python, numpy and cf.</p>
  78. <table class="docutils field-list" frame="void" rules="none">
  79. <col class="field-name" />
  80. <col class="field-body" />
  81. <tbody valign="top">
  82. <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><dl class="first docutils">
  83. <dt>out <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
  84. <dd><p class="first last">The hash value.</p>
  85. </dd>
  86. </dl>
  87. </td>
  88. </tr>
  89. <tr class="field-even field"><th class="field-name">Examples:</th><td class="field-body"></td>
  90. </tr>
  91. </tbody>
  92. </table>
  93. <div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">d</span><span class="o">.</span><span class="n">array</span>
  94. <span class="go">[[0 1 2 3]]</span>
  95. <span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">hash</span><span class="p">()</span>
  96. <span class="go">-8125230271916303273</span>
  97. <span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ma</span><span class="o">.</span><span class="n">masked</span>
  98. <span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">d</span><span class="o">.</span><span class="n">array</span>
  99. <span class="go">[[0 -- 2 3]]</span>
  100. <span class="gp">&gt;&gt;&gt; </span><span class="nb">hash</span><span class="p">(</span><span class="n">d</span><span class="p">)</span>
  101. <span class="go">791917586613573563</span>
  102. <span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">hardmask</span> <span class="o">=</span> <span class="bp">False</span>
  103. <span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="mi">999</span>
  104. <span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ma</span><span class="o">.</span><span class="n">masked</span>
  105. <span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">hash</span><span class="p">()</span>
  106. <span class="go">791917586613573563</span>
  107. <span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">squeeze</span><span class="p">()</span>
  108. <span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">d</span><span class="o">.</span><span class="n">array</span>
  109. <span class="go">[0 -- 2 3]</span>
  110. <span class="gp">&gt;&gt;&gt; </span><span class="nb">hash</span><span class="p">(</span><span class="n">d</span><span class="p">)</span>
  111. <span class="go">-7007538450787927902</span>
  112. <span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">dtype</span> <span class="o">=</span> <span class="nb">float</span>
  113. <span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">d</span><span class="o">.</span><span class="n">array</span>
  114. <span class="go">[0.0 -- 2.0 3.0]</span>
  115. <span class="gp">&gt;&gt;&gt; </span><span class="nb">hash</span><span class="p">(</span><span class="n">d</span><span class="p">)</span>
  116. <span class="go">-4816859207969696442</span>
  117. </pre></div>
  118. </div>
  119. </dd></dl>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  125. <div class="sphinxsidebarwrapper">
  126. <h4>Previous topic</h4>
  127. <p class="topless"><a href="cf.Data.__deepcopy__.html"
  128. title="previous chapter">cf.Data.__deepcopy__</a></p>
  129. <h4>Next topic</h4>
  130. <p class="topless"><a href="cf.Data.__len__.html"
  131. title="next chapter">cf.Data.__len__</a></p>
  132. <div role="note" aria-label="source link">
  133. <h3>This Page</h3>
  134. <ul class="this-page-menu">
  135. <li><a href="../../_sources/classes/generated/cf.Data.__hash__.txt"
  136. rel="nofollow">Show Source</a></li>
  137. </ul>
  138. </div>
  139. <div id="searchbox" style="display: none" role="search">
  140. <h3>Quick search</h3>
  141. <form class="search" action="../../search.html" method="get">
  142. <input type="text" name="q" />
  143. <input type="submit" value="Go" />
  144. <input type="hidden" name="check_keywords" value="yes" />
  145. <input type="hidden" name="area" value="default" />
  146. </form>
  147. <p class="searchtip" style="font-size: 90%">
  148. Enter search terms or a module, class or function name.
  149. </p>
  150. </div>
  151. <script type="text/javascript">$('#searchbox').show(0);</script>
  152. </div>
  153. </div>
  154. <div class="clearer"></div>
  155. </div>
  156. <div class="related" role="navigation" aria-label="related navigation">
  157. <h3>Navigation</h3>
  158. <ul>
  159. <li class="right" style="margin-right: 10px">
  160. <a href="../../genindex.html" title="General Index"
  161. >index</a></li>
  162. <li class="right" >
  163. <a href="cf.Data.__len__.html" title="cf.Data.__len__"
  164. >next</a> |</li>
  165. <li class="right" >
  166. <a href="cf.Data.__deepcopy__.html" title="cf.Data.__deepcopy__"
  167. >previous</a> |</li>
  168. <li><a target="_blank" href="http://cfpython.bitbucket.org">cf-python 1.1.8</a> &raquo;</li>
  169. <!--
  170. <li><a target="_blank" href="http://cfpython.bitbucket.org">cf-python</a> &raquo;</li>
  171. <li><select onchange="location = this.options[this.selectedIndex].value;">
  172. <option value="../../../1.0/index.html">1.0
  173. <option value="../../../0.9.9/index.html">0.9.9
  174. <option value="../../../0.9.8.3/index.html">0.9.8.3
  175. <option value="../../../archive.html">Archive
  176. </select>
  177. </li>
  178. -->
  179. <li class="nav-item nav-item-0"><a href="../../index.html">Documentation</a> &raquo;</li>
  180. <li class="nav-item nav-item-1"><a href="../../reference.html" >Reference manual</a> &raquo;</li>
  181. <li class="nav-item nav-item-2"><a href="../../class.html" >Classes of the <code class="docutils literal"><span class="pre">cf</span></code> module</a> &raquo;</li>
  182. <li class="nav-item nav-item-3"><a href="../cf.Data.html" >cf.Data</a> &raquo;</li>
  183. </ul>
  184. </div>
  185. <div class="footer" role="contentinfo">
  186. &copy; Copyright 2016, David Hassell.
  187. Last updated on May 18, 2016.
  188. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.5.
  189. </div>
  190. </body>
  191. </html>