Zachary Norman Basic Member
Posts:173  
06 Oct 2015 02:51 PM |
|
Hello,
Ifound a very inconvenient usage of function “MAPCONTINENTS”. What I want to dois to overlay my current plot, running from 0-360 degree in longitude, withglobal map. But it looks like MAPCONTINENTS by default consider only longitudein range of [-180, 180] (see figure below). I’ve tried a couple of things and no progress so far.
IDL> plot=plot(findgen(180)*2.,findgen(180)-90, xrange=[0, 360], yrange=[-90, 90])
IDL> aa=MAPCONTINENTS(limit=[-90,0, 90, 360])
The other solution might be to create a map first, using function “MAP”. But I found it pretty weird, too. For example,
map=map('Equirectangular',center_longitude=180, LABEL_POSITION = 0)
That plot does not look as you expect it to.
|
|
|
|
Zachary Norman Basic Member
Posts:173  
06 Oct 2015 02:56 PM |
|
Hi,
To answer your first question, the proper way to plo tinto a map's data space is to define the map first and then overplot into the MAP. Here is an example of how to do that. This creates a plot with the red line showing a sin wave in the map's data space and a blue sin wave indicating a plot drawn in the same space as the map, but not actually in the data space. This way you can see the difference between the two methods.
pro map_continents_overplot_example
compile_opt idl2
ireset, /no_prompt
w = window(dimensions = [800,800])
;create our map projection
Map1 = MAP ( 'Mercator', FILL_COLOR='Light Blue', COLOR='Gray', $
LIMIT=[ -90, -180, 90, 180 ], $
LINESTYLE='Dotted', LABEL_POSITION=0,$
/current, $
HORIZON_LINESTYLE = 0) ;box the map
;plot the continents
mc = MAPCONTINENTS (/continents, FILL_COLOR='beige',/noclip)
x = findgen(360, START=-180)
y = 75*sin(x*(2*!PI/90))
;add sample data plot to the map's data space
p = plot(x,y, /current, /overplot, color = 'red')
;plot over image so you can see that the difference between overplotting
;the data space and just plotting on top of the map
p2 = plot(x,y, /current, position = p.position, color = 'blue', $
xrange = [-180,180], yrange = [-90,90],$
axis_style = 0)
end
For you second question, it looks like that plot is a bug in IDL 8.2 and does not generate correctly. The plot works just fine using IDL 8.5 which is the most current version. I would suggest upgrading to fix this problem.
|
|
|
|
Deleted User New Member
Posts:  
06 Oct 2015 04:51 PM |
|
You are not answering my question.
My question is that your MAPCONTINENTS cannot customize longitude running from 0 to 360. It always assume in [-180, 180] range. So is this a bug, or something else I did wrong.
By the way, is your code really working?
Map1 = MAP('Mercator', FILL_COLOR='Light Blue', COLOR='Gray', LIMIT=[-120, 0, 120, 360], LINESTYLE='Dotted', LABEL_POSITION=0,/current)
mc = MAPCONTINENTS (/continents, FILL_COLOR='beige',/noclip)
After these two lines, this is the map I saw. If your latitude really correct?
|
|
|
|
Zachary Norman Basic Member
Posts:173  
07 Oct 2015 10:12 AM |
|
Hi Tao,
Unfortunately you cannot go from 0 to 360 degrees for the maps because the data space is defined from -180 to 180 degrees. This is how the map projections are set up themselves with degrees West (negative) and degrees East (positive). That means you cannot change it for making a map. It is pretty easy to change your data space from [0 to 360] to [-180 to 180] by subtracting 180 from your x-axis data values.
For my map projection, I'm not quite sure where you got "LIMIT=[-120, 0, 120, 360]" for Map 1 because above it shows "LIMIT=[ -90, -180, 90, 180 ]" which works as expected for generating a plot. Here is what my code generates (you might not have permissions to upload photos). This is also for IDL 8.5 and may look different than IDL 8.2. I would suggest you upgrade to IDL 8.5 if you can.
|
|
|
|
Deleted User New Member
Posts:  
09 Oct 2015 10:47 PM |
|
Hello Zac,
Now sure what happened, but my figure can only show up to 75 degrees.
Also, I want to correct you that although the x-labels can only show [-180, 180], but using LIMIT [-90, 0, 90, 360] did flip the x-axis and put 180 degree at the center of map. However, when you later on overplot something on this map, it will screw up. I know how to do those in my code, but when you try to show a bunch of kids who had no experiences at IDL, you always hope to keep it as simple as possible. So My thought is that you should definitely keep working on function MAP to make it more versatile. Make the LIMIT really work!! This is definitely not too much to ask.
Anyway, We purchased the license for thousands of bucks, and an ideal thought is that this should guarantee a lifetime bug fix – I am not asking for upgrade with new functionality, but to make sure the one we purchased functions well – this is the basic spirit in services, right? Personally, I would be extremely happy if you spot a bug in my code.
|
|
|
|
Zachary Norman Basic Member
Posts:173  
13 Oct 2015 12:25 PM |
|
Hi Tao,
Thanks for the additional information. I see what you are saying now about the ranges for Latitude and Longitude. The latitude for the mercator projection is cut off at 75 degrees N/S because it gets pretty wonky at higher latitudes. If you switch to a different projection, my sample code should work just fine. I have written a help article which may be of some use to you. It is an example of how to plot the globe 360 degrees from an arbitrary starting longitude and you can overplot some data into the data space. Here is a link for the example:
http://www.exelisvis.com/...d/14430/Default.aspx
|
|
|
|