Skip to content

Commit

Permalink
Merge branch 'main' into catalogs
Browse files Browse the repository at this point in the history
  • Loading branch information
fernando-aristizabal committed Aug 16, 2023
2 parents 4015b26 + f90f636 commit 5c81a1b
Show file tree
Hide file tree
Showing 15 changed files with 2,950 additions and 364 deletions.
8 changes: 4 additions & 4 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ See the full documentation [here](noaa-owp.github.io/gval/).

WARNING:

- Our current public API and output formats are likely to change in
the future.
- Software is provided "AS-IS" without any guarantees. Please QA/QC
your metrics carefully until this project matures.
- Our current public API and output formats are likely to change in the
future.
- Software is provided "AS-IS" without any guarantees. Please QA/QC your
metrics carefully until this project matures.

# Installation

Expand Down
5 changes: 5 additions & 0 deletions docs/compile_readme_and_arrange_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ def compile_readme():
f"{abs_path}/sphinx/SphinxContinuousTutorial.ipynb",
)

shutil.copy(
f"{abs_path}/../notebooks/Multi-Class Categorical Statistics.ipynb",
f"{abs_path}/sphinx/SphinxMulticatTutorial.ipynb",
)

shutil.copy(
f"{abs_path}/../CONTRIBUTING.MD",
f"{abs_path}/sphinx/SPHINX_CONTRIBUTING.MD",
Expand Down
8 changes: 4 additions & 4 deletions docs/sphinx/PYPI_README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ See the full documentation [here](noaa-owp.github.io/gval/).

WARNING:

- Our current public API and output formats are likely to change in
the future.
- Software is provided "AS-IS" without any guarantees. Please QA/QC
your metrics carefully until this project matures.
- Our current public API and output formats are likely to change in the
future.
- Software is provided "AS-IS" without any guarantees. Please QA/QC your
metrics carefully until this project matures.

# Installation

Expand Down
8 changes: 4 additions & 4 deletions docs/sphinx/SPHINX_README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ continuous, and probabilistic.

WARNING:

- Our current public API and output formats are likely to change in
the future.
- Software is provided "AS-IS" without any guarantees. Please QA/QC
your metrics carefully until this project matures.
- Our current public API and output formats are likely to change in the
future.
- Software is provided "AS-IS" without any guarantees. Please QA/QC your
metrics carefully until this project matures.

# Installation

Expand Down
147 changes: 89 additions & 58 deletions docs/sphinx/SphinxContinuousTutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@
"metadata": {},
"outputs": [],
"source": [
"candidate = rxr.open_rasterio('./livneh_2011_precip.tif', mask_and_scale=True) # VIC\n",
"benchmark = rxr.open_rasterio('./prism_2011_precip.tif', mask_and_scale=True) # PRISM"
"candidate = rxr.open_rasterio(\n",
" './livneh_2011_precip.tif', mask_and_scale=True\n",
") # VIC\n",
"benchmark = rxr.open_rasterio(\n",
" './prism_2011_precip.tif', mask_and_scale=True\n",
") # PRISM"
]
},
{
Expand Down Expand Up @@ -110,7 +114,7 @@
{
"data": {
"text/plain": [
"<matplotlib.collections.QuadMesh at 0x7fd7ab691960>"
"<matplotlib.collections.QuadMesh at 0x7f45c9d7ecb0>"
]
},
"execution_count": 4,
Expand Down Expand Up @@ -149,7 +153,7 @@
{
"data": {
"text/plain": [
"<matplotlib.collections.QuadMesh at 0x7fd7ab5a8280>"
"<matplotlib.collections.QuadMesh at 0x7f45c9c047f0>"
]
},
"execution_count": 5,
Expand All @@ -168,10 +172,12 @@
}
],
"source": [
"agreement.data = xr.where((agreement < np.nanquantile(agreement.values, \n",
" 0.0001)) | \n",
" (agreement > np.nanquantile(agreement.values, 0.9999)), \n",
" np.nan, agreement)\n",
"agreement.data = xr.where(\n",
" (agreement < np.nanquantile(agreement.values, 0.0001)) | \n",
" (agreement > np.nanquantile(agreement.values, 0.9999)), \n",
" np.nan, \n",
" agreement\n",
")\n",
"agreement.gval.cont_plot(title=\"Agreement Map\", figsize=(6, 3))"
]
},
Expand Down Expand Up @@ -218,63 +224,81 @@
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>band</th>\n",
" <th>coefficient_of_determination</th>\n",
" <th>mean_absolute_error</th>\n",
" <th>mean_absolute_percentage_error</th>\n",
" <th>mean_normalized_mean_absolute_error</th>\n",
" <th>mean_normalized_root_mean_squared_error</th>\n",
" <th>mean_percentage_error</th>\n",
" <th>mean_signed_error</th>\n",
" <th>mean_squared_error</th>\n",
" <th>range_normalized_mean_absolute_error</th>\n",
" <th>range_normalized_root_mean_squared_error</th>\n",
" <th>root_mean_squared_error</th>\n",
" <th>symmetric_mean_absolute_percentage_error</th>\n",
" <th>0</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <th>band</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>coefficient_of_determination</th>\n",
" <td>0.685261</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean_absolute_error</th>\n",
" <td>216.089706</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean_absolute_percentage_error</th>\n",
" <td>0.319234</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean_normalized_mean_absolute_error</th>\n",
" <td>0.267845</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean_normalized_root_mean_squared_error</th>\n",
" <td>0.372578</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean_percentage_error</th>\n",
" <td>0.010022</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean_signed_error</th>\n",
" <td>8.085411</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean_squared_error</th>\n",
" <td>90351.664062</td>\n",
" </tr>\n",
" <tr>\n",
" <th>range_normalized_mean_absolute_error</th>\n",
" <td>0.033065</td>\n",
" </tr>\n",
" <tr>\n",
" <th>range_normalized_root_mean_squared_error</th>\n",
" <td>0.045995</td>\n",
" </tr>\n",
" <tr>\n",
" <th>root_mean_squared_error</th>\n",
" <td>300.585541</td>\n",
" </tr>\n",
" <tr>\n",
" <th>symmetric_mean_absolute_percentage_error</th>\n",
" <td>0.269394</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" band coefficient_of_determination mean_absolute_error \\\n",
"0 1 0.685261 216.089706 \n",
"\n",
" mean_absolute_percentage_error mean_normalized_mean_absolute_error \\\n",
"0 0.319234 0.267845 \n",
"\n",
" mean_normalized_root_mean_squared_error mean_percentage_error \\\n",
"0 0.372578 0.010022 \n",
"\n",
" mean_signed_error mean_squared_error \\\n",
"0 8.085411 90351.664062 \n",
"\n",
" range_normalized_mean_absolute_error \\\n",
"0 0.033065 \n",
"\n",
" range_normalized_root_mean_squared_error root_mean_squared_error \\\n",
"0 0.045995 300.585541 \n",
"\n",
" symmetric_mean_absolute_percentage_error \n",
"0 0.269394 "
" 0\n",
"band 1\n",
"coefficient_of_determination 0.685261\n",
"mean_absolute_error 216.089706\n",
"mean_absolute_percentage_error 0.319234\n",
"mean_normalized_mean_absolute_error 0.267845\n",
"mean_normalized_root_mean_squared_error 0.372578\n",
"mean_percentage_error 0.010022\n",
"mean_signed_error 8.085411\n",
"mean_squared_error 90351.664062\n",
"range_normalized_mean_absolute_error 0.033065\n",
"range_normalized_root_mean_squared_error 0.045995\n",
"root_mean_squared_error 300.585541\n",
"symmetric_mean_absolute_percentage_error 0.269394"
]
},
"execution_count": 6,
Expand All @@ -283,7 +307,7 @@
}
],
"source": [
"metric_table"
"metric_table.transpose()"
]
},
{
Expand Down Expand Up @@ -325,8 +349,10 @@
"metadata": {},
"outputs": [],
"source": [
"candidate, benchmark = candidate.gval.homogenize(benchmark_map=benchmark,\n",
" target_map = \"candidate\")"
"candidate, benchmark = candidate.gval.homogenize(\n",
" benchmark_map=benchmark,\n",
" target_map = \"candidate\"\n",
")"
]
},
{
Expand Down Expand Up @@ -362,7 +388,7 @@
{
"data": {
"text/plain": [
"<matplotlib.collections.QuadMesh at 0x7fd7ab462530>"
"<matplotlib.collections.QuadMesh at 0x7f45c950cb20>"
]
},
"execution_count": 8,
Expand All @@ -381,8 +407,10 @@
}
],
"source": [
"agreement_map = candidate.gval.compute_agreement_map(benchmark_map=benchmark, \n",
" comparison_function=\"difference\")\n",
"agreement_map = candidate.gval.compute_agreement_map(\n",
" benchmark_map=benchmark, \n",
" comparison_function=\"difference\"\n",
")\n",
"\n",
"agreement_map.gval.cont_plot(title=\"Agreement Map\", figsize=(6, 3))"
]
Expand All @@ -404,7 +432,7 @@
{
"data": {
"text/plain": [
"<matplotlib.collections.QuadMesh at 0x7fd7ab38de70>"
"<matplotlib.collections.QuadMesh at 0x7f45c9419db0>"
]
},
"execution_count": 9,
Expand All @@ -430,8 +458,10 @@
"def multiply(c: Number, b: Number) -> Number:\n",
" return c / b\n",
"\n",
"agreement_map = candidate.gval.compute_agreement_map(benchmark_map=benchmark, \n",
" comparison_function=\"divide\")\n",
"agreement_map = candidate.gval.compute_agreement_map(\n",
" benchmark_map=benchmark, \n",
" comparison_function=\"divide\"\n",
")\n",
"\n",
"agreement_map.gval.cont_plot(title=\"Agreement Map\", figsize=(6, 3))"
]
Expand Down Expand Up @@ -506,9 +536,10 @@
}
],
"source": [
"_, metric_table = candidate.gval.continuous_compare(benchmark,\n",
" metrics=['mean_absolute_error', \n",
" 'mean_squared_error'])\n",
"_, metric_table = candidate.gval.continuous_compare(\n",
" benchmark,\n",
" metrics=['mean_absolute_error', 'mean_squared_error']\n",
")\n",
"\n",
"metric_table"
]
Expand Down Expand Up @@ -621,10 +652,10 @@
}
],
"source": [
"_, metric_table = candidate.gval.continuous_compare(benchmark,\n",
" metrics=['min_error', \n",
" 'median_error', \n",
" 'max_error'])\n",
"_, metric_table = candidate.gval.continuous_compare(\n",
" benchmark,\n",
" metrics=['min_error', 'median_error', 'max_error']\n",
")\n",
"\n",
"metric_table"
]
Expand Down
Loading

0 comments on commit 5c81a1b

Please sign in to comment.