JuliaClimate/ClimateBase.jl

[FR] LonLat to EqualAreaGrid interpolation

Opened this issue · 4 comments

This issue is related with #46 , but it is much harder.

Here the task is to interpolate from a LonLatGrid to a GaussianEqualArea grid, or some other kind of grid, and vice versa. For this we have to do several steps:

  1. Create the underlying Equal Area grid based on given user input (probably given approximate square meters)
  2. Interpolate.

The difficulty is, I do not know how to do either of these, as I do not know how to do interpolation in non-regular grids, nor how to define well equal area grids.

I know that CDO does this, and I also know that the most easy grid to do this in is the Gaussian grid, GaussianEqualArea. The source code that loads gaussian equal area grids from CDO, ClimArray_eqarea, knows how to transform the given latitudes to a full longitude-latitude coordinate, but we would need to generate the initial latitudes as well. If god can help you find where in the source code of CDO this is done, then we can use it...

Of course, we have to be a bit careful here. We can't directly copy the source code of CDO, because we want this package to remain MIT licensed.

Note that 99% of the time, lat and longitude data is available in netCDF files. Hence, it reduces to a lat-long interpolations. Based, on that if #46 is properly implemented, there's no need to convert from you grid to another.

https://github.com/kbarbary/Dierckx.jl seems to offer interpolation from irregular grids.

I tried but never succeeded in using Dierckx in my workflow. Still seem interesting though!

This package provides the opposite very well, or in general sounds useful to add to interpolation stuff: https://eljungsk.github.io/ScatteredInterpolation.jl/stable/