Re: Map projection of IMAGE() is behaving strangely... [message #94796 is a reply to message #86531] |
Tue, 17 October 2017 11:33   |
Brian McNoldy
Messages: 35 Registered: July 2000
|
Member |
|
|
I see this thread is nearly 4 years old now, but it just came in handy for me this week. I was trying to plot an image with a map projection and then overlay filled continents... all using functional graphics. It was frustrating, but I ended up using a combination of two tricks suggested in here:
1) I needed to add a blank row to the beginning of my image array because the map projection process would "eat"/truncate the first row (but not column). Doing so magically solved that quirk. No idea what's going on there.
2) I called MAP first with my projection of choice, and then added the IMAGE with /OVERPLOT.
The guts of my successful result looks like:
m=map('Mollweide',center_longitude=clon,limit=limit,position =position,$
dimensions=[1200,500])
i=image(array,lons[0:-2],lats,grid_units='degrees',rgb_table =table,$
image_dimensions=[360,90],image_location=[0,-45],/overplot)
(My data array spanned all longitudes but only -45 to +45 in latitude.)
(The different treatment of the lons and lats arrays was because of needing to extend the array and latitude vector as described in (1)).
It feels like a hack, but the result is what I was hoping for.
FYI,
Brian
On Friday, November 15, 2013 at 12:43:52 PM UTC-5, AMS wrote:
> Brain, I wonder if that could be related at all to the odd behaviour (reported to ExelisVis but not something they're going to fix) of map_image truncating edges? https://groups.google.com/forum/#!searchin/comp.lang.idl-pvw ave/map_image/comp.lang.idl-pvwave/3BmVLThB8Lk/_QUaZ--wehkJ
>
> On Friday, November 15, 2013 11:52:07 AM UTC-5, brain...@gmail.com wrote:
>> On Friday, 15 November 2013 16:43:33 UTC+1, AJAS wrote:
>>
>>> Woops!
>>
>>>
>>
>>>
>>
>>>
>>
>>> I just noticed the bottom Y value is missing as well! Disaster.
>>
>>
>>
>> Well, that problem in not only related to IMAGE function. It is found also in iTools and function iImage, and it is inherited from who knows where and when. I was really expecting that new graphics will solve it, but when i tried it for the first time I was dissapointed.
>>
>>
>>
>> I was always using a quite straightforward way around, to give to idl one row and column it can swallow:
>>
>>
>>
>> z_enlarged = FLTARR(3,nlon+1, nlat+1)
>>
>> z_enlarged[0,1,1] = z
>>
>> lon_enlarged = ((max(lon)-min(lon))/float(nlon))*findgen(nlon+1)+min(lon)
>>
>> lat_enlarged = ((max(lat)-min(lat))/float(nlat))*findgen(nlat+1)+min(lat)
>>
>>
>>
>> It is not perfect still, because idl shrinks the field little bit, but with a large number of points it looks good.
>>
>>
>>
>> Any other solution?
|
|
|