# Area calculation in “Thomas Fire analysis”

I am studying this notebook: California wildfires 2017 - Thomas Fire analysis

I can follow the first part of the notebook. But I have got confused in this cell to calculate the burnt area:

``````ext = {"xmax": -13246079.10806628, "ymin": 4035733.9433013694, "xmin": -13438700.419344831, "ymax": 4158033.188557592,
"spatialReference": {"wkid": 102100, "latestWkid": 3857}, "type": "extent"}
pixx = (ext['xmax'] - ext['xmin']) / 1200.0
pixy = (ext['ymax'] - ext['ymin']) / 450.0

res = burnt_areas.compute_histograms(ext, pixel_size={'x':pixx, 'y':pixy})

numpix = 0
histogram = res['histograms']['counts'][1:]
for i in histogram:
numpix += i
``````

So where do the numbers 1200 and 450 in the pixx and pixy calculation come from? I have tried to investigate the metadata of the object and cannot find any hints. Are they some constant numbers?

Also, why the compute_histograms returns five classes while "burnt_areas" has only four "output_values" classes?

## 1 Answer

It looks like 1200 and 450 are the dimension of the image in pixels, so the image is 1200 pixels wide by 450 pixels tall. The extent (first line of the cell) is in Web Mercator coordinates, so the pixx and pixy calculations are calculating the dimensions of a single pixel in terms of meters. For example the difference between xmax and xmin is 192,621 meters, which divided by 1200 pixels would give pixels that are roughly 160m wide.

In the following cell of the notebook you can see pixx and pixy being used to calculate the area of the burn scar. Pixx * pixy = area of a single pixel, which when multiplied by the number of pixels identified as burnt gives you the total burned area.

• One more additional question: why does the compute_histograms need pixel_size? Shouldn't this function just calculate how many pixels fall into each class and that is it? What is the role of pixel_size here? I have gone through the documentation, but it does not explain it at all. Thank you! – dgg32 Oct 16 '20 at 18:02
• I don't know enough about the specific functions to know for certain. It may just be that providing information with a unit puts it in better context than if all your charts just refer to number of pixels. You could run similar steps on imagery with any size of pixels, but 1km pixels are going to tell a very different story than 1m pixels. – ycartwhelen Oct 16 '20 at 19:02