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

add support of coords to return a StepRangeLen #125

Closed
alex-s-gardner opened this issue Feb 24, 2023 · 4 comments · Fixed by #126
Closed

add support of coords to return a StepRangeLen #125

alex-s-gardner opened this issue Feb 24, 2023 · 4 comments · Fixed by #126

Comments

@alex-s-gardner
Copy link
Contributor

Could support be added to coords such that it returns a StepRangeLen for 'x' and 'y' coordinates?

StepRangeLen then be passed directly to Interpolations.jl

@evetion
Copy link
Owner

evetion commented Feb 24, 2023

Do you have a code snippet for your use of Interpolations? We could add a pkg extension (Julia 1.9 only) for it. Or let the fill API also accept Interpolation options instead of just GeoStatsSolvers.

@evetion
Copy link
Owner

evetion commented Feb 24, 2023

Also, stepranges could only work on non-rotated rasters, so it's difficult to support directly.

@alex-s-gardner
Copy link
Contributor Author

alex-s-gardner commented Feb 24, 2023

Other aspects of coords also only support non-rotated rasters, so I don't see that as an issue other than throwing an error... rotated rasters are pretty uncommon in my world

  xy11 = ga.f((1,1));
  m, n = size(ga.A)[1:2];
  dx = ga.f.linear[1,1];
  dy = ga.f.linear[2,2];
  x0 = xy11[1]:dx:(xy11[1] + dx*(m-1));
  y0 = xy11[2]:dy:(xy11[2] + dy*(n-1));
        
 itp = extrapolate(scale(interpolate(ga.A[:,:,1], BSpline(Constant())), x0, y0 ), nodatavalue)
 val = itp.(x, y)

@evetion evetion mentioned this issue Mar 27, 2023
2 tasks
@evetion
Copy link
Owner

evetion commented Mar 31, 2023

I've added ranges:

julia> ga = GeoArray(rand(10, 10))
10x10x1 Array{Float64, 3} with AffineMap([1.0 0.0; 0.0 1.0], [0.0, 0.0]) and undefined CRS

julia> x0, y0 = GeoArrays.ranges(ga)
(0.5:1.0:9.5, 0.5:1.0:9.5)

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

Successfully merging a pull request may close this issue.

2 participants