<?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: Fire Analysis in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/fire-analysis/m-p/1007694#M59227</link>
    <description>&lt;P&gt;So you want people to run the notebook rather than examine the code?&lt;/P&gt;</description>
    <pubDate>Tue, 08 Dec 2020 14:24:16 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2020-12-08T14:24:16Z</dc:date>
    <item>
      <title>Fire Analysis</title>
      <link>https://community.esri.com/t5/python-questions/fire-analysis/m-p/1007614#M59224</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to use&amp;nbsp;California wildfires 2017 - Thomas Fire analysis Sample provided in ArcGIS Python API Samples.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used sentinel imagery to do the same analysis but I always end up getting black imagery (All 0s). Can you please suggest where I'm doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis
from arcgis import *
from arcgis.mapping import MapImageLayer

gis = GIS(profile="krishna_dev") 

#Sentinel2 
sentinel_item = gis.content.search('title:Sentinel2', 'Imagery Layer', outside_org=True)[0]
sentinel = sentinel_item.layers[0]
sentinel_item

aoi = {'spatialReference': {'latestWkid': 3857, 'wkid': 102100}, 'type': 'extent', 
       'xmax': 9028482.969, 'xmin': 8908018.212, 'ymax': 2478700.211, 'ymin': 2248166.133}

arcgis.env.analysis_extent = {'xmax': 9028482.969, 'xmin': 8908018.212, 'ymax': 2478700.211, 'ymin': 2248166.133,
                              "spatialReference":{"wkid":102100,"latestWkid":3857}}
sentinel.extent = aoi

import pandas as pd
from datetime import datetime


selected = sentinel.filter_by(where="(Category = 1)",
                             time=[datetime(2020, 4, 3), datetime(2020, 4, 15)],
geometry=arcgis.geometry.filters.intersects(aoi))

df = selected.query(out_fields="acquisitiondate, name, cloudcover", 
                    order_by_fields="acquisitiondate").sdf
df['acquisitiondate'] = pd.to_datetime(df['acquisitiondate'], unit='ms')
df.tail()

prefire = sentinel.filter_by('OBJECTID in ( 10127407, 10187367)') # 2020-04-03
prefire = prefire.blend()

midfire = sentinel.filter_by('OBJECTID in (10304749, 10304746)') # 2020-04-13 
midfire = midfire.blend()

from arcgis.raster.functions import *

extracted_band = extract_band(midfire, [13,12,4])
extracted_band_prefire = extract_band(prefire, [13,12,4])

nbr_prefire  = band_arithmetic(prefire, "(b9 - b13) / (b9 + b13) + 2000")
nbr_postfire = band_arithmetic(midfire, "(b9 - b13) / (b9 + b13) + 2000")

nbr_diff = nbr_prefire - nbr_postfir

nbr_diff

burnt_areas = colormap(remap(nbr_diff,
                             input_ranges=[0.1,  0.27,  # low severity 
                                           0.27, 0.44,  # medium severity
                                           0.44, 0.66,  # moderate severity
                                           0.66, 1.00], # high severity burn
                             output_values=[1, 2, 3, 4],                    
                             no_data_ranges=[-1, 0.1], astype='u8'), 
                             colormap=[[4, 0xFF, 0xC3, 0], [3, 0xFA, 0x8E, 0], [2, 0xF2, 0x55, 0], [1, 0xE6, 0,    0]])

burnt_areas&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Krish&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 04:25:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/fire-analysis/m-p/1007614#M59224</guid>
      <dc:creator>KrishV</dc:creator>
      <dc:date>2020-12-09T04:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: Fire Analysis</title>
      <link>https://community.esri.com/t5/python-questions/fire-analysis/m-p/1007635#M59225</link>
      <description>&lt;P&gt;You would be better served if you posted your code...&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/code-formatting-the-community-version/ba-p/1007633" target="_blank"&gt;Code formatting ... the Community Version - GeoNet, The Esri Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 11:13:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/fire-analysis/m-p/1007635#M59225</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-12-08T11:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Fire Analysis</title>
      <link>https://community.esri.com/t5/python-questions/fire-analysis/m-p/1007658#M59226</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I attached the entire notebook in the zip file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Krish&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 12:42:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/fire-analysis/m-p/1007658#M59226</guid>
      <dc:creator>KrishV</dc:creator>
      <dc:date>2020-12-08T12:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Fire Analysis</title>
      <link>https://community.esri.com/t5/python-questions/fire-analysis/m-p/1007694#M59227</link>
      <description>&lt;P&gt;So you want people to run the notebook rather than examine the code?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 14:24:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/fire-analysis/m-p/1007694#M59227</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-12-08T14:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Fire Analysis</title>
      <link>https://community.esri.com/t5/python-questions/fire-analysis/m-p/1007962#M59236</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Updated the post with code!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Krish&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 04:23:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/fire-analysis/m-p/1007962#M59236</guid>
      <dc:creator>KrishV</dc:creator>
      <dc:date>2020-12-09T04:23:03Z</dc:date>
    </item>
  </channel>
</rss>

