Le jeudi 15 novembre 2012 14:44:52 UTC+1, David Fanning a écrit :
> Alain writes:
>
>
>
>> Ten minutes with your example gave me the following:
>
>
>
> Ah. I would have thought the word "duplicate" came
>
> from the French, but apparently not. ;-)
>
>
>
> OK, I have completely given up on getting an exact
>
> duplication of the plot I want, but it has to be
>
> considerably closer than this example!
>
>
>
> Robert Vincent and I spent another couple of hours
>
> working on this together last night. Although Robert
>
> had decided to give up on function graphics by the end
>
> of the night, I'm dumb enough to keep plodding onward.
>
>
>
> Anyway, together we came up with something that was
>
> showing some promise. Here is a comparison between
>
> the plot we are trying to duplicate on the left,
>
> and the plot we have come up with on the right:
>
>
>
> http://www.idlcoyote.com/misc/fg_map_side_by_side.png
>
>
>
> It took nearly forever to figure out the color bar,
>
> but we finally got it.
>
>
>
> There are obvious problems. The FG contour plot is
>
> still VERY small in the window. We haven't been able
>
> to figure out how to make it bigger. It seems to
>
> ignore the POSITION keyword we are passing to it.
>
> The box axes are a total joke. You can only label
>
> them on two sides, and even then, you can't label
>
> them as normal box axes.
>
>
>
> But, still, it was looking pretty good. At least
>
> it was until I took a close look at the lines that
>
> we overplot onto the filled contours. You have to
>
> blow up the plot to see this really well, so here
>
> is a blow up of the FG contour plot:
>
>
>
> http://www.idlcoyote.com/misc/fg_map_blowup.png
>
>
>
> You will notice that the overplotted lines don't
>
> line up AT ALL with the filled contours!!!!
>
>
>
> This, despite the fact that the two contour commands
>
> we use to create the filled and outline contours are
>
> IDENTICAL as far as we can tell!
>
>
>
> Here is the code we are currently using:
>
>
>
> http://www.idlcoyote.com/misc/fg_map_contour.pro
>
>
>
> We welcome any and all to tell us what we are doing
>
> wrong.
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
You should have read more carefully and executed the code I sent previously. It is pretty close of what you want. The trick is to draw the map first, then to overplot the filled and line contours. A slightly modified version follows:
;-----------------------------------------
restore, 'air.nc.data.sav'
t = systime(1)
Loadct, 53, RGB_TABLE=rgb
rgb = reverse(rgb,1)
nlevels = 12
levels = round((max(data, MIN=mindata) - floor(mindata))*findgen(nlevels)/nlevels) + floor(mindata)
levels = [levels[0], levels]
win = Window(Dimension=[640, 512])
win.Refresh, /DISABLE
mp = map('Equirectangular', CENTER_LONGITUDE=180, $
POSITION=[0.1,0.05,0.95,0.80], $
LABEL_POSITION = 0, BOX_AXES=1, $
GRID_LATITUDE = 30, GRID_LONGITUDE = 45, $
/CURRENT, ASPECT_RATIO=0)
mp['Longitudes'].LABEL_ANGLE = 90
cn = contour(data, lon, lat, /OVERPLOT, $
GRID_UNITS=2, MAP_PROJECTION='Equirectangular', $
RGB_TABLE=rgb, /CURRENT, $
C_VALUE=levels, /FILL)
cn1 = contour(data, lon, lat, /OVERPLOT, $
GRID_UNITS=2, MAP_PROJECTION='Equirectangular', $
RGB_TABLE=rgb, /CURRENT, $
C_VALUE=levels, C_COLOR=!Color.White)
cb = COLORBAR(POSITION=[0.1, 0.91, 0.95, 0.95], $
BORDER=1, TARGET=cn, TICKVALUES=levels, TITLE='Temperature °K')
m = MapContinents(COLOR=!Color.red)
win.Refresh
print,'elaps:', systime(1) - t
end
;----------------------------------------------
There is no particular difficulty nor surprise, except the '0°E' extra label.
alain.
|