comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: contour discontinuity
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: contour discontinuity [message #84213] Sun, 05 May 2013 18:57 Go to next message
Rosie is currently offline  Rosie
Messages: 27
Registered: September 2012
Junior Member
Hello David and Ken,

Thank you so much for the help ! It worked perfectly alright !!

Regards
Re: contour discontinuity [message #84234 is a reply to message #84213] Fri, 03 May 2013 06:46 Go to previous messageGo to next message
Kenneth Bowman is currently offline  Kenneth Bowman
Messages: 86
Registered: November 2006
Member
On 2013-05-03 10:35:07 +0000, Sam said:

> Hello,
>
> I have plotted a 2D latitude vs. Longitude contour. When I do it from
> -180 longitude to +180 longitude scale, it is coming perfect. Now I
> want the same plot to be shown in 0 to 360 latitude. But there is a
> white vertical band coming at 180 longitude (in the middle of the plot).
>
> I will be grateful for help.
>
> Thanks.

I suspect that you have the 'white stripe' in both cases, but it is
obvious in the second case because it is in the middle of the plot.

You need to duplicate the first or last 'column' of your data so that
it wraps all the way around the globe. Such as

data = [data, data[0,*]]

You probably also want to convert your longitudes from the [-180, 180]
convention to [0, 360] and add an extra point at the end

lon = (lon + 360.0) MOD 360.0
lon = [lon, 359.999]

You can also avoid some map plotting artifacts by using SHIFT to shift
your data and coordinates by 180 degrees so that the storage matches
the plotting boundaries.

Ken Bowman
Re: contour discontinuity [message #84235 is a reply to message #84234] Fri, 03 May 2013 06:20 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Sam writes:

> I have plotted a 2D latitude vs. Longitude contour. When I do it from -180 longitude to +180 longitude scale, it is coming perfect. Now I want the same plot to be shown in 0 to 360 latitude. But there is a white vertical band coming at 180 longitude (in the middle of the plot).

Before we start, I should tell you that the solution to this problem is
rarely satisfactory. You would be well advised to learn to live with
what you have now. :-)

In the Coyote Gallery, I have a plot named Contours on a Global Map. I'm
going to use that data, which is different from yours, but will have the
same problem. In my case, the longitude data vector goes from 0 to
357.5, and if I display the data with the center longitude at 180, all
is well. If I want to display the data with the center longitude at 0, I
find a gap in the center of the plot.

IDL> Restore, 'contours_on_global_map.sav' ; lat, lon, data
IDL> print, lon[0], lon[-1]
0.000000 357.500

To correct the problem, I have to "complete the circuit" by wrapping the
longitude vector back on itself. Since I am extending the longitude
vector, I will have to do the same thing with the data (which is a 2D
array with dimensions [lon,lat]).

IDL> lon = [lon, lon[0]]
IDL> print, lon[0], lon[-1]
0.000000 0.000000
IDL> help, data
DATA FLOAT = Array[144, 73]
IDL> data = [data, data[0,*]]
IDL> help, data
DATA FLOAT = Array[145, 73]

Next, I have to convert my longitude vector to run from -180 to 180. You
would do the opposite here. You can find the formulas for doing so in
this article:

http://www.idlcoyote.com/map_tips/lonconvert.html

IDL> t_lon = lon
IDL> lon = t_lon - (LONG(t_lon )/180)*360.0

Now, when I create the filled contour the gap is gone and the result has
me thinking that displaying the contours with 180 in center was probably
a good idea. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: contour discontinuity [message #84443 is a reply to message #84213] Mon, 27 May 2013 17:07 Go to previous message
Rosie is currently offline  Rosie
Messages: 27
Registered: September 2012
Junior Member
On Monday, May 6, 2013 2:57:24 AM UTC+1, Sam wrote:
> Hello David and Ken,
>
>
>
> Thank you so much for the help ! It worked perfectly alright !!
>
>
>
> Regards

Hello,

I want to label only zero contour.I used c_levels=[0,0,0,1,0,0,0] say for a total of 7 levels. Sometimes, there is a overlap of that 0 value. How to get rid of that? Moreover, if I want that label as only '0' rather than 0.0, can I do that?

Regards,
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: type conversion error - help needed urgent
Next Topic: nested structures in dlm

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:56:03 PDT 2025

Total time taken to generate the page: 0.00419 seconds