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

Resampling and interpolating #144

Open
ph-kev opened this issue Oct 24, 2024 · 2 comments
Open

Resampling and interpolating #144

ph-kev opened this issue Oct 24, 2024 · 2 comments

Comments

@ph-kev
Copy link
Member

ph-kev commented Oct 24, 2024

When making the interpolation, ClimaAnalysis uses something along the lines of Intp.interpolate(dims_tuple, data, Intp.Gridded(Intp.Linear())). This causes issues with resampling along the longitude dimension as the boundary condition is Intp.Periodic() as oppose to Intp.Periodic(OnCell()). This means that anything beyond the last point in longitude dimension is effectively ignored and the value of the first point in the longitude dimension is used.

The solution is not as simple as using Intp.Periodic(OnCell()) instead of Intp.Periodic() in that part of the code because the grid is not necessarily uniform if there are more than 2 dimensions. For example, you might want to resample with longitude, latitude, and time as dimensions. It is unclear to me how to approach this issue.

@ph-kev
Copy link
Member Author

ph-kev commented Mar 25, 2025

A solution to this if the longitudes are from 0 to 359 degrees is to copy the first slice of the array along the longitude dimension and concatenate it at 360 degrees.

Although, a better way is to implement interpolation that can handle this case.

@ph-kev
Copy link
Member Author

ph-kev commented Mar 25, 2025

Another thing that crosses my mind is that if you are resampling from 0 to 360 degrees (e.g. [0.0, 1.0, ..., 359.0]) to -180 to 180 degrees, then at least half of the globe will be off by a degree.

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

1 participant