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

Home » Public Forums » archive » Re: map_image and write_jpeg assistance needed
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: map_image and write_jpeg assistance needed [message #5169] Tue, 17 October 1995 00:00
Robert.M.Candey is currently offline  Robert.M.Candey
Messages: 23
Registered: June 1995
Junior Member
In article <460g6d$a1o@post.gsfc.nasa.gov>, corprew@daacdev1.stx.com
(Frank Corprew) wrote:

> Hi,
>
> I have recently started using to IDL to create animations with a number of
> in house generated data products, such as re-gridded TOMS and Sea Surface
> Temperature data, with the end goal being to create an animation of these
> and other data sets, with output images being saved to files in jpeg
> format. I had succeed in animating my data, with one small problem. When
> I initially displayed my data on an orthographic projection with the view
> centered on -60 latitude, and -90 longitude, I my data displayed nicely
> except that the data for the northern hemisphere, was being displayed on
> the southern hemisphere. I realized that I would have to change to
> !ORDER =1. On re-displaying these data afterwards, I found that data
> that should have been displayed around the poles was now displayed
> around the equator? Does anyone have any ideas on what I may not be
> doing correctly.
>
> My other problem is that I wish to save my images as jpegs, but starts out
> as a nice colerful image, using the rainbow color table, ends up as a jpeg
> that is greyscale, with a little bit of light blue. This is not even close
> to what I was after. On discussing this with others with greater experience
> in IDL, I was told that I would have to write the image out three times in
> red, green, blue inorder to retain the image color. Has anyone done this?
> I have been unable to find anything more but a very brief statement of how
> write_jpeg should be used.
>
> My .pro program follows at the end, if needed.
>
> I appreciate any and all help.
>
> Thanks,
>
> Frank Corprew
>
> PRO animate2
> !err = 0
> !order = 1
> lon = 360
> lat = 180
> data = fltarr(lon, lat)
> pathin ='/data5/corprew/TOMS/tomsinterusev6'
> pathout = '/data5/corprew/TOMS/tomsimagev6/'
> filesin=FINDFILE(pathin+'/*.bin', COUNT=nfiles)
> LOADCT, 13
> WINDOW, 0, XPOS=100, YPOS=100
> erase, 90
> FOR i=0, 10 DO BEGIN
> color = (!D.N_Colors/10)*i
> TV, Replicate(color, 20, 15), 20*i+200, 40
> ENDFOR
> XYOuts, COLOR = 255, /DEVICE, 190, 20, '150'
> XYOuts, COLOR = 255, /DEVICE, 410, 20, '450'
> MAP_SET, -60, -90, /Orthographic, /NOERASE, XMARGIN = [5, 5], YMARGIN =
[5, 5]
> XYOuts, COLOR = 255, /DEVICE, 160, 446, 'Total Column Ozone (D.U)'
> FOR i=0, nfiles-1 DO BEGIN
> OPENR, 10, filesin(i)
> READU, 10, data
> year = STRMID(filesin(i), 52, 2)
> month = STRMID(filesin(i), 54, 2)
> ozone = BYTSCL(data, MIN=150,MAX=450)
> warp = MAP_IMAGE(ozone, xx, yy, XSize, YSize, Compress = 4)
> if !err eq 4 then goto, done
> TV, warp, xx, yy
> MAP_GRID, COLOR = 255, LATLAB = -45, LONLAB = -30, /LABEL
> MAP_CONTINENTS, COLOR = 255
> XYOuts, COLOR = 255, /DEVICE, 390, 446, month+'/'+year
> tomsimage = TvRd()
> TIFF_WRITE, pathout+year+month+'.gif', tomsimage
> XYOuts, COLOR = 0, /DEVICE, 390, 446, month+'/'+year
> CLOSE, 10
> stop
> ENDFOR
> done:
> END

I think you need to add minLat, maxLat, minLon, maxLon keywords to map_image
for it to correctly align your data to the map. There may also be some bugs
in map_image handling of negative longitude or something that I am currently
struggling with.

I recommend write_gif for 8 bit deep color (you need to add the color table
to the call as well; see the IDL FAQ). You mention JPEG above which is best
reserved for 24 bit color lossy compression. You are calling TIFF_WRITE but
with filename .GIF which could be confusing your viewer. TIFF_WRITE has
red, green, and blue keywords for passing the color table:

tvlct, r, g, b, /get
tiff_write, pathout+year+month+'.gif', tomsimage, red=r,green=g,blue=b

TIFF has a number of forms and is not very portable; try write_gif

--
Robert.M.Candey@gsfc.nasa.gov
NASA Goddard Space Flight Center, Code 632
Greenbelt, MD 20771 USA 1-301-286-6707
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Q: IDL to C translator
Next Topic: ALL_EVENTS keyword in WIDGET_TEXT

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

Current Time: Wed Oct 08 15:21:53 PDT 2025

Total time taken to generate the page: 0.00537 seconds