Re: Contour with Map_Set after reading ASCII column data [message #66513] |
Sun, 17 May 2009 21:37 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
jacques.frastain@googlemail.com writes:
> I am new to IDL using it to process data for my master project. I have
> the following problem when it comes to using CONTOUR together with
> MAP_SET after reading in an ASCII data set.
>
> My data file looks in principle as follows:
>
> lon lat temp ; this header actually doesn't exists in the .dat
> file
> 10 10 5
> 20 10 10
> 30 10 15
> 10 15 6
> 20 15 11
> 30 15 16
> ....
>
> I use the following code to read the .dat file:
>
> OPENR,lun,'lon_lat_temp.dat',/GET_LUN
> rows = 1000
> data = fltarr(3,rows)
> READF,lun,data
>
> lon = data(0,*)
> lat = data(1,*)
> temp = data(2,*)
>
> lon2 = REFORM(lon)
> lat2 = REFORM(lat)
> temp2 = REFORM(temp)
>
> This way I create a data array 'DATA FLOAT = Array[3, 1000]' and by
> using REFORM I am able to create for each of the columns within
> my .dat file a row vector. However, from this point onwards I am in
> trouble - say I would like to plot a world map showing contours of the
> temperature (= temp) depending on my latitudes (lat) and longitudes
> (lon).
> Can anyone help me solving this issue?
When you have three vectors like this, IDL calls this "irregular"
data. Basically, you have to grid the data somehow. CONTOUR will
do this for you (I guess) if you pass it the three vectors and
set the IRREGULAR keyword. There are various ways to grid the
data. Here is an article that describes something like your
situation. Maybe it will be a place for you to start:
http://www.dfanning.com/tips/mapcontourdata.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|