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

vcs 3D rotating globe animation not working properly #409

Closed
davis278 opened this issue May 30, 2019 · 11 comments
Closed

vcs 3D rotating globe animation not working properly #409

davis278 opened this issue May 30, 2019 · 11 comments
Assignees
Labels
bug high Highest priority issue
Milestone

Comments

@davis278
Copy link

davis278 commented May 30, 2019

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)

@doutriaux1
Copy link
Contributor

doutriaux1 commented May 30, 2019

@danlipsa this is actually a super high priority, please focus on this first.

@doutriaux1 doutriaux1 added this to the 8.2 milestone May 30, 2019
@doutriaux1 doutriaux1 added bug high Highest priority issue labels May 30, 2019
@danlipsa
Copy link
Contributor

danlipsa commented May 30, 2019

@doutriaux1 Sounds good. I'll take a look at it tomorrow.

@danlipsa
Copy link
Contributor

danlipsa commented Jun 3, 2019

@doutriaux1 It is the projection that causes the problem. boxfill works correctly.

@doutriaux1
Copy link
Contributor

doutriaux1 commented Jun 3, 2019

@danlipsa you mean the same proj on boxfill works? So it's proj+isofill?

@danlipsa
Copy link
Contributor

danlipsa commented Jun 4, 2019

@doutriaux1
Copy link
Contributor

doutriaux1 commented Jun 4, 2019

Thx. Sounds like a vtk issue then. @scottwittenburg I don't think you did anything special for isofill right?

@cdatrobot
Copy link

cdatrobot commented Jun 4, 2019

@danlipsa
Copy link
Contributor

danlipsa commented Jun 4, 2019

getProjectedBoundsForWorldCoords in vcs returns infinity for one of the coordinates for this projection. I should have a fix today.

@scottwittenburg
Copy link
Collaborator

scottwittenburg commented Jun 4, 2019

Thx. Sounds like a vtk issue then. @scottwittenburg I don't think you did anything special for isofill right?

@doutriaux1 I don't think I did anything special there. However, there were always some special cases I didn't quite understand for various pieces of work (getting plotting bounds, wrapping the grid, etc...) which I just had to leave the way they were, because trying to change them broke everything.

@danlipsa
Copy link
Contributor

danlipsa commented Jun 4, 2019

Fix in
#411

@danlipsa
Copy link
Contributor

danlipsa commented Jun 5, 2019

Fix has been merged in master.

@danlipsa danlipsa closed this as completed Jun 5, 2019
@downiec downiec modified the milestones: 8.2, 8.2.1 Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug high Highest priority issue
Projects
None yet
Development

No branches or pull requests

6 participants