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

vector not projected (at robinson at least) #357

Open
doutriaux1 opened this issue Jul 26, 2018 · 19 comments
Open

vector not projected (at robinson at least) #357

doutriaux1 opened this issue Jul 26, 2018 · 19 comments
Assignees
Labels
bug high Highest priority issue
Milestone

Comments

@doutriaux1
Copy link
Contributor

import vcs
import cdms2
x = vcs.init()
tmp = vcs.createtemplate()
tmp.ytic1.x1= tmp.data.x1
tmp.ytic1.x2= tmp.data.x1 - .02

f = cdms2.open(vcs.sample_data+"/clt.nc")
#gm = vcs.createboxfill()
#gm.projection="robinson"
clt = f('clt', latitude=(-90.0, 90.0), squeeze=1,
                        longitude=(-180, 200.0), time=('1979-01', '1988-12'),)
gm = x.createvector()#'a_robinson_boxfill')
gm.scale =10 
u = f("u")
gm.projection = "robinson"
gm.datawc_x1 = -180
gm.datawc_x2 = -150
gm.datawc_y1= 0
gm.datawc_y2= 90

x.plot(u-u,u, gm, tmp)

gives (all vector are straight up, they should be curved a bit)

crp

and for polar projection we get 👍
crp

@doutriaux1
Copy link
Contributor Author

@scottwittenburg @aashish24 at your convenience pull the commit from the good branch

@doutriaux1 doutriaux1 modified the milestones: 8.1, 8.2 Mar 27, 2019
@doutriaux1
Copy link
Contributor Author

@scottwittenburg we should check if this is still true.

@scottwittenburg
Copy link
Collaborator

Will do. I suspect it is still true, since I haven't addressed it myself yet. Thanks for the reminder.

@scottwittenburg scottwittenburg added bug high Highest priority issue labels May 1, 2019
@danlipsa
Copy link
Contributor

@doutriaux1 @scottwittenburg I'll start looking at this.

@danlipsa
Copy link
Contributor

@doutriaux1 Why are you saying that the vectors should be curved? In the code, one of the vector components is 0 (you are doing u - u) so it is correct that the vectors are straight up.

@doutriaux1
Copy link
Contributor Author

straight up means toward the north pole. In robinson, at the "north" the arrow should not be staright up be slightly tilted. does this makes sense?

@danlipsa
Copy link
Contributor

At the moment, there is no transform applied to the vector as far as I know. So I guess, you are expecting to to transform the points of the arrow using the same transform as for the points of the mesh.

@doutriaux1
Copy link
Contributor Author

yes exactly

@danlipsa
Copy link
Contributor

Sounds good, I'll look into doing this.

@danlipsa
Copy link
Contributor

A problem with transforming the vectors is that the transformation may not equidistant. So the same size vector would look different sizes in different parts of the map. Is this something we want to have?

@doutriaux1
Copy link
Contributor Author

@danlipsa i think so, but for the legend, let's use the length at the equator (or mid lat/lon of the plot)

@danlipsa
Copy link
Contributor

Points in the dataset are in lat lon, and vectors are in meters per second (I will assume that this will always be the case). This means that I will have to convert points from lat lon to UTM, compute the vector heads in UTM and than convert back to lat lon. Each point is potentially in a different UTM zone that means that I will do a different conversion for each point which may be slow.

I think it makes sense to add vector projection as an option (if vectors are somehow abstract and not related to meters) - What should the default be? On?
Comments @doutriaux1 @scottwittenburg @aashish24 ?

@scottwittenburg
Copy link
Collaborator

To me it seems to be incorrect not to project the vectors if the rest of the plot is in some projection, so I would think if it's an option, it should default to ON. But maybe I'm missing something?

@doutriaux1
Copy link
Contributor Author

I agree with @scottwittenburg

@doutriaux1
Copy link
Contributor Author

@danlipsa i get your point about units. But how do we do it in the "normal" case. I mean would the vector length change if the values are the same but units switch from "m/s" to "km/s" ?

@danlipsa
Copy link
Contributor

Let's do it for m/s and then it would be easy to look at the unit and make adjustments if we need to. The problem is that likely the vector size and direction will change differently depending where on where the vector is on the map. So the fact that we scale the vectors anyway to show them won't help.
I agree, projection will be ON by default.

@danlipsa
Copy link
Contributor

danlipsa commented Nov 1, 2019

Here are some images with the fix. I'll need to upgrade VTK.
for polar projection
test
for robinson projection with gm.datawc_x2 = -50 and plot (ratio="autot")
test

@aashish24
Copy link
Contributor

Looking great @danlipsa

@danlipsa
Copy link
Contributor

danlipsa commented Nov 18, 2019

A consequence of the projection is that the vector range changes, for robinson especially at the poles.
The this the projected vector: range 0, 150
vector
and the original vector: range 0, 70
original_vector
The pattern (after clamping the projected vector) looks almost the same except at the poles.

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

4 participants