Skip to content

Commit

Permalink
Add note on projection choice
Browse files Browse the repository at this point in the history
  • Loading branch information
j08lue authored Nov 17, 2023
1 parent a100586 commit dbcd232
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions notebooks/tutorials/zonal-statistics-validation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 15/15 [00:07<00:00, 1.91it/s]\n"
"100%|██████████| 15/15 [00:07<00:00, 1.90it/s]\n"
]
}
],
Expand Down Expand Up @@ -405,14 +405,25 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Compute zonal averages using TiTiler API"
"## Compute zonal averages using TiTiler API\n",
"\n",
"We make use of the option on TiTiler to reproject the data subset to an equal-area projection ([Equal Area Cylindrical](https://proj.org/en/9.3/operations/projections/cea.html)) before computing the statistics."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"WORKING_PROJECTION = \"+proj=cea\""
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"def generate_stats(item, geojson, asset_name, params=None):\n",
" params = params or {}\n",
Expand All @@ -434,7 +445,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 15,
"metadata": {
"tags": []
},
Expand All @@ -443,7 +454,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 15/15 [00:06<00:00, 2.16it/s]\n"
"100%|██████████| 15/15 [00:15<00:00, 1.04s/it]\n"
]
}
],
Expand All @@ -454,15 +465,15 @@
"for item in tqdm.tqdm(items):\n",
" # generate stats with and without reprojection\n",
" stats_noproj = generate_stats(item, AOI, ASSET_NAME)\n",
" stats_proj = generate_stats(item, AOI, ASSET_NAME, params={\"dst_crs\": \"+proj=cea\"})\n",
" stats_proj = generate_stats(item, AOI, ASSET_NAME, params={\"dst_crs\": WORKING_PROJECTION})\n",
"\n",
" timeseries_titiler_noproj.append(stats_noproj)\n",
" timeseries_titiler_proj.append(stats_proj)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 16,
"metadata": {
"tags": []
},
Expand All @@ -478,7 +489,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 17,
"metadata": {
"tags": []
},
Expand All @@ -497,7 +508,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 18,
"metadata": {
"tags": []
},
Expand All @@ -510,7 +521,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 19,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -540,7 +551,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 20,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -575,7 +586,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 21,
"metadata": {
"tags": []
},
Expand All @@ -591,7 +602,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 22,
"metadata": {
"tags": []
},
Expand Down

0 comments on commit dbcd232

Please sign in to comment.