-
Notifications
You must be signed in to change notification settings - Fork 3
Feature/area as input to spatial #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3e24905
area-as-input
EddyCMWF 40b4554
notebooko updates
EddyCMWF 7827d0a
Potential fix for pull request finding
EddyCMWF 766c4dd
Potential fix for pull request finding
EddyCMWF 3b4b108
Merge branch 'develop' into feature/area-as-input-to-spatial
EddyCMWF 296a9c1
correct NB names
EddyCMWF d67992f
Potential fix for pull request finding
EddyCMWF edacc1b
Potential fix for pull request finding
EddyCMWF cb71489
type check and dims order fix
EddyCMWF 117d688
Expose area parameter in spatial mask/reduce signatures
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
docs/source/how-tos/spatial/howto_spatial_mean_era5_area.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "# Calculate the spatial mean of gridded data over an area/bounding box\n", | ||
| "\n", | ||
| "This notebook demonstrates how to compute the spatial mean of some sample 2m\n", | ||
| "temperature data for a given rectangular area bounding box.\n", | ||
| "This is done via the `area` keyword argument, it is a dictionary with keys\n", | ||
| "`\"north\"`, `\"south\"`, `\"east\"`, and `\"west\"`." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from earthkit import data as ekd\n", | ||
| "from earthkit import transforms as ekt\n", | ||
| "from earthkit.transforms._tools import earthkit_remote_test_data_file\n", | ||
| "\n", | ||
| "remote_era5_file = earthkit_remote_test_data_file(\"era5-Europe-sfc-2m-temperature-3deg-2015-2017.grib\")\n", | ||
| "era5_data = ekd.from_source(\"url\", remote_era5_file)\n", | ||
| "ds = era5_data.to_xarray()\n", | ||
| "\n", | ||
| "# Define a bounding box covering central Europe\n", | ||
| "area = {\"north\": 55, \"south\": 45, \"east\": 20, \"west\": 5}\n", | ||
| "\n", | ||
| "# Calculate area mean using the bounding box\n", | ||
| "area_mean_bbox = ekt.spatial.reduce(ds, area=area, how=\"mean\", weights=\"latitude\")\n", | ||
| "\n", | ||
| "area_mean_bbox" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": "rtd-dev-env", | ||
| "language": "python", | ||
| "name": "python3" | ||
| }, | ||
| "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.13" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 2 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.