xmovie icon indicating copy to clipboard operation
xmovie copied to clipboard

“Zoom into rotating earth” preset

Open jbusecke opened this issue 5 years ago • 4 comments

Inspired by @dhruvbalwada s amazing llc4320 video I think it would be very cool to have a zoom in feature to go from a global/basin scale animation to really detailed stuff in one video. Even better if it works on the rotating earth preset!

jbusecke avatar Oct 20 '20 19:10 jbusecke

This is cool. I had a similar thought on this too. Maybe we could hardcode some predefined coordinates of the camera, in acceleration and decceleration fashions so that the zoom-in is very smooth, like you double-click in the Google Earth.

miniufo avatar Dec 15 '20 13:12 miniufo

Hi, just stumbled across this repository. I have been trying to make animations that zoom in and my current solution is to use the satellite_height argument to NearSidePerspective and let it change with the time step of the animation. E.g. with a cosine:

len_anim = len(ds.time)
min_height = 10000000 # minimum height of the satellite (closest zoom)
max_height = 35785831 # maximum height of the satellite (furthest away)
sat_height = (np.cos(np.linspace(0, np.pi, len_anim)) + 2) * np.linspace(max_height/3, min_height, len_anim)

To make it look nicer, one should adjust the latitude limits of the map, also depending on the time step of the animation. I am having some trouble with that... But a starting point could be what I currently do:

rat_height = sat_height / max_height # ratio of current satellite height to max satellite height
ylim_0 = -5500000 # approximately the lower boundary of the plot in map coordinates
ylim_1 = 5500000 # approximately the upper boundary of the plot in map coordinates
###
# Inside the animation, tt is the time step, m1 is the GeoAxesSubplot handle
    ylim_low = ylim_0 * rat_height[tt]
    ylim_high = ylim_1 * rat_height[tt]
    m1.set_ylim(ylim_low, ylim_high)

jk-rieck avatar Jan 20 '21 13:01 jk-rieck

Thats very cool (do you have an example that this produces?). I was originally thinking of just cropping into the image (e.g. just setting axis limits differently), but this might actually look better in the satellite perspective. I am currently quite busy with some other projects, but hope to come back to this some time soon. Would you want to work on a PR to the rotating earth preset?

jbusecke avatar Jan 20 '21 14:01 jbusecke

I have an example here. Which is produced by this notebook.

edit: I could work on a PR during the next weeks I guess. Should the zoom effect be added to the existing rotating earth preset or should it be an additional preset?

jk-rieck avatar Jan 20 '21 15:01 jk-rieck