You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
@fernandadialzira
The text was updated successfully, but these errors were encountered: