<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do I account for Az Bearings over 360 degrees? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266234#M20475</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In python 3 at least, modulus works with both in and float.&amp;nbsp; Are you referring to controlling decimals?&amp;nbsp; Here is an option&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;375.1&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;4.01&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;360&lt;/SPAN&gt;
Out&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;11&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;19.110000000000014&lt;/SPAN&gt;

round&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;375.1&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;4.01&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;360&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
Out&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;19.11&lt;/SPAN&gt;

&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 13:04:32 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2021-12-11T13:04:32Z</dc:date>
    <item>
      <title>How do I account for Az Bearings over 360 degrees?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266231#M20472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am working on a script to add AzBearings to a polyline shapefile and have a successful &amp;nbsp;script that does this. However, I need to add 14 to those values to account for magnetic north based on my location. If I add 14 to the field, I will then potentially have values over 360 so I need to account for that. My question is, in python how would I take the field containing the AzBearings and add 14 to that value and then subtract 360, but only from the values greater than 360? Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Apr 2017 20:54:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266231#M20472</guid>
      <dc:creator>DuncanMacIntosh</dc:creator>
      <dc:date>2017-04-27T20:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I account for Az Bearings over 360 degrees?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266232#M20473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;modulus&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;360&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;14&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;360&lt;/SPAN&gt;
Out&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;14&lt;/SPAN&gt;

&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;200&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;14&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;360&lt;/SPAN&gt;
Out&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;214&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:04:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266232#M20473</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T13:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I account for Az Bearings over 360 degrees?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266233#M20474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Python modulus operator (%) can be used to force a range on even floating-point values:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;358.1&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;4&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;360.0&lt;/SPAN&gt;
&lt;SPAN class="number token"&gt;2.1&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3.0&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;12&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;360.0&lt;/SPAN&gt;
&lt;SPAN class="number token"&gt;351.0&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:04:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266233#M20474</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2021-12-11T13:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I account for Az Bearings over 360 degrees?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266234#M20475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In python 3 at least, modulus works with both in and float.&amp;nbsp; Are you referring to controlling decimals?&amp;nbsp; Here is an option&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;375.1&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;4.01&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;360&lt;/SPAN&gt;
Out&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;11&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;19.110000000000014&lt;/SPAN&gt;

round&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;375.1&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;4.01&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;360&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
Out&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;19.11&lt;/SPAN&gt;

&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:04:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266234#M20475</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T13:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I account for Az Bearings over 360 degrees?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266235#M20476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Dan, that makes sense to me. I am trying to add this to a new field (Compass Bearing) and populate the new field with the values from my AzBearing field. The outFeatureClass is from earlier in my script referring to the .shp file that contains the field with AzBearing. ArcGIS names that field BEARING, but I do not know how to call that field in the expression for the new field. I hope that I am making sense and that you can help.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/348364_Capture.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Apr 2017 22:46:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266235#M20476</guid>
      <dc:creator>DuncanMacIntosh</dc:creator>
      <dc:date>2017-04-27T22:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I account for Az Bearings over 360 degrees?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266236#M20477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would do a manual test using calculate field and copy the expression to&amp;nbsp; a python snippet....&amp;nbsp;&lt;/P&gt;&lt;P&gt;the expression should be something like&amp;nbsp; .... "(!BEARING! + 14) % 360"&amp;nbsp; but I can't test to see whether the quotes are correct and you should check&lt;/P&gt;&lt;P&gt;maybe....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;SPAN&gt;arcpy&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;CalculateField_management&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"inFeatures"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;fieldName1,&lt;/SPAN&gt;&lt;/CODE&gt;&lt;CODE&gt; &lt;SPAN&gt;'(!Bearing! + 14) % 360)'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;SPAN&gt;"PYTHON_9.3"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt; &lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Apr 2017 23:23:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266236#M20477</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-04-27T23:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I account for Az Bearings over 360 degrees?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266237#M20478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Python is one of very few languages where the modulus operator works on floating-point datatypes. &amp;nbsp;Usually a math function (e.g., fmod) is required, with the operator only supporting integer types. &amp;nbsp;I tested in Python 2.7 (which is why I got away with the paren-less print).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Apr 2017 02:28:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266237#M20478</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2017-04-28T02:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I account for Az Bearings over 360 degrees?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266238#M20479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Python disliked inputting '(!Bearing! +14) % 360)' directly into the arcpy.CalculateField so I defined the expression variable to be that equation and it worked brilliantly! Thank you very much for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Apr 2017 15:58:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266238#M20479</guid>
      <dc:creator>DuncanMacIntosh</dc:creator>
      <dc:date>2017-04-28T15:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I account for Az Bearings over 360 degrees?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266239#M20480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;glad it worked&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Apr 2017 16:17:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-account-for-az-bearings-over-360-degrees/m-p/266239#M20480</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-04-28T16:17:01Z</dc:date>
    </item>
  </channel>
</rss>

