-
Notifications
You must be signed in to change notification settings - Fork 37
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
Ways to improve spherical cellarea
#779
Comments
With tiled batches we can just keep filling the same small ector of points that we pass to Proj to tranform. We can swap over (also MWE or at least the size of |
Added MWE code. General tiled iteration would also be nice to have, maybe from DD - this way you can iterate over the most optimal pattern for access as well, which could potentially play well with Dagger. I'm sure DD already does this but it would be nice to have it more exposed. |
Actually we just let DiskArrays handle that currently |
The reason I wrote it so that every point is transformed 4 times is that cell boundaries don't necessarily match. We can write a more optimized version but we need to keep something as stupid as the current implementation around for those cases. |
Ah right we need a version for Irregular and Regular |
Basically, though technically it could be possible to have overlap or gaps even if a dimension is Regular, right? |
No regular is by definition gapless, there is no way to represent gaps. Actually only Explicit lookups have gaps and not Irregular, Irregular cant represent gaps either |
Switching ArchGDAL out with Proj and using tuples instead of vectors already is a bit of an improvement:
Profview shows that roughly 50% of the time is spent on the transformation and 50% on converting lonlat to cartesian coordinates. |
I also found out that proj can convert directly to cartesian coordinates, though it seems to be much slower than converting to lat-lon and then to cartesian in Julia. |
Proj will likely be less accurate than Julia for that transformation, FYI. |
It was also slower, so the way it was before was probably fine. I think switching from GDAL to Proj is easy enough. It's silly to transform every point 4 times but can't think of an elegant end generic solution to do the tiled iteration right now. I guess both of you have implemented that kind of thing a hundred times? |
Also, this is not the kind of function that would end up inside an inner loop. I'm not sure how necessary it is to spend a lot of effort on making it fast. |
Its probably already the fastest that exists by an order of magnitude, so I'm happy to call it off wherever. But generally switching from GDAL to Proj for these things is better for a bunch of reasons, not just speed. |
If we're breaking, then we may as well break everything, and switch both reproject and cellarea to Proj instead of ArchGDAL? Since none of them need gdalwarp. Maybe also mapped crs things. |
A generic tiled iterator would be a bit tough. I think you'd indicate an approximate size, and the iterator could partition into tiles that fit the chunk pattern most optimally. But that's a bigger change...I think even switching to Proj will give us enough speedup for my purposes. |
Edit: Proj has both GFT conversions and an inbuilt geographic check. So we could just switch. |
https://github.com/meggart/DiskArrayEngine.jl/tree/main kind of implements tiled iteration, but it's also huge. I don't think it offers multithreading by default either, and it pulls in a crazy number of dependencies. We could talk to Fabian about maybe splitting parts of it out into a DiskArrayEngineBase.jl package? But it's a bit complicated. Probably easier to write a lightweight wrapper on our own and maybe take some concepts / struct from DiskArrayEngine... |
I believe is threaded and distributed by default, see the runner. |
I just realized that Proj allows you to return data in radians (which is what it uses internally). We could potentially switch to that and avoid cosd and sind. Might speed up projection speed by a hair as well. The switch is |
Good idea, minimise conversions where possible |
#768 already does a lot! But there are still a few low hanging fruit.
For reference,
The text was updated successfully, but these errors were encountered: