Skip to content
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

Added ICON interpolator (to point locations) #58

Merged
merged 5 commits into from
Feb 7, 2024

Conversation

efmkoene
Copy link
Contributor

@efmkoene efmkoene commented Feb 5, 2024

This branch adds a tool to the tools folder, which can interpolate ICON output to point locations, using inverse distance weighted interpolation horizontally, and linear interpolation vertically. [*]

import sys
sys.path.insert(1, '/path/to/processing-chain/tools')
from ICON_to_point import ICON_to_point

longitudes = [15,13,14,15] # Self-explanatory: the longitude coordinate of the station
latitudes = [51,52,50,51] # Self-explanatory: the latitude coordinate of the station
asl = [0,1000,1200,0] # The true topographical height (above sea level, asl) of the station (only needed for mountain stations)
elev = [10,70,400,40] # The inlet height above the surface
strategy = ['ground', 'mountain', 'mountain', 'middle'] # Ground stations: model topography[i] + elev[i]; Mountain stations: asl[i] + elev[i]; middle: half ground and half mountain station approach

# Example 3: get two fields
ICON_to_point(longitude=longitudes, latitude=latitudes, station_ground_elevation=asl,
                            station_altitude_over_ground=elev,                            
                            ICON_field_path='/scratch/snx3000/ekoene/processing-chain/work/CTDAS_OCO2/2018010100_0_8664/icon/output_2018010100_opt/ICON-ART-UNSTR_2018-01-02T08:00:00.000.nc', 
                            ICON_grid_path='/scratch/snx3000/ekoene/icon_europe_DOM01.nc', 
                            interpolation_strategy=strategy, 
                            k = 4, field_name=['qv','temp'])

It can also be called from the command line (but with reduced performance, as only one lon/lat point can be interpolated at a time).

It relies on a relatively modern xarray version (I have 2023.7.0), but that is automatically the case with the way the current conda environment is set up anyhow.

From the review, I would mainly ask for a good descriptive word that makes the difference between station_ground_elevation and station_altitude_over_ground as clear as possible -- it probably isn't a 100% clear right now. This is what it should correspond to:

  • for the Cabauw station in the Netherlands, we have that station_ground_elevation=0 (as that is the local topography) while station_altitude_over_ground=27 (as that is the inlet height over the ground)
  • for the Jungfraujoch station in Switzerland, we have that station_ground_elevation=3580 (as that is the local topography) while station_altitude_over_ground=5 (as that is the inlet height over the ground)

[*] (As a curious sidenote, inverse distance weighted interpolation == linear interpolation when only 2 points are considered. So, really, it is using inverse distance weighing both horizontally and vertically).

Copy link

github-actions bot commented Feb 5, 2024

PR Preview Action v1.4.6
🚀 Deployed preview to https://C2SM.github.io/processing-chain/pr-preview/pr-58/
on branch gh-pages at 2024-02-05 09:10 UTC

@mjaehn
Copy link
Contributor

mjaehn commented Feb 5, 2024

@efmkoene Thanks for this PR! I will review this one and already set the base branch to v3.1-rc. Since here, just one file is added, there is no conflict.

@mjaehn mjaehn changed the base branch from main to v3.1-rc February 5, 2024 13:23
@mjaehn mjaehn self-requested a review February 5, 2024 13:36
jobs/tools/ICON_to_point.py Outdated Show resolved Hide resolved
jobs/tools/ICON_to_point.py Outdated Show resolved Hide resolved
jobs/tools/ICON_to_point.py Outdated Show resolved Hide resolved
jobs/tools/ICON_to_point.py Outdated Show resolved Hide resolved
jobs/tools/ICON_to_point.py Outdated Show resolved Hide resolved
jobs/tools/ICON_to_point.py Outdated Show resolved Hide resolved
Copy link
Contributor

@mjaehn mjaehn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments

@efmkoene
Copy link
Contributor Author

efmkoene commented Feb 5, 2024

Hopefully it's up to scratch now!

@mjaehn
Copy link
Contributor

mjaehn commented Feb 6, 2024

launch jenkins

@mjaehn mjaehn merged commit 45d6c01 into v3.1-rc Feb 7, 2024
2 checks passed
@mjaehn mjaehn deleted the add_ICON_interpolator branch February 7, 2024 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants