diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a81f286..8d4cf8f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,15 +5,30 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - id: check-docstring-first + - id: check-yaml + - id: check-toml - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.3 + rev: v3.1.0 hooks: - id: prettier - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.4 + rev: v0.1.6 hooks: - id: ruff - - id: ruff-format + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 23.11.0 + hooks: + - id: black-jupyter + - repo: https://github.com/MarcoGorelli/absolufy-imports + rev: v0.3.1 + hooks: + - id: absolufy-imports + files: ^xdggs/ + - repo: https://github.com/kynan/nbstripout + rev: 0.6.1 + hooks: + - id: nbstripout + args: [--extra-keys=metadata.kernelspec metadata.langauge_info.version] ci: autofix_prs: false diff --git a/examples/example_h3.ipynb b/examples/example_h3.ipynb index 84977ad..936440f 100644 --- a/examples/example_h3.ipynb +++ b/examples/example_h3.ipynb @@ -2,19 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "d89cc742-1fbd-4c44-ba0f-83f8b697a318", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/bbovy/miniconda3/envs/xdggs-dev/lib/python3.12/site-packages/h3/unstable/__init__.py:4: UserWarning: Modules under `h3.unstable` are experimental, and may change at any time.\n", - " warnings.warn(\n" - ] - } - ], + "outputs": [], "source": [ "import xarray as xr\n", "import xdggs" @@ -22,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "dbf580e5-324a-4504-939a-144abf71575a", "metadata": {}, "outputs": [], @@ -33,431 +24,10 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "00ea9d06-61ff-436e-a0bd-2ae03930906b", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
<xarray.Dataset>\n", - "Dimensions: (time: 2920, cell: 5305)\n", - "Coordinates:\n", - " * time (time) datetime64[ns] 2013-01-01 ... 2014-12-31T18:00:00\n", - " * cell (cell) int64 590733444024107007 ... 590995677547331583\n", - "Data variables:\n", - " air (time, cell) float64 ...\n", - "Indexes:\n", - " cell H3Index(resolution=3)\n", - "Attributes:\n", - " Conventions: COARDS\n", - " title: 4x daily NMC reanalysis (1948)\n", - " description: Data is from NMC initialized reanalysis\\n(4x/day). These a...\n", - " platform: Model\n", - " references: http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanaly...
<xarray.Dataset>\n", - "Dimensions: (time: 2920, cell: 2)\n", - "Coordinates:\n", - " * time (time) datetime64[ns] 2013-01-01 ... 2014-12-31T18:00:00\n", - " * cell (cell) int64 590733031707246591 590733444024107007\n", - "Data variables:\n", - " air (time, cell) float64 ...\n", - "Indexes:\n", - " cell H3Index(resolution=3)\n", - "Attributes:\n", - " Conventions: COARDS\n", - " title: 4x daily NMC reanalysis (1948)\n", - " description: Data is from NMC initialized reanalysis\\n(4x/day). These a...\n", - " platform: Model\n", - " references: http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanaly...
<xarray.Dataset>\n", - "Dimensions: (time: 2920, cell: 5305)\n", - "Coordinates:\n", - " * time (time) datetime64[ns] 2013-01-01 ... 2014-12-31T18:00:00\n", - " * cell (cell) int64 590733444024107007 ... 590995677547331583\n", - " latitude (cell) float64 37.81 40.86 33.94 39.28 ... 52.31 37.79 32.34\n", - " longitude (cell) float64 -60.7 -73.78 -131.0 ... -49.64 -45.58 -53.61\n", - "Data variables:\n", - " air (time, cell) float64 ...\n", - "Indexes:\n", - " cell H3Index(resolution=3)\n", - "Attributes:\n", - " Conventions: COARDS\n", - " title: 4x daily NMC reanalysis (1948)\n", - " description: Data is from NMC initialized reanalysis\\n(4x/day). These a...\n", - " platform: Model\n", - " references: http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanaly...
<xarray.Dataset>\n", - "Dimensions: (time: 2920, cell: 5305)\n", - "Coordinates:\n", - " * time (time) datetime64[ns] 2013-01-01 ... 2014-12-31T18:00:00\n", - " * cell (cell) int64 590733444024107007 ... 590995677547331583\n", - "Data variables:\n", - " air (time, cell) float64 ...\n", - "Indexes:\n", - " cell H3Index(resolution=3)\n", - "Attributes:\n", - " Conventions: COARDS\n", - " title: 4x daily NMC reanalysis (1948)\n", - " description: Data is from NMC initialized reanalysis\\n(4x/day). These a...\n", - " platform: Model\n", - " references: http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanaly...
<xarray.Dataset>\n", - "Dimensions: (cell: 28910)\n", - "Coordinates:\n", - " cell_ids (cell) int64 11320973 11320975 11320997 ... 11483581 11483583\n", - " resolution float64 0.0002498\n", - "Dimensions without coordinates: cell\n", - "Data variables:\n", - " H0 (cell) float64 nan nan nan nan nan nan ... nan nan nan nan nan\n", - "Attributes: (12/56)\n", - " Conventions: CF-1.6 OCO-1.3.1 COMODO-1.0\n", - " NCO: 4.0.6\n", - " arakawa_grid_type: C1\n", - " area: finis\n", - " comment: Use of Meteo-France AROME meteorological data\n", - " contact: cdoco-exploit@ifremer.fr\n", - " ... ...\n", - " southernmost_latitude: 47.5318\n", - " title: PREVIMER F1 MANGAE2500 AGRIF hindcast\n", - " westernmost_longitude: -6.4567\n", - " nside: 4096\n", - " rot_lat: 0\n", - " rot_lon: 0
<xarray.Dataset>\n", - "Dimensions: (cell: 28910)\n", - "Coordinates:\n", - " * cell_ids (cell) int64 11320973 11320975 11320997 ... 11483581 11483583\n", - " resolution float64 0.0002498\n", - "Dimensions without coordinates: cell\n", - "Data variables:\n", - " H0 (cell) float64 nan nan nan nan nan nan ... nan nan nan nan nan\n", - "Indexes:\n", - " cell_ids HealpixIndex(nside=4096, nest=True, rot_latlon=(0.0, 0.0))\n", - "Attributes: (12/56)\n", - " Conventions: CF-1.6 OCO-1.3.1 COMODO-1.0\n", - " NCO: 4.0.6\n", - " arakawa_grid_type: C1\n", - " area: finis\n", - " comment: Use of Meteo-France AROME meteorological data\n", - " contact: cdoco-exploit@ifremer.fr\n", - " ... ...\n", - " southernmost_latitude: 47.5318\n", - " title: PREVIMER F1 MANGAE2500 AGRIF hindcast\n", - " westernmost_longitude: -6.4567\n", - " nside: 4096\n", - " rot_lat: 0\n", - " rot_lon: 0
<xarray.Dataset>\n", - "Dimensions: (cell: 28910)\n", - "Coordinates:\n", - " * cell_ids (cell) int64 11320973 11320975 11320997 ... 11483581 11483583\n", - " resolution float64 0.0002498\n", - "Dimensions without coordinates: cell\n", - "Data variables:\n", - " H0 (cell) float64 nan nan nan nan nan nan ... nan nan nan nan nan\n", - "Indexes:\n", - " cell_ids HealpixIndex(nside=4096, nest=True, rot_latlon=(0.0, 0.0))\n", - "Attributes: (12/56)\n", - " Conventions: CF-1.6 OCO-1.3.1 COMODO-1.0\n", - " NCO: 4.0.6\n", - " arakawa_grid_type: C1\n", - " area: finis\n", - " comment: Use of Meteo-France AROME meteorological data\n", - " contact: cdoco-exploit@ifremer.fr\n", - " ... ...\n", - " southernmost_latitude: 47.5318\n", - " title: PREVIMER F1 MANGAE2500 AGRIF hindcast\n", - " westernmost_longitude: -6.4567\n", - " nside: 4096\n", - " rot_lat: 0\n", - " rot_lon: 0
<xarray.Dataset>\n", - "Dimensions: (cell: 2)\n", - "Coordinates:\n", - " * cell_ids (cell) int64 11320973 11320975\n", - " resolution float64 0.0002498\n", - "Dimensions without coordinates: cell\n", - "Data variables:\n", - " H0 (cell) float64 nan nan\n", - "Indexes:\n", - " cell_ids HealpixIndex(nside=4096, nest=True, rot_latlon=(0.0, 0.0))\n", - "Attributes: (12/56)\n", - " Conventions: CF-1.6 OCO-1.3.1 COMODO-1.0\n", - " NCO: 4.0.6\n", - " arakawa_grid_type: C1\n", - " area: finis\n", - " comment: Use of Meteo-France AROME meteorological data\n", - " contact: cdoco-exploit@ifremer.fr\n", - " ... ...\n", - " southernmost_latitude: 47.5318\n", - " title: PREVIMER F1 MANGAE2500 AGRIF hindcast\n", - " westernmost_longitude: -6.4567\n", - " nside: 4096\n", - " rot_lat: 0\n", - " rot_lon: 0
<xarray.Dataset>\n", - "Dimensions: (cell: 2)\n", - "Coordinates:\n", - " * cell_ids (cell) int64 11423696 11426437\n", - " resolution float64 0.0002498\n", - "Dimensions without coordinates: cell\n", - "Data variables:\n", - " H0 (cell) float64 53.46 82.05\n", - "Indexes:\n", - " cell_ids HealpixIndex(nside=4096, nest=True, rot_latlon=(0.0, 0.0))\n", - "Attributes: (12/56)\n", - " Conventions: CF-1.6 OCO-1.3.1 COMODO-1.0\n", - " NCO: 4.0.6\n", - " arakawa_grid_type: C1\n", - " area: finis\n", - " comment: Use of Meteo-France AROME meteorological data\n", - " contact: cdoco-exploit@ifremer.fr\n", - " ... ...\n", - " southernmost_latitude: 47.5318\n", - " title: PREVIMER F1 MANGAE2500 AGRIF hindcast\n", - " westernmost_longitude: -6.4567\n", - " nside: 4096\n", - " rot_lat: 0\n", - " rot_lon: 0
<xarray.Dataset>\n", - "Dimensions: (cell: 28910)\n", - "Coordinates:\n", - " * cell_ids (cell) int64 11320973 11320975 11320997 ... 11483581 11483583\n", - " resolution float64 0.0002498\n", - " latitude (cell) float64 46.15 46.17 46.18 46.19 ... 50.54 50.55 50.56\n", - " longitude (cell) float64 -6.283 -6.26 -6.238 ... -3.893 -3.867 -3.842\n", - "Dimensions without coordinates: cell\n", - "Data variables:\n", - " H0 (cell) float64 nan nan nan nan nan nan ... nan nan nan nan nan\n", - "Indexes:\n", - " cell_ids HealpixIndex(nside=4096, nest=True, rot_latlon=(0.0, 0.0))\n", - "Attributes: (12/56)\n", - " Conventions: CF-1.6 OCO-1.3.1 COMODO-1.0\n", - " NCO: 4.0.6\n", - " arakawa_grid_type: C1\n", - " area: finis\n", - " comment: Use of Meteo-France AROME meteorological data\n", - " contact: cdoco-exploit@ifremer.fr\n", - " ... ...\n", - " southernmost_latitude: 47.5318\n", - " title: PREVIMER F1 MANGAE2500 AGRIF hindcast\n", - " westernmost_longitude: -6.4567\n", - " nside: 4096\n", - " rot_lat: 0\n", - " rot_lon: 0
<xarray.Dataset>\n", - "Dimensions: (cell: 28910)\n", - "Coordinates:\n", - " * cell_ids (cell) int64 11320973 11320975 11320997 ... 11483581 11483583\n", - " resolution float64 0.0002498\n", - " latitude (cell) float64 46.15 46.17 46.18 46.19 ... 50.54 50.55 50.56\n", - " longitude (cell) float64 -6.283 -6.26 -6.238 ... -3.893 -3.867 -3.842\n", - "Dimensions without coordinates: cell\n", - "Data variables:\n", - " H0 (cell) float64 nan nan nan nan nan nan ... nan nan nan nan nan\n", - "Indexes:\n", - " cell_ids HealpixIndex(nside=4096, nest=True, rot_latlon=(0.0, 0.0))\n", - "Attributes: (12/56)\n", - " Conventions: CF-1.6 OCO-1.3.1 COMODO-1.0\n", - " NCO: 4.0.6\n", - " arakawa_grid_type: C1\n", - " area: finis\n", - " comment: Use of Meteo-France AROME meteorological data\n", - " contact: cdoco-exploit@ifremer.fr\n", - " ... ...\n", - " southernmost_latitude: 47.5318\n", - " title: PREVIMER F1 MANGAE2500 AGRIF hindcast\n", - " westernmost_longitude: -6.4567\n", - " nside: 4096\n", - " rot_lat: 0\n", - " rot_lon: 0
<xarray.Dataset>\n", - "Dimensions: (lat: 25, time: 2920, lon: 53)\n", - "Coordinates:\n", - " * lat (lat) float32 75.0 72.5 70.0 67.5 65.0 ... 25.0 22.5 20.0 17.5 15.0\n", - " * lon (lon) float32 200.0 202.5 205.0 207.5 ... 322.5 325.0 327.5 330.0\n", - " * time (time) datetime64[ns] 2013-01-01 ... 2014-12-31T18:00:00\n", - "Data variables:\n", - " air (time, lat, lon) float32 241.2 242.5 243.5 ... 296.5 296.2 295.7\n", - "Attributes:\n", - " Conventions: COARDS\n", - " title: 4x daily NMC reanalysis (1948)\n", - " description: Data is from NMC initialized reanalysis\\n(4x/day). These a...\n", - " platform: Model\n", - " references: http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanaly...