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

For e.g. ocean temperature interpolation, split reconstruction into wet and dry points. Interpolate with creepfill. #14

Open
JanStreffing opened this issue Apr 29, 2024 · 1 comment
Assignees

Comments

@JanStreffing
Copy link
Owner

@fernandadialzira

@JanStreffing
Copy link
Owner Author

So far, I have not found a python lib with creepfill as it is available in YAC: https://dkrz-sw.gitlab-pages.dkrz.de/yac/d4/d7b/interp_method_creep.html

I think we might be able to use the YAC python interface to call the routine of yac:

import numpy as np
import yac

# Create a structured grid (regular grid) with sample data
lon_values = np.linspace(-180, 180, 360)  # Example longitude values
lat_values = np.linspace(-90, 90, 180)    # Example latitude values
structured_data = np.random.rand(len(lat_values), len(lon_values))  # Example data

# Define unstructured mesh points (where you want to interpolate)
unstructured_lon = [10.0, 20.0, 30.0]  # Example longitude values
unstructured_lat = [50.0, 60.0, 70.0]  # Example latitude values

# Create a YAC grid object
yac_grid = yac.Grid(structured_data, lon_values, lat_values)

# Interpolate using the "creepfill" method
interpolated_values = yac.interp_method_creep(yac_grid, unstructured_lon, unstructured_lat)

# Print the interpolated values
for lon, lat, value in zip(unstructured_lon, unstructured_lat, interpolated_values):
    print(f"Interpolated value at ({lon}, {lat}): {value:.4f}")

However installation is tricky. One would have to basically install the c libarary yac as normal with --enable-python-bindings configure flag. That might be a bit much for a small improvement. We shall try with NN first.

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

No branches or pull requests

2 participants