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

Projections and Secondaries don't get along #54

Open
chaosphere2112 opened this issue Nov 23, 2016 · 3 comments
Open

Projections and Secondaries don't get along #54

chaosphere2112 opened this issue Nov 23, 2016 · 3 comments
Assignees
Labels
bug medium Medium Priority Bugs Needs Investigation Issues that require more probing to verify
Milestone

Comments

@chaosphere2112
Copy link
Contributor

I'm playing with a technique to do a polar 1D plot in VCS, and I ran into some issues along the way. The biggest issue is that attempting to use a projection on a secondary object (which is something the API supports) doesn't really work, at all.

A simple test case:

import vcs
line = vcs.createline()
line.projection = "polar"
line.worldcoordinate = [-180, 180, -90, 90]
line.viewport = [.25, .75, .25, .75]
line.x = [-180, 180]
line.y = [90, 90]
canvas = vcs.init()
canvas.plot(line)

which gives you a blank canvas.

This seemed odd to me, since we do essentially that exact line when plotting a polar plot of a 2D variable (via the template.box1 attribute).

import vcs, cdms2
f = cdms2.open(vcs.sample_data + '/clt.nc')
s = f('clt')
canvas = vcs.init()
boxfill = vcs.getboxfill("polar")
empty_template = vcs.createtemplate()
empty_template.blank()
empty_template.box1.priority = 1
canvas.plot(s, empty_template, boxfill)

circle

I inserted some code to dump the attributes of the line object being generated for that template, and got this:

 ----------Line (Tl) member (attribute) listings ----------
secondary method = Tl
name = __line_591065525709696
type = ['solid']
width = [1.0]
color = [1]
priority = 1
viewport = [0.2766584621956789, 0.7233415266284211, 0.259999990463, 0.860000014305]
worldcoordinate = [-180.3333333325, 179.6666666625, -90.0, 90.0]
x = [[-180.3333333325, 179.6666666625], [-180.3333333325, 179.6666666625]]
y = [[90.0, 90.0], [-90.0, -90.0]]
projection = polar
colormap = None

I tried assigning those exact values to a line and plotting it, but it still failed to produce any output.

I dug into the VTK objects actually being assembled, iterated across all of the points created, and still, everything was the same for both ways. After a bunch of spelunking through misc. VTK objects, I discovered the the bounds on the actors were set differently.

It turns out that the plot function will try and grab a "vtk_backend_grid" and pass it to this code in fitToViewport; when we plot the template, vtk_backend_grid is passed as a kwarg, but when we plot the line straight-up, we use the Xrg and Yrg values derived from the worldcoordinate attribute on the line object.

We definitely need to be able to correctly project stuff without plotting a variable as part of the process, so this is in the "bug" category.

Migrated from: CDAT/cdat#1965

@doutriaux1 doutriaux1 modified the milestone: 3.0 May 5, 2017
@doutriaux1 doutriaux1 modified the milestones: 3.0, post 3.0 Mar 29, 2018
@doutriaux1 doutriaux1 modified the milestones: 8.1, 8.2 Mar 27, 2019
@doutriaux1
Copy link
Contributor

some seem to be edge caes in the first example using:

line.y = [-60, 45]

works

@doutriaux1
Copy link
Contributor

The box plot isn't just the line anymore, that might an error too

@scottwittenburg
Copy link
Collaborator

I think we may not be data having priority 0 in our pipelines, which is why the box plot isn't just the line anymore.

@scottwittenburg scottwittenburg added bug medium Medium Priority Bugs Needs Investigation Issues that require more probing to verify and removed enhancement labels May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug medium Medium Priority Bugs Needs Investigation Issues that require more probing to verify
Projects
None yet
Development

No branches or pull requests

3 participants