Skip to content

Commit

Permalink
Merge pull request #17 from datapartnership/drought
Browse files Browse the repository at this point in the history
Drought Chapter
  • Loading branch information
andresfchamorro authored May 28, 2024
2 parents cc717a2 + 34ee985 commit adcb562
Show file tree
Hide file tree
Showing 8 changed files with 686 additions and 11,944 deletions.
4 changes: 3 additions & 1 deletion docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ parts:
- file: notebooks/conflict/README
sections:
- file: notebooks/conflict/conflictAnalysis.ipynb
- file: notebooks/agriculture/report.ipynb
- file: notebooks/agriculture/report.ipynb
sections:
- file: notebooks/agriculture/drought.ipynb
- url: https://raw.githack.com/datapartnership/niger-economic-monitoring/main/notebooks/nighttime-lights/ntl_analysis.html
title: Nighttime Lights
- file: notebooks/movement/README
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11,708 changes: 0 additions & 11,708 deletions notebooks/agriculture/crop-area-zs.ipynb

Large diffs are not rendered by default.

610 changes: 610 additions & 0 deletions notebooks/agriculture/drought.ipynb

Large diffs are not rendered by default.

210 changes: 11 additions & 199 deletions notebooks/agriculture/evi-classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Niger Phenolopy"
"# Crop Classification"
]
},
{
Expand Down Expand Up @@ -244,102 +244,6 @@
"adm2_ner = gpd.read_file(res['gjDownloadURL'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Labels"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <style>\n",
" .geemap-dark {\n",
" --jp-widgets-color: white;\n",
" --jp-widgets-label-color: white;\n",
" --jp-ui-font-color1: white;\n",
" --jp-layout-color2: #454545;\n",
" background-color: #383838;\n",
" }\n",
"\n",
" .geemap-dark .jupyter-button {\n",
" --jp-layout-color3: #383838;\n",
" }\n",
"\n",
" .geemap-colab {\n",
" background-color: var(--colab-primary-surface-color, white);\n",
" }\n",
"\n",
" .geemap-colab .jupyter-button {\n",
" --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# labels = gpd.read_file(join(expanduser('~'), 'tmp', 'usgs', 'usgs-niger.shp'))\n",
"# labels = labels.loc[labels.land_use_t==1].copy()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <style>\n",
" .geemap-dark {\n",
" --jp-widgets-color: white;\n",
" --jp-widgets-label-color: white;\n",
" --jp-ui-font-color1: white;\n",
" --jp-layout-color2: #454545;\n",
" background-color: #383838;\n",
" }\n",
"\n",
" .geemap-dark .jupyter-button {\n",
" --jp-layout-color3: #383838;\n",
" }\n",
"\n",
" .geemap-colab {\n",
" background-color: var(--colab-primary-surface-color, white);\n",
" }\n",
"\n",
" .geemap-colab .jupyter-button {\n",
" --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# adm2_ner.explore()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -721,7 +625,11 @@
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"metadata": {
"tags": [
"hide-output"
]
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -2721,7 +2629,11 @@
{
"cell_type": "code",
"execution_count": 60,
"metadata": {},
"metadata": {
"tags": [
"hide-output"
]
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -5380,64 +5292,6 @@
"rf_best_fit = rf_best.fit(X_train, y_train.ravel())"
]
},
{
"cell_type": "code",
"execution_count": 194,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <style>\n",
" .geemap-dark {\n",
" --jp-widgets-color: white;\n",
" --jp-widgets-label-color: white;\n",
" --jp-ui-font-color1: white;\n",
" --jp-layout-color2: #454545;\n",
" background-color: #383838;\n",
" }\n",
"\n",
" .geemap-dark .jupyter-button {\n",
" --jp-layout-color3: #383838;\n",
" }\n",
"\n",
" .geemap-colab {\n",
" background-color: var(--colab-primary-surface-color, white);\n",
" }\n",
"\n",
" .geemap-colab .jupyter-button {\n",
" --jp-layout-color3: var(--colab-primary-surface-color, white);\n",
" }\n",
" </style>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"ACCURACY OF THE MODEL: 0.8016528925619835\n",
"R-Squared OF THE MODEL: 0.1942286348501664\n"
]
}
],
"source": [
"# performing predictions on the test dataset\n",
"y_pred = rf_best_fit.predict(X_test)\n",
"y_train_pred = rf_best_fit.predict(X_train)\n",
"\n",
"# using metrics module for accuracy calculation\n",
"print(\"ACCURACY OF THE MODEL: \", metrics.accuracy_score(y_test, y_pred))\n",
"print(\"R-Squared OF THE MODEL: \", metrics.r2_score(y_test, y_pred))"
]
},
{
"cell_type": "code",
"execution_count": 178,
Expand Down Expand Up @@ -5549,48 +5403,6 @@
"print(\"ACCURACY OF THE MODEL: \", metrics.accuracy_score(y_train, y_train_pred))\n",
"print(\"R-Squared OF THE MODEL: \", metrics.r2_score(y_train, y_train_pred))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@
"## Setup"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# import ee\n",
"# ee.Authenticate()"
]
},
{
"cell_type": "code",
"execution_count": 146,
Expand Down Expand Up @@ -12305,18 +12295,6 @@
"display_name": "RTMIS",
"language": "python",
"name": "rtmis"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
}
},
"nbformat": 4,
Expand Down
14 changes: 13 additions & 1 deletion notebooks/agriculture/evi-timesat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3016,7 +3016,7 @@
},
{
"cell_type": "code",
"execution_count": 195,
"execution_count": 148,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -7083,6 +7083,18 @@
"display_name": "RTMIS",
"language": "python",
"name": "rtmis"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit adcb562

Please sign in to comment.