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

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

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

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 commented Sep 2, 2014

You win points for abstract art however..

@doutriaux1
Copy link
Contributor

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

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

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 modified the milestones: 2.1, 2.0.0 Sep 4, 2014
@doutriaux1
Copy link
Contributor

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

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

@doutriaux1
Copy link
Contributor

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 modified the milestones: 2.1, 2.0.0, web-informatics phase - 1 Sep 6, 2014
@williams13
Copy link
Contributor

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
Copy link
Contributor

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
@alliepiper
Copy link
Contributor

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

@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

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

@doutriaux1
Copy link
Contributor

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

@doutriaux1
Copy link
Contributor

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

@doutriaux1 doutriaux1 assigned doutriaux1 and unassigned alliepiper Mar 9, 2015
@doutriaux1
Copy link
Contributor

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

@doutriaux1 doutriaux1 modified the milestones: 2.3, 2.2 Apr 20, 2015
@doutriaux1 doutriaux1 assigned aashish24 and unassigned doutriaux1 Aug 31, 2015
@doutriaux1
Copy link
Contributor

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

@aashish24
Copy link
Contributor Author

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

@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

@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

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

@doutriaux1
Copy link
Contributor

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

@doutriaux1
Copy link
Contributor

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

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
Development

No branches or pull requests

6 participants