diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 268302d4..9081621f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ default_language_version: repos: - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.15.2 hooks: - id: pyupgrade args: [ '--py39-plus' ] @@ -44,7 +44,7 @@ repos: args: [ '--profile=black', '--filter-files', "--add_imports='from __future__ import annotations'" ] exclude: ^docs/ - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.9 + rev: v0.3.5 hooks: - id: ruff - repo: https://github.com/pycqa/flake8 @@ -59,18 +59,18 @@ repos: - id: blackdoc additional_dependencies: [ 'black==24.3.0' ] - repo: https://github.com/kynan/nbstripout - rev: 0.6.1 + rev: 0.7.1 hooks: - id: nbstripout files: '.ipynb' args: [ '--extra-keys=metadata.kernelspec' ] - repo: https://github.com/adrienverge/yamllint.git - rev: v1.33.0 + rev: v1.35.1 hooks: - id: yamllint args: [ '--config-file=.yamllint.yaml' ] - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.27.3 + rev: 0.28.1 hooks: - id: check-github-workflows - id: check-readthedocs diff --git a/docs/notebooks/figanos_colours.ipynb b/docs/notebooks/figanos_colours.ipynb index 556965c2..370ef25a 100644 --- a/docs/notebooks/figanos_colours.ipynb +++ b/docs/notebooks/figanos_colours.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "3c31c5fc", + "id": "0", "metadata": {}, "source": [ "# Colours of Figanos" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "002be0b5", + "id": "1", "metadata": {}, "source": [ "On this page, we present Figanos colours and colormaps, following the [IPCC visual style guide](https://www.ipcc.ch/site/assets/uploads/2022/09/IPCC_AR6_WGI_VisualStyleGuide_2022.pdf)." @@ -19,7 +19,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2e83609e", + "id": "2", "metadata": {}, "outputs": [], "source": [ @@ -42,7 +42,7 @@ }, { "cell_type": "markdown", - "id": "e9c74b22", + "id": "3", "metadata": {}, "source": [ "## Colormaps\n", @@ -52,7 +52,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3976671b", + "id": "4", "metadata": {}, "outputs": [], "source": [ @@ -77,7 +77,7 @@ }, { "cell_type": "markdown", - "id": "c6402a7c", + "id": "5", "metadata": {}, "source": [ "## Colours" @@ -86,7 +86,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8cbdb1f5", + "id": "6", "metadata": { "pycharm": { "name": "#%%\n" diff --git a/docs/notebooks/figanos_docs.ipynb b/docs/notebooks/figanos_docs.ipynb index 2f54c9b7..7dfcf665 100644 --- a/docs/notebooks/figanos_docs.ipynb +++ b/docs/notebooks/figanos_docs.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "36d91e3e", + "id": "0", "metadata": {}, "source": [ "# Getting started\n", @@ -12,7 +12,7 @@ }, { "cell_type": "markdown", - "id": "6b89a37c", + "id": "1", "metadata": {}, "source": [ "## Overview\n", @@ -42,7 +42,7 @@ }, { "cell_type": "markdown", - "id": "89b1adb7", + "id": "2", "metadata": {}, "source": [ "## Preparing the data\n", @@ -55,7 +55,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6f697c91", + "id": "3", "metadata": {}, "outputs": [], "source": [ @@ -78,7 +78,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bfe86b82", + "id": "4", "metadata": {}, "outputs": [], "source": [ @@ -96,7 +96,7 @@ }, { "cell_type": "markdown", - "id": "87e2ac9b", + "id": "5", "metadata": {}, "source": [ "## Using the Ouranos stylesheet\n", @@ -111,7 +111,7 @@ { "cell_type": "code", "execution_count": null, - "id": "895bd6da", + "id": "6", "metadata": {}, "outputs": [], "source": [ @@ -126,7 +126,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2f6f2c3d", + "id": "7", "metadata": {}, "outputs": [], "source": [ @@ -151,7 +151,7 @@ }, { "cell_type": "markdown", - "id": "4dac5fe2", + "id": "8", "metadata": {}, "source": [ "## Timeseries\n", @@ -162,7 +162,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dcb83cfa", + "id": "9", "metadata": {}, "outputs": [], "source": [ @@ -171,7 +171,7 @@ }, { "cell_type": "markdown", - "id": "bd9d1c97", + "id": "10", "metadata": {}, "source": [ "### Using the dictionary interface" @@ -179,7 +179,7 @@ }, { "cell_type": "markdown", - "id": "e69d550c", + "id": "11", "metadata": {}, "source": [ "\n", @@ -196,7 +196,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d47831e8", + "id": "12", "metadata": {}, "outputs": [], "source": [ @@ -213,7 +213,7 @@ }, { "cell_type": "markdown", - "id": "61e03b90", + "id": "13", "metadata": {}, "source": [ "### Customizing plots\n", @@ -229,7 +229,7 @@ { "cell_type": "code", "execution_count": null, - "id": "85cc5d6f", + "id": "14", "metadata": {}, "outputs": [], "source": [ @@ -244,7 +244,7 @@ }, { "cell_type": "markdown", - "id": "3c6181b5", + "id": "15", "metadata": {}, "source": [ "#### Logos\n", @@ -261,7 +261,7 @@ { "cell_type": "code", "execution_count": null, - "id": "728449fe", + "id": "16", "metadata": {}, "outputs": [], "source": [ @@ -279,7 +279,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e4f44c5f", + "id": "17", "metadata": {}, "outputs": [], "source": [ @@ -295,7 +295,7 @@ }, { "cell_type": "markdown", - "id": "4af863ca3c6120cf", + "id": "18", "metadata": {}, "source": [ "The required arguments for `fignos.utils.plot_logo()` are a matplotlib axis (`ax`), a location (`loc`) string describing the position of the logo (ex: 'lower left', 'upper right', 'center').\n", @@ -310,7 +310,7 @@ { "cell_type": "code", "execution_count": null, - "id": "eb7a2ca82ad9d512", + "id": "19", "metadata": {}, "outputs": [], "source": [ @@ -331,7 +331,7 @@ }, { "cell_type": "markdown", - "id": "8696b1fb-4c9f-42a2-ab00-c1c642e3d338", + "id": "20", "metadata": {}, "source": [ "#### Translation\n", @@ -341,7 +341,7 @@ { "cell_type": "code", "execution_count": null, - "id": "76e118b8-e24d-4989-898b-438fbc519b5a", + "id": "21", "metadata": {}, "outputs": [], "source": [ @@ -356,7 +356,7 @@ }, { "cell_type": "markdown", - "id": "9b5f3a15", + "id": "22", "metadata": {}, "source": [ "### Line plots with Datasets\n", @@ -376,7 +376,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0250fad8", + "id": "23", "metadata": {}, "outputs": [], "source": [ @@ -387,7 +387,7 @@ }, { "cell_type": "markdown", - "id": "7bf7a7c5", + "id": "24", "metadata": {}, "source": [ "Whenever multiple lines are plotted from a single Dataset, their legend label will be the concatenation of the Dataset name (its key in the `data` arg.) and the name of the variables or coordinates from which the data is taken, unless the Dataset is passed to the function without a dictionary. When all lines from a Dataset have the same appearance, only the Dataset label will be shown." @@ -396,7 +396,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0e032b0d", + "id": "25", "metadata": {}, "outputs": [], "source": [ @@ -409,7 +409,7 @@ }, { "cell_type": "markdown", - "id": "9c98e40a", + "id": "26", "metadata": {}, "source": [ "### Keyword - colour association\n", @@ -427,7 +427,7 @@ { "cell_type": "code", "execution_count": null, - "id": "03b5ebf9", + "id": "27", "metadata": {}, "outputs": [], "source": [ @@ -441,7 +441,7 @@ }, { "cell_type": "markdown", - "id": "a558c3b7", + "id": "28", "metadata": {}, "source": [ "## Gridded Data on Maps\n", @@ -458,7 +458,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5321f188", + "id": "29", "metadata": {}, "outputs": [], "source": [ @@ -473,7 +473,7 @@ }, { "cell_type": "markdown", - "id": "6ce05cde", + "id": "30", "metadata": {}, "source": [ "### Colormaps and colorbars\n", @@ -505,7 +505,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c041f793", + "id": "31", "metadata": {}, "outputs": [], "source": [ @@ -520,7 +520,7 @@ }, { "cell_type": "markdown", - "id": "ca5f6285", + "id": "32", "metadata": {}, "source": [ "**Note**: Using the `levels` argument will result in a colormap that is split evenly across the span of the data, without consideration for how 'nice' the intervals are (i.e. the boundaries of the different colors will often fall on numbers with some decimals, that might be totally significant to an audience). To obtain 'nice' intervals, it is possible to use the `levels` argument in `plot_kw`. This might however, and often, result in the number of levels not being exactly the one that is specified. Using both arguments is not recommended." @@ -529,7 +529,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a9b38551", + "id": "33", "metadata": {}, "outputs": [], "source": [ @@ -541,7 +541,7 @@ }, { "cell_type": "markdown", - "id": "6eaf4c93", + "id": "34", "metadata": {}, "source": [ "It is also possible to specify your own levels by passing a list to `plot_kw['levels']." @@ -550,7 +550,7 @@ { "cell_type": "code", "execution_count": null, - "id": "32a7d3da", + "id": "35", "metadata": {}, "outputs": [], "source": [ @@ -562,7 +562,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ebb8c2e4", + "id": "36", "metadata": {}, "outputs": [], "source": [ @@ -577,7 +577,7 @@ }, { "cell_type": "markdown", - "id": "9a7d61cf", + "id": "37", "metadata": {}, "source": [ "### pcolormesh vs contourf\n", @@ -592,7 +592,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c43cdbaf", + "id": "38", "metadata": {}, "outputs": [], "source": [ @@ -607,7 +607,7 @@ }, { "cell_type": "markdown", - "id": "23b17a67", + "id": "39", "metadata": {}, "source": [ "## Station Data on Maps\n", @@ -618,7 +618,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ab0bc15c", + "id": "40", "metadata": {}, "outputs": [], "source": [ @@ -668,7 +668,7 @@ }, { "cell_type": "markdown", - "id": "2201ff76", + "id": "41", "metadata": {}, "source": [ "It is possible to plot observations on top of gridded data by calling both `gridmap()` and `scattermap()` and fixing the colormap limits (`vmin` and `vmax`), like demonstrated below." @@ -677,7 +677,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5ba2e4bd", + "id": "42", "metadata": {}, "outputs": [], "source": [ @@ -705,7 +705,7 @@ }, { "cell_type": "markdown", - "id": "8507e483", + "id": "43", "metadata": {}, "source": [ "## Plotting hatched areas\n", @@ -715,7 +715,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2863b396", + "id": "44", "metadata": { "keep_output": true, "nbsphinx": { @@ -788,7 +788,7 @@ }, { "cell_type": "markdown", - "id": "8936d047", + "id": "45", "metadata": {}, "source": [ "## GeoDataFrame on Maps\n", @@ -801,7 +801,7 @@ { "cell_type": "code", "execution_count": null, - "id": "36c0173d", + "id": "46", "metadata": {}, "outputs": [], "source": [ @@ -818,7 +818,7 @@ }, { "cell_type": "markdown", - "id": "afe21d13", + "id": "47", "metadata": {}, "source": [ "Projections can be used like in `gridmap()`, although some of the Cartopy projections might lead to unexpected results due to the interaction between Cartopy and GeoPandas, especially when the whole globe is plotted.\n", @@ -829,7 +829,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d7e47484", + "id": "48", "metadata": {}, "outputs": [], "source": [ @@ -847,7 +847,7 @@ }, { "cell_type": "markdown", - "id": "56b1d374", + "id": "49", "metadata": {}, "source": [ "## Climate Stripes\n", @@ -862,7 +862,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b037dd93", + "id": "50", "metadata": {}, "outputs": [], "source": [ @@ -887,7 +887,7 @@ }, { "cell_type": "markdown", - "id": "8988c9c2", + "id": "51", "metadata": {}, "source": [ "Like most of the other functions, `stripes()` will attempt to find a colormap that is appropriate for the data variables." @@ -896,7 +896,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f7b7a29a", + "id": "52", "metadata": {}, "outputs": [], "source": [ @@ -914,7 +914,7 @@ }, { "cell_type": "markdown", - "id": "0650d35c", + "id": "53", "metadata": {}, "source": [ "## Violin Plots\n", @@ -927,7 +927,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a044b0ae", + "id": "54", "metadata": {}, "outputs": [], "source": [ @@ -936,7 +936,7 @@ }, { "cell_type": "markdown", - "id": "0be208f7", + "id": "55", "metadata": {}, "source": [ "The optional `color` argument combines the Seaborn function's `color` and `palette` arguments. A single color or a list of colors can be passed. Integers can be passed instead of strings to refer to colors of the currently used stylesheet. If the list of colors is shorter than the number of variables on the plot, the colors are repeated." @@ -945,7 +945,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b05c0791", + "id": "56", "metadata": {}, "outputs": [], "source": [ @@ -956,7 +956,7 @@ }, { "cell_type": "markdown", - "id": "7d7e7807", + "id": "57", "metadata": {}, "source": [ "## Heatmaps\n", @@ -967,7 +967,7 @@ { "cell_type": "code", "execution_count": null, - "id": "34d90a61", + "id": "58", "metadata": {}, "outputs": [], "source": [ @@ -988,7 +988,7 @@ }, { "cell_type": "markdown", - "id": "2840ade0", + "id": "59", "metadata": {}, "source": [ "In order to produce realiable results, the xarray object passed to `heatmap()` has to have only two dimensions. Under the hood, the function converts the DataArray containing the data to a pandas DataFrame before plotting it. Using `transpose=True` swaps the x and y axes.\n", @@ -999,7 +999,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f85c621b", + "id": "60", "metadata": {}, "outputs": [], "source": [ @@ -1015,7 +1015,7 @@ }, { "cell_type": "markdown", - "id": "d1a679fb", + "id": "61", "metadata": {}, "source": [ "## Taylor Diagrams\n", @@ -1034,7 +1034,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a3afa881", + "id": "62", "metadata": {}, "outputs": [], "source": [ @@ -1056,7 +1056,7 @@ }, { "cell_type": "markdown", - "id": "a0a3afb0", + "id": "63", "metadata": {}, "source": [ "## Partition plots\n", @@ -1076,7 +1076,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a91d12a2", + "id": "64", "metadata": {}, "outputs": [], "source": [ @@ -1126,7 +1126,7 @@ }, { "cell_type": "markdown", - "id": "d91c12cf", + "id": "65", "metadata": {}, "source": [ "Compute uncertainties with xclim and use `fractional_uncertainty` to have the right format to plot." @@ -1135,7 +1135,7 @@ { "cell_type": "code", "execution_count": null, - "id": "645c3bb3", + "id": "66", "metadata": {}, "outputs": [], "source": [ @@ -1171,7 +1171,7 @@ { "cell_type": "code", "execution_count": null, - "id": "32db8ef5", + "id": "67", "metadata": {}, "outputs": [], "source": [ @@ -1191,7 +1191,7 @@ { "cell_type": "code", "execution_count": null, - "id": "75349096", + "id": "68", "metadata": {}, "outputs": [], "source": []