Skip to content

Commit

Permalink
Add a bit more text about what we're doing with cellarea
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 committed Oct 14, 2024
1 parent 1f844bd commit e7e3423
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/src/tutorials/spatial_mean.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ masked_areas = mask(areas; with = chile)
heatmap(masked_areas; axis = (; title = "Cell area in square meters"))
````

You can see here that cells are largest towards the equator, and smallest away from it. This means that cells away from the equator should have a smaller contribution to the average than cells nearer the equator.

## Computing the spatial mean

Now we can compute the average precipitation per square meter. First, we compute total precipitation per grid cell:
Expand Down Expand Up @@ -112,7 +114,7 @@ avg_precip = total_precip / total_area

According to the internet, Chile gets about 100mm of rain per square meter in June, so our statistic seems pretty close.

Let's see what happens if we don't account for cell areas:
Let's see what happens if we don't account for cell areas. An equivalent assumption would be that all cells have the same area.

````@example cellarea
bad_total_precip = sum(skipmissing(masked_precip))
Expand Down

0 comments on commit e7e3423

Please sign in to comment.