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

[WIP] Initiate GoeMakie branch #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

[WIP] Initiate GoeMakie branch #25

wants to merge 1 commit into from

Conversation

Balinus
Copy link
Member

@Balinus Balinus commented Feb 20, 2020

Using @Datseris code to initiate a GeoMakie branch.

Objective: experimental support of GeoMakie with surface plots and animation.

@Datseris
Copy link
Member

May I recommend something...: At least three people invest time making recipes for plotting fields over the earth. @Balinus uses ClimGrid, @rafaqz uses DimensionalArray and I use again dimensional array but I write my own recipes because I use PyPlot.jl (because I find it vastly superior to Plots.jl) ... Maybe these effort should be unified?

I don't know if Plots supports these geographic projections natively (probably not), so I am not so sure how much use are all these DimensionalArray recipes here.

@Balinus
Copy link
Member Author

Balinus commented Feb 20, 2020

I guess we'll have to check for Plots, but when I checked like 12-16 months ago, geographic plotting wasn't well developed.

I do not mind adding support for DimensionalArray but as far as I understood, they are not automatically georeferenced arrays, as opposed to GeoData.jl. If we want to add GeoData, we'll have to wait the package to be registered though.

For PyPlot uses, it's already a dependency in ClimatePlots, so any function that uses that will be welcomed! I can do specific methods for ClimGrid by using your functions that (I guess) uses DimensionalArray?

So, what I'm saying is that I'm all ears to add as much options as possible. However, development time is rather limited right now so I'm concentrating on ClimGrid for now since GeoData is not registered.

@Datseris
Copy link
Member

Sure I'll share the PyPlot recipes I have written, just give me some time to polish them up. They use DimArrays but only at a function barrier. The low-level methods only use normal array data that is propagated: lon, lat, A with Vector, Vector, Matrix.

@Balinus
Copy link
Member Author

Balinus commented Feb 20, 2020

Sure I'll share the PyPlot recipes I have written, just give me some time to polish them up. They use DimArrays but only at a function barrier. The low-level methods only use normal array data that is propagated: lon, lat, A with Vector, Vector, Matrix.

Take your time! :) Are you able to push on ClimatePlots? Let me know if you can't.

ClimGrid methods also mainly uses the same information. Perhaps the main difference is that when I build a ClimGrid, I also build latitude and longitude matrix. This is essential for regional climate models, since they uses projected grids. So I uses the native latitude and longitude grids for plotting purpose. In the end, if the arguments are vector from regular lat-lon grids, it won't be a problem to build it in the plotting function.

Is there any metadata contained in DimensionalArray? It's practical to have it for plotting. I use it for some defaults: title, units, automatic colormap based on type of variable, etc...

@Datseris
Copy link
Member

Datseris commented Feb 20, 2020

Is there any metadata contained in DimensionalArray? It's practical to have it for plotting. I use it for some defaults: title, units, automatic colormap based on type of variable, etc...

No, this is one of the main reasons that GeoData.jl exists (I think, correct me if I am wrong), it adds metadata on top of DimData. DimData by them selves only have a field name as metadata. (I think this is good: the basic low level data structure should be as lean as possible)

sf = surface!(earthscene, longrid, latgrid, zeros(size(longrid)); color = Cmean,
shading = false, show_axis = false, colorrange = crange, colormap = cmap);

geoaxis!(earthscene, -180, 180, -90, 90; crs = (src = source, dest = dest,));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to use the bounding boxes of the original latgrid and longrid here. Also, if ClimateTools.getgrids returns the original grids, beware that this will mutate them, so you should probably ensure they're copied.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Balinus
Copy link
Member Author

Balinus commented Mar 10, 2020

For this branch, I'm gonna wait for a proper CPU backend. Right now, I develop mostly on a cluster without GPU resources. Hence, I cannot develop/test properly.

@asinghvi17
Copy link

Makes sense. I've made some progress on potentially fixing CairoMakie's meshes, will let you know if / when that happens.

@asinghvi17
Copy link

asinghvi17 commented Apr 20, 2020

In the last couple of weeks, we've made significant progress on CairoMakie. Working with reasonably large meshes is now reasonably performant (though vector output is always going to be large).
You can follow the test/cairo.jl file for an example.

geomakie-readme
geomakie-readme.pdf

Edit: I should mention that I recently put up a tutorial here which goes over the mesh API around the end.

@Datseris
Copy link
Member

What's the downside of using GLMakie?

@asinghvi17
Copy link

asinghvi17 commented Apr 20, 2020

GLMakie needs a GPU, and can't do vector output. CairoMakie is slower to render (not too slow, though) and also cannot use surface (only mesh). However, it can run on essentially any platform, no matter the hardware.

Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to change these to CairoMakie and AbstractPlotting, which don't bring in the GLMakie dependency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we only depend on AbstractPlotting and GeoMakie, without enforcing a backend? That's what I do in InteractiveChaos for example (no GeoMakie there)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's also doable, there aren't any explicit ties to CairoMakie.

@Datseris
Copy link
Member

btw @Balinus I've been working more on this code as well as with another code so we can do better now.

@Balinus
Copy link
Member Author

Balinus commented Apr 20, 2020

Happy to see some progress on this front! Will try to do some work in the next weeks.

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 this pull request may close these issues.

3 participants