Skip to content

vcs 3D rotating globe animation not working properly #409

@davis278

Description

@davis278

While running the example code on the VCS 3D Animation Tutorial (https://cdat.llnl.gov/Jupyter-notebooks/vcs/Animations/Animations.html), Example 3: Rotating Globe, the animation that is created is not right. A red square in the attached screenshot highlights what seems to be a portion of the globe in the lower left corner of the window. Previously, the globe was centered in the middle of the view.
Screen Shot 2019-05-30 at 11 59 43 AM

The code I used to create the animation is the following (updated to Python 3 from the Python 2 code in the example on the Tutorial page listed above - Python 2 code commented out):

import requests
r = requests.get("https://uvcdat.llnl.gov/cdat/sample_data/clt.nc",stream=True)
with open("clt.nc","wb") as f:
for chunk in r.iter_content(chunk_size=1024):
if chunk: # filter local_filename keep-alive new chunks
f.write(chunk)

import cdms2
f=cdms2.open("clt.nc")
clt=f("clt",time=slice(0,1),longitude=(0,361),squeeze=1) # Read the time slice and squeeze it out

make directory for pngs if not present

import os
if not os.path.exists("pngs"):
os.makedirs("pngs")

import vcs

create new canvas

x = vcs.init(bg=True)

Create projection

polar = vcs.createprojection("rotate")
polar.type = "orthographic"
polar.centerlongitude=0.
polar.centerlatitude=45.

Create isofill method

iso = vcs.createisofill()

#iso.levels = range(0,110,10)
iso.levels = list(range(0,110,10))

#iso.fillareacolors = vcs.getcolors(range(0,110,10))
iso.fillareacolors = vcs.getcolors(list(range(0,110,10)))

iso.projection = polar

for centerLongitude in range(0,366,5):
polar.centerlongitude = centerLongitude
x.clear()
x.plot(clt,iso)
x.png("pngs/rotate_%s.png" % str(centerLongitude).zfill(6))

import glob
name = "rot_animation.mp4"

Create animation into file

#print "files used",glob.glob("pngs/rotate_*png")
print ("files used",glob.glob("pngs/rotate_*png"))
x.ffmpeg(name,sorted(glob.glob("pngs/rotate_*png")), rate=15)

Metadata

Metadata

Labels

bughighHighest priority issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions