Re: Grid lines misaligned when using CONTOUR and MAP_SET [message #83487] |
Thu, 07 March 2013 16:41 |
Matt Francis
Messages: 94 Registered: May 2010
|
Member |
|
|
On Friday, 8 March 2013 11:03:55 UTC+11, Coyote wrote:
>> It's a little bit difficult to tell, but I think so. Here is an example on an image produced using an ancestor of my current code that shows the same issue, presumably for the same reasons. Note that the LON=110 and LON=180 grid lines are offset a little, the same for the latitude grid lines in a way suggesting the MAP_GRID is leaving room for some annotation or border.
>
>
>
> OK, yes, MAP_SET "cheats" a little bit an leaves a bit of a border. You can see it more dramatically like this:
>
>
>
> cgmap_set, 0, 180, /continents, /cylindrical, position=[0.1, 0.1, 0.9, 0.9]
>
> cgcontour, cgdemodata(7), indgen(360), indgen(360)/2.0-90, /overplot, $
>
> position=[0.1, 0.1, 0.9, 0.9], /FILL
>
> cgmap_continents
>
>
>
> Another reason, I guess, to prefer Map_Proj_Init although that has its own problems with these global data sets. But, for a place like Australia it should work fine.
>
>
>
> David
Great thanks. Using the cgMap object with 'Equirectangular' seems to do the job nicely.
|
|
|
Re: Grid lines misaligned when using CONTOUR and MAP_SET [message #83491 is a reply to message #83487] |
Thu, 07 March 2013 16:03  |
DavidF[1]
Messages: 94 Registered: April 2012
|
Member |
|
|
> It's a little bit difficult to tell, but I think so. Here is an example on an image produced using an ancestor of my current code that shows the same issue, presumably for the same reasons. Note that the LON=110 and LON=180 grid lines are offset a little, the same for the latitude grid lines in a way suggesting the MAP_GRID is leaving room for some annotation or border.
OK, yes, MAP_SET "cheats" a little bit an leaves a bit of a border. You can see it more dramatically like this:
cgmap_set, 0, 180, /continents, /cylindrical, position=[0.1, 0.1, 0.9, 0.9]
cgcontour, cgdemodata(7), indgen(360), indgen(360)/2.0-90, /overplot, $
position=[0.1, 0.1, 0.9, 0.9], /FILL
cgmap_continents
Another reason, I guess, to prefer Map_Proj_Init although that has its own problems with these global data sets. But, for a place like Australia it should work fine.
David
|
|
|
Re: Grid lines misaligned when using CONTOUR and MAP_SET [message #83492 is a reply to message #83491] |
Thu, 07 March 2013 15:59  |
Matt Francis
Messages: 94 Registered: May 2010
|
Member |
|
|
On Friday, 8 March 2013 10:47:22 UTC+11, Coyote wrote:
> Bogdanovist wrote:
>
>> Actually I am using cgContour, but I get the same behaviour using the vanilla versions or their CG equivalents. I posted the question using the vanilla ones for simplicity (since the results for this issue were the same).
>
>
>
> Humm. It is hard to me to visualize the problem, I guess. Do these two lines of code show the problem?
>
>
>
> cgcontour, cgdemodata(7), position=[0.1, 0.1, 0.9, 0.9], /FILL
>
> cgmap_set, 0, 180, /continents, /cylindrical, position=[0.1, 0.1, 0.9, 0.9], /noerase
>
>
> David
It's a little bit difficult to tell, but I think so. Here is an example on an image produced using an ancestor of my current code that shows the same issue, presumably for the same reasons. Note that the LON=110 and LON=180 grid lines are offset a little, the same for the latitude grid lines in a way suggesting the MAP_GRID is leaving room for some annotation or border.
http://www.ips.gov.au/Images/Satellite/Total%20Electron%20Co ntent/TEC%20Regional%20Map/TECRegionalMap.png
|
|
|
Re: Grid lines misaligned when using CONTOUR and MAP_SET [message #83493 is a reply to message #83492] |
Thu, 07 March 2013 15:47  |
DavidF[1]
Messages: 94 Registered: April 2012
|
Member |
|
|
Bogdanovist wrote:
> Actually I am using cgContour, but I get the same behaviour using the vanilla versions or their CG equivalents. I posted the question using the vanilla ones for simplicity (since the results for this issue were the same).
Humm. It is hard to me to visualize the problem, I guess. Do these two lines of code show the problem?
cgcontour, cgdemodata(7), position=[0.1, 0.1, 0.9, 0.9], /FILL
cgmap_set, 0, 180, /continents, /cylindrical, position=[0.1, 0.1, 0.9, 0.9], /noerase
David
|
|
|
Re: Grid lines misaligned when using CONTOUR and MAP_SET [message #83494 is a reply to message #83493] |
Thu, 07 March 2013 15:36  |
Matt Francis
Messages: 94 Registered: May 2010
|
Member |
|
|
Actually I am using cgContour, but I get the same behaviour using the vanilla versions or their CG equivalents. I posted the question using the vanilla ones for simplicity (since the results for this issue were the same).
Here is my actual code (it's a little messier but I'm sure you'll get the gist):
cgContour, self->get_data(),self->get_lon_map(),self->get_lat_map(), /Fill, Levels=contourLevels, C_Colors=colors, $
/OutLine, Position=position,title=self->title(datetime),charsize=1.,xtitle=self- >xtitle(),ytitle=self->ytitle(),/noerase
cgMap_set,0,180,/continents,/cyl,/grid,e_grid={londel:10.,la tdel:10.},/noerase,limit=[self.lat_min,self.lon_min,self.lat _max,self.lon_max],$
position=position,mlinethick=5.
|
|
|
Re: Grid lines misaligned when using CONTOUR and MAP_SET [message #83500 is a reply to message #83494] |
Thu, 07 March 2013 14:46  |
DavidF[1]
Messages: 94 Registered: April 2012
|
Member |
|
|
On Thursday, March 7, 2013 3:23:19 PM UTC-7, Bogdanovist wrote:
> I want to do something pretty simple, which is to create a map with continents and overlay contours. The bare bones of the key part of the code looks like this:
>
>
>
> position = [pos_xmin,pos_ymin,pos_xmax,pos_ymax]
>
> Contour,data,lons,lats, /Fill, Levels=contourLevels, c_colors=contourColours,position=position
>
> Map_set,0,180,/continents,/cyl,/grid,/NoErase,position=posit ion
>
>
>
> It looks like map_set (or actually map_grid) is making grid lines within the region specified by position, but is leaving room for some non-existant annotation and therefore becomes misaligned with respect to the co-ordiantes established by CONTOUR.
>
>
>
> How can this be done correctly?
Sigh... You could use cgContour. Or, you could probably just set XStyle=1 and YStyle=1 keywords on the brain dead Contour command. :-)
Cheers,
David
|
|
|