Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5fde126
chore: replace isort/black with ruff, update YAML formatter
mcocdawc Mar 16, 2026
f0bf0e7
chore: apply standardized ruff lint select settings
mcocdawc Mar 16, 2026
590ad1a
chore: use yamlfmt, standardize ruff-check args
mcocdawc Mar 16, 2026
56ee4de
chore: use macisamuele formatter for YAML and TOML
mcocdawc Mar 16, 2026
5dad24c
chore: use yamlfmt for YAML, pyproject-fmt for TOML
mcocdawc Mar 16, 2026
ba80ca4
chore: use macisamuele formatter for YAML and TOML
mcocdawc Mar 16, 2026
39d173e
applied commit hooks
mcocdawc Mar 16, 2026
3fd3fd4
applied ruff format
mcocdawc Mar 16, 2026
e4b2316
fixed a few simple issues
mcocdawc Mar 16, 2026
a59f7ee
fix: wrap long lines to comply with E501 (max 120 chars)
mcocdawc Mar 16, 2026
2d05fb3
moved settings from pre-commit to pyproject.toml
mcocdawc Mar 16, 2026
2ee72e8
added mpl references for tests
mcocdawc Mar 17, 2026
dd8293b
Merge branch 'fix_tests' into chore/update-linting-tools
mcocdawc Mar 17, 2026
3517859
hardened pre-commit hooks and check them in CI
mcocdawc Mar 17, 2026
221347f
fixed one ruff check
mcocdawc Mar 17, 2026
b4c25d2
fixed typos
mcocdawc Mar 17, 2026
36dff30
fix linting errors
HCookie Mar 19, 2026
d455e61
Merge branch 'chore/update-linting-tools' of github.com:ecmwf/earthki…
mcocdawc Mar 20, 2026
6665732
made code manually nicer
mcocdawc Mar 23, 2026
15bcae4
skip tests with optional dependencies
mcocdawc Mar 23, 2026
ff192af
added healpy baseline image
mcocdawc Mar 23, 2026
52e2b9c
added healpy + earthkit-regrid baseline image
mcocdawc Mar 23, 2026
79ca215
Removes empty tiles notebook
JamesVarndell Mar 23, 2026
10a0218
Removes old implementation that was left over below return
JamesVarndell Mar 23, 2026
f136a76
Merge branch 'chore/update-linting-tools' of github.com:ecmwf/earthki…
JamesVarndell Mar 23, 2026
b01982f
added missing base line image
mcocdawc Mar 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 10 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,24 @@ repos:
- id: check-json
- id: check-yaml
- id: check-toml
# - id: check-added-large-files
# - id: check-added-large-files
- id: debug-statements
- id: mixed-line-ending
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/keewis/blackdoc
rev: v0.3.8
hooks:
- id: blackdoc
additional_dependencies: [black==22.3.0]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
hooks:
- id: ruff
args: [--fix, --show-fixes]
rev: v0.15.4
hooks:
- id: ruff-check
exclude: '(dev/.*|.*_)\.py$'
args:
- --fix
- --exit-non-zero-on-fix
- id: ruff-format
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
- id: mdformat
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.11.0
rev: v2.16.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --preserve-quotes]
Expand Down
4 changes: 2 additions & 2 deletions docs/Untitled.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
" \"vertical_resolution\": \"single_level\",\n",
" \"variable\": [\"sea_surface_temperature\"],\n",
" \"year\": [\"2025\"],\n",
" \"month\": [\"08\"]\n",
" \"month\": [\"08\"],\n",
"}\n",
"\n",
"data = ek.data.from_source(\"cds\", dataset, request)"
Expand Down Expand Up @@ -257,7 +257,7 @@
" \"vertical_resolution\": \"single_level\",\n",
" \"variable\": [\"sea_surface_temperature\"],\n",
" \"year\": [\"2025\"],\n",
" \"month\": [\"08\"]\n",
" \"month\": [\"08\"],\n",
"}\n",
"\n",
"data = ek.data.from_source(\"cds\", dataset, request)"
Expand Down
29 changes: 13 additions & 16 deletions docs/examples/ads.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"outputs": [],
"source": [
"import earthkit.data\n",
"\n",
"import earthkit.plots"
]
},
Expand All @@ -30,16 +31,16 @@
"date = \"2024-02-18\"\n",
"\n",
"data = earthkit.data.from_source(\n",
" 'ads',\n",
" 'cams-europe-air-quality-forecasts',\n",
" \"ads\",\n",
" \"cams-europe-air-quality-forecasts\",\n",
" {\n",
" 'model': 'ensemble',\n",
" 'date': f'{date}/{date}',\n",
" 'variable': 'carbon_monoxide',\n",
" 'level': '0',\n",
" 'type': 'forecast',\n",
" 'time': '00:00',\n",
" 'leadtime_hour': '96',\n",
" \"model\": \"ensemble\",\n",
" \"date\": f\"{date}/{date}\",\n",
" \"variable\": \"carbon_monoxide\",\n",
" \"level\": \"0\",\n",
" \"type\": \"forecast\",\n",
" \"time\": \"00:00\",\n",
" \"leadtime_hour\": \"96\",\n",
" },\n",
")"
]
Expand Down Expand Up @@ -509,12 +510,7 @@
" \"#F00081\",\n",
"]\n",
"\n",
"style = earthkit.plots.styles.Style(\n",
" levels=LEVELS,\n",
" ticks=LEVELS,\n",
" colors=COLORS,\n",
" units=\"µg m^-3\"\n",
")"
"style = earthkit.plots.styles.Style(levels=LEVELS, ticks=LEVELS, colors=COLORS, units=\"µg m^-3\")"
]
},
{
Expand Down Expand Up @@ -545,7 +541,8 @@
"chart.title(\n",
" \"{base_time:%A %-d %B %Y %HUTC} CAMS Forecast T+{lead_time} VT: {valid_time:%A %-d %B %Y %HUTC}\\n\"\n",
" \"Model: ENSEMBLE Height level: Surface Parameter: Carbon monoxide ({units})\",\n",
" horizontalalignment=\"left\", x=0,\n",
" horizontalalignment=\"left\",\n",
" x=0,\n",
")\n",
"chart.gridlines(linestyle=\"--\", xstep=5, ystep=5)\n",
"\n",
Expand Down
33 changes: 17 additions & 16 deletions docs/examples/examples/interactive-bar-plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,24 @@
"metadata": {},
"outputs": [],
"source": [
"import openmeteo_requests\n",
"import requests_cache\n",
"from retry_requests import retry\n",
"import openmeteo_requests\n",
"\n",
"cache_session = requests_cache.CachedSession(\".cache\", expire_after=3600)\n",
"retry_session = retry(cache_session, retries=5, backoff_factor=0.2)\n",
"openmeteo = openmeteo_requests.Client(session=retry_session)\n",
"\n",
"ensemble_url = \"https://ensemble-api.open-meteo.com/v1/ensemble\"\n",
"params = {\n",
" \"latitude\": 60.3913, # Bergen, Norway - rainiest city in Europe\n",
" \"latitude\": 60.3913, # Bergen, Norway - rainiest city in Europe\n",
" \"longitude\": 5.3221,\n",
" \"start_date\": today_str,\n",
" \"end_date\": tomorrow_str,\n",
" \"hourly\": \"precipitation\",\n",
" \"models\": \"ecmwf_ifs025\",\n",
"}\n",
"ensemble_response = openmeteo.weather_api(ensemble_url, params=params)[0]\n"
"ensemble_response = openmeteo.weather_api(ensemble_url, params=params)[0]"
]
},
{
Expand All @@ -81,12 +81,16 @@
"\n",
"forecast_hourly = ensemble_response.Hourly()\n",
"\n",
"forecast_data = {\"date\": pd.date_range(\n",
"forecast_data = {\n",
" \"date\": pd.date_range(\n",
" start=pd.to_datetime(forecast_hourly.Time(), unit=\"s\", utc=True),\n",
" end=pd.to_datetime(forecast_hourly.TimeEnd(), unit=\"s\", utc=True),\n",
" freq=pd.Timedelta(seconds=forecast_hourly.Interval()),\n",
" inclusive=\"left\"\n",
" ).tz_convert(\"Europe/Zurich\").tz_localize(None)}\n",
" inclusive=\"left\",\n",
" )\n",
" .tz_convert(\"Europe/Zurich\")\n",
" .tz_localize(None)\n",
"}\n",
"\n",
"for i in range(forecast_hourly.VariablesLength()):\n",
" v = forecast_hourly.Variables(i)\n",
Expand All @@ -97,7 +101,7 @@
"\n",
"member_cols = [c for c in forecast_df.columns if \"member\" in c]\n",
"\n",
"forecast_df_ok = forecast_df[[\"date\"] + member_cols].dropna(subset=member_cols, how=\"all\")\n"
"forecast_df_ok = forecast_df[[\"date\"] + member_cols].dropna(subset=member_cols, how=\"all\")"
]
},
{
Expand Down Expand Up @@ -139,8 +143,8 @@
"Y = forecast_df_ok[member_cols].to_numpy(dtype=float)\n",
"\n",
"med = np.nanmedian(Y, axis=1)\n",
"lo = np.nanpercentile(Y, q_low*100, axis=1)\n",
"hi = np.nanpercentile(Y, q_high*100, axis=1)"
"lo = np.nanpercentile(Y, q_low * 100, axis=1)\n",
"hi = np.nanpercentile(Y, q_high * 100, axis=1)"
]
},
{
Expand Down Expand Up @@ -168,7 +172,6 @@
}
],
"source": [
"\n",
"from earthkit.plots.interactive import Chart\n",
"from earthkit.plots.interactive import bar as bar_module\n",
"\n",
Expand All @@ -179,9 +182,8 @@
"for tr in bar_module.bar(\n",
" x=x,\n",
" y=hi,\n",
" name=f\"Q{int(q_high*100)}\",\n",
" marker=dict(color=\"rgba(0, 122, 204, 0.4)\",\n",
" pattern=dict(shape=\"/\")),\n",
" name=f\"Q{int(q_high * 100)}\",\n",
" marker=dict(color=\"rgba(0, 122, 204, 0.4)\", pattern=dict(shape=\"/\")),\n",
" opacity=0.4,\n",
" showlegend=True,\n",
"):\n",
Expand All @@ -201,9 +203,8 @@
"for tr in bar_module.bar(\n",
" x=x,\n",
" y=lo,\n",
" name=f\"Q{int(q_low*100)}\",\n",
" marker=dict(color=\"white\",\n",
" pattern=dict(shape=\"\\\\\")),\n",
" name=f\"Q{int(q_low * 100)}\",\n",
" marker=dict(color=\"white\", pattern=dict(shape=\"\\\\\")),\n",
" opacity=0.4,\n",
" showlegend=True,\n",
"):\n",
Expand Down
Loading
Loading