question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Interpolation (not centred)

See original GitHub issue

Hello, I am trying to figure how to do interpolation that are not centred, e.g. when a “center” point is not at the middle point of 2 “right” points. I tried different ways but I did not manage to find a satisfying way that would fit in the xgcm.Axis class. My idea was to implement a new function for interpolation between data_left and data_right, taking also a weight representing the distance to the new position for each data, and use it instead of raw_interp_function:

def interp_function(data_left, data_right, weight_left, weight_right):
    return (data_left * weight_left + data_right * weight_right) / (weight_left + weight_right)

For an interpolation from “right” to “center”, weights would be (C: "center, R: “right”, wl: “weight_left”, wr: “weight_right”):

    |-----------------|----------------|----------------|
            C         R           C    R           C    R
                  data_left        data_right           
                       <---------> <--> 
                            wr      wl 

I did not really find how to implement this solution without changing too much code, as I am not yet familiar with xgcm. Maybe it is necessary to reshape some parts. Does someone has an idea of the rough lines? Or another solution?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
andersy005commented, Jul 4, 2021

@andersy005 This now seems too early? Shouldnt my post count as activity?

You’re right… My hunch is that this is related to this bug: https://github.com/actions/stale/issues/509. I will look into it sometime next week.

0reactions
github-actions[bot]commented, Sep 6, 2021

This issue has been marked ‘stale’ due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days.

Thank you for your contribution!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Interpolated raster not aligned with the vector data
When I get to the interpolation (IDW) part everything breaks down. The output raster file does not align with the original data.
Read more >
Interpolate from cell centers to nodes : r/CFD
What is the best method for interpolating from cell centers to nodes? This is for a post processing step and not flux calculation...
Read more >
Interpolate from face centers to cell center - Forums
Hello guys, I have to perform the following operation within a finite volume framework: Interpolate a variable form face centers (e.g. six ...
Read more >
css - Handle inside an interpolation
And they work if I hard code them, but I dont know how to interpolate inside an interpolation. What would you recommend? Thanks!!!...
Read more >
Interpolating Scattered Data - MATLAB & Simulink
The griddata function supports 2-D scattered data interpolation. The griddatan function supports scattered data interpolation in N-D; however, it is not ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found