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

Isofill does not work with mercator if given lat coordinates values -90, 90 (the edges) #587

Closed
aashish24 opened this issue Aug 29, 2014 · 25 comments
Assignees
Milestone

Comments

@aashish24
Copy link
Contributor

@aashish24 aashish24 commented Aug 29, 2014

I suggest we try every template that is exposed.

@aashish24 aashish24 added this to the 2.0.0 milestone Aug 29, 2014
@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Sep 2, 2014

2 issues here.
*) Mercator does not seem to work with points at the poles, stopping at 80S/N works.
*) Wrap around issues -180/180 input seems to be required, 0/360 plots are not good looking. Seems like a VTK projection restrictions, will see if we can actually reload all plots between -180,180

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Sep 2, 2014

not that it shou;ld make us feel better, but in 1.5.1 (preVTK) it didn't work either see attached
mercator_old

@durack1
Copy link
Member

@durack1 durack1 commented Sep 2, 2014

You win points for abstract art however..

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Sep 4, 2014

ok here's the deal
see: http://en.wikipedia.org/wiki/Mercator_projection
now it clearly states:

the Mercator projection distorts the size and shape of large objects, as the scale increases from the Equator to the poles, where it becomes infinite

So clearly since clt goes all the way to the North, VTK rightfully fails rendering.
VCS projections have always had the "if you don't know what you're doing don't use it"

a few possibilities here:
1- We can remove mercator as one of the default projections (like we did for lambert which suffers the same issue
2- @aashish24 it seems like VTK (rightfully again) gives up on projecting because the lats (plotting a subset -82/82 works) do ou know if there's a way to catch some error VTK probably returned and send this back to the user.
3- even in -82/82 I see some wrapping around issues with continents coastlines. @aashish24 I'm not sure how to address that. Is there a way in VTK projections to tell it "do not cross dateline?" It's always tricky because it might be a legimate line actually going from 355 lon all the way to 5 lon, rather than (usually) a line going from 355 to 365. Usually in grids they deal with this with the clockwise/counterclockwise direction of the points. But I'm not sure it would work here in our continents points files. @williams13 any suggestions?

@aashish24
Copy link
Contributor Author

@aashish24 aashish24 commented Sep 4, 2014

which mercator you are using for this one? Mercator are few.. I cna provide detailed information once I know which one template is using.

@williams13
Copy link
Contributor

@williams13 williams13 commented Sep 4, 2014

I see the artful mercator image that Paul commented on, but I don't see the new/correct image. Can you include the image so that we can comment on?

Thanks, Dean

From: Aashish Chaudhary <notifications@github.commailto:notifications@github.com>
Reply-To: UV-CDAT/uvcdat <reply@reply.github.commailto:reply@reply.github.com>
Date: Wednesday, September 3, 2014 9:01 PM
To: UV-CDAT/uvcdat <uvcdat@noreply.github.commailto:uvcdat@noreply.github.com>
Cc: Dean Williams <williams13@llnl.govmailto:williams13@llnl.gov>
Subject: Re: [uvcdat] Isofill does not work with mercator (#587)

which mercator you are using for this one? Mercator are few.. I cna provide detailed information once I know which one template is using.


Reply to this email directly or view it on GitHubhttps://github.com//issues/587#issuecomment-54403132.

@williams13 williams13 added this to the 2.1 milestone Sep 4, 2014
@williams13 williams13 removed this from the 2.0.0 milestone Sep 4, 2014
@williams13 williams13 added this to the 2.0.0 milestone Sep 4, 2014
@williams13 williams13 removed this from the 2.1 milestone Sep 4, 2014
@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Sep 4, 2014

There's no new "Correct" image since this data cannot be plotted "correctly" as is, you need to plot from -82/82 see attached
iso_mercator_crop

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Sep 4, 2014

on the image above you can see the "wrapping" issue with continents

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Sep 6, 2014

mercator is not in default initial.attribute anymore, so we can close since unaware user won't risk using it poorly. At least moving to 2.1 in case we really want to catch VTK error and report it to user.

@doutriaux1 doutriaux1 added this to the 2.1 milestone Sep 6, 2014
@doutriaux1 doutriaux1 removed this from the 2.0.0 milestone Sep 6, 2014
@doutriaux1 doutriaux1 added this to the web-informatics phase - 1 milestone Sep 6, 2014
@doutriaux1 doutriaux1 removed this from the 2.1 milestone Sep 6, 2014
@doutriaux1 doutriaux1 added this to the 2.1 milestone Sep 6, 2014
@doutriaux1 doutriaux1 removed this from the web-informatics phase - 1 milestone Sep 6, 2014
@williams13
Copy link
Contributor

@williams13 williams13 commented Sep 6, 2014

Agree, move to 2.1.

From: Charles <notifications@github.commailto:notifications@github.com>
Reply-To: UV-CDAT/uvcdat <reply@reply.github.commailto:reply@reply.github.com>
Date: Friday, September 5, 2014 8:51 PM
To: UV-CDAT/uvcdat <uvcdat@noreply.github.commailto:uvcdat@noreply.github.com>
Cc: Dean Williams <williams13@llnl.govmailto:williams13@llnl.gov>
Subject: Re: [uvcdat] Isofill does not work with mercator (#587)

mercator is not in default initial.attribute anymore, so we can close since unaware user won't risk using it poorly. At least moving to 2.1 in case we really want to catch VTK error and report it to user.


Reply to this email directly or view it on GitHubhttps://github.com//issues/587#issuecomment-54701517.

@doutriaux1 doutriaux1 added this to the 2.2 milestone Nov 11, 2014
@doutriaux1 doutriaux1 removed this from the 2.1 milestone Nov 11, 2014
@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Feb 19, 2015

i think @dlonie has almost a fix for these sort of things in #1043 reassigning to him

@doutriaux1 doutriaux1 removed their assignment Feb 19, 2015
@allisonvacanti
Copy link
Contributor

@allisonvacanti allisonvacanti commented Feb 19, 2015

Right, #1043 should address the continent wrapping issues. But only the continents.

Do you know what script produced the last plot in this issue (the one with the continent wrapping artifacts)? I'm looking for a test case for that patch.

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Feb 20, 2015

@dlonie quick examples for mercator
The following works (see png)

import vcs,cdms2
import os,sys
f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc"))
s=f("clt")
iso=x.createisofill()
iso.projection="mercator"
x.plot(s(latitude=(-80,80)),iso)

ok

the following does NOT work

x.plot(s(latitude=(-90,90)),iso)

bad

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Feb 20, 2015

and yes labels/tickmarks are wrong will work on this tomorrow

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Feb 20, 2015

on the bright side, note that the continents seems to be ok now...

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Mar 9, 2015

I'll make "robinson", "Molleweide", "polar" work for this version, will turn off the others.

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Apr 20, 2015

@williams13 @aashish24 ok so we now only have the 3 above.
Mercator still doesn't work so moving to 2.3

@doutriaux1 doutriaux1 added this to the 2.3 milestone Apr 20, 2015
@doutriaux1 doutriaux1 removed this from the 2.2 milestone Apr 20, 2015
@doutriaux1 doutriaux1 assigned aashish24 and unassigned doutriaux1 Aug 31, 2015
@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Aug 31, 2015

@aashish24 I think it's the same as #1462

@aashish24
Copy link
Contributor Author

@aashish24 aashish24 commented Sep 14, 2015

talked to @doutriaux1 some more on this. The only fix is to inform user what went wrong other than that its not really fixable since the math does not work if the the number are not right for projections (nothing specific to VTK, VCS or PROJ4).

@aashish24 aashish24 changed the title Isofill does not work with mercator Isofill does not work with mercator if given lat coordinates values -90, 90 (the edges) Sep 16, 2015
@aashish24
Copy link
Contributor Author

@aashish24 aashish24 commented Sep 16, 2015

@doutriaux1 I confirmed. With proj4 you don't get any error (pure proj4). You get a tuple (1e+30, 1e+30) back but these numbers are not NAN's they are just bad numbers. I think this is one the case we were agreeing on that user need to know the projection. One thing I was suggesting is masking the data if the projection is mercator (past 85,-85). Let me know what you think of that..

@aashish24
Copy link
Contributor Author

@aashish24 aashish24 commented Sep 16, 2015

@doutriaux1 is there an option in vcs that can mask data that has grid data point values within certain range?

@aashish24
Copy link
Contributor Author

@aashish24 aashish24 commented Sep 16, 2015

@doutriaux1 more specifically, is there a method on transient variable for clipping the grid?

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Sep 16, 2015

@aashish24 when getting the data into VTK simply do data=data(latitude=(-85,85))

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Sep 16, 2015

of course you should first check that the user lats are beyond that range.

lat = data.getLatitude()[:]
if lat[-1]<lat[0]:
  lat=lat[::-1]
data = data(latitude=(max(-85,lat.min()),min(85,lat.max()))

@aashish24
Copy link
Contributor Author

@aashish24 aashish24 commented Sep 17, 2015

Yup.. thanks for the hint. I think I have a fix now. I will push a branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants