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

Home » Public Forums » archive » contour problem (Triangle not in counterclockwise order)
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
contour problem (Triangle not in counterclockwise order) [message #93284] Sat, 04 June 2016 08:58 Go to next message
skymaxwell@gmail.com is currently offline  skymaxwell@gmail.com
Messages: 127
Registered: January 2007
Senior Member
I need to create a contour on map by data holds in the CSV file: longitude,latitude,probability. Here is a fragment from one CSV file.

0,-70,0
0,-67.5,0
0,-65,1
0,-62.5,1
0,-60,0.9
0,-57.5,0.9
0,-55,1
0,-52.5,1
0,-50,0.6
0,-47.5,0.5
0,-45,1
0,-42.5,1
0,-40,1
0,-37.5,0.9
0,-35,0.5
0,-32.5,0.7
0,-30,0.6
0,-27.5,0.5
0,-25,0.6
0,-22.5,0.5
0,-20,0.5
0,-17.5,0.3
0,-15,0.2
0,-12.5,0.2
0,-10,0.2
0,-7.5,0.1
0,-5,0.2
0,-2.5,0.5
0,0,0.4
0,2.5,0.4
0,5,0.4
0,7.5,0.4
0,10,0.4
0,12.5,0.7
0,15,0.6
0,17.5,0.3
0,20,0.2
0,22.5,0.1
0,25,0
0,27.5,0
0,30,0
0,32.5,0
0,35,0
0,37.5,0
0,40,0.3
0,42.5,0.5
0,45,0.6
0,47.5,0.3
0,50,0.1
0,52.5,0
0,55,0.5
0,57.5,0.6
0,60,0.5
0,62.5,0.7
0,65,0.8
0,67.5,0.7
0,70,0
15,-70,0
15,-67.5,1
15,-65,1
15,-62.5,1
15,-60,0.8
15,-57.5,0.8
....

To process CSV file and create a contour I wrote

PRO CSVCONTOUR
path="E:\work\"
csvfile = DIALOG_PICKFILE(FILTER='*.csv',PATH=path)
Result = READ_CSV(csvfile)
;get coordinates
lon=result.FIELD1
lat=result.FIELD2
;get values
value=result.FIELD3
count=N_ELEMENTS(lat)
latLimit=MAX(lat)
PRINT,"count=",count," latLimit=",latLimit

;need a map proj. Also add a colorbar to contour
m = MAP('Mercator')
ct = COLORTABLE(72,/REVERSE)
c = CONTOUR(value, lon, lat, /FILL, OVERPLOT=m, GRID_UNITS='degrees', $ RGB_TABLE=ct, TITLE='Prob')
mc = MAPCONTINENTS()
cb = COLORBAR(TITLE='Probability')
END


Then I run a program, i got the following messages and only map grid is showing

count= 1425 latLimit= 70.000000
% GRIDDATA: Triangle 484 not in counterclockwise order.
% GRIDDATA: Triangle 586 not in counterclockwise order.
% GRIDDATA: Triangle 588 not in counterclockwise order.
% GRIDDATA: Triangle 589 not in counterclockwise order.
% GRIDDATA: Triangle 1814 not in counterclockwise order.
% GRIDDATA: Triangle 1815 not in counterclockwise order.
% GRIDDATA: Triangle 2223 not in counterclockwise order.
% GRIDDATA: Triangle 2440 not in counterclockwise order.
% CONTOUR: GRIDDATA: Triangle 2441 not in counterclockwise order.

So, how to fix that to get a contour ? What does that mean by "Triangle not in counterclockwise order" ? Any problem with CSV's data ?

Thanks at advance
Re: contour problem (Triangle not in counterclockwise order) [message #93289 is a reply to message #93284] Mon, 06 June 2016 13:08 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Saturday, June 4, 2016 at 11:58:32 AM UTC-4, skymaxwell wrote:
> I need to create a contour on map by data holds in the CSV file: longitude,latitude,probability. Here is a fragment from one CSV file.
>
> 0,-70,0
> 0,-67.5,0
> 0,-65,1
> 0,-62.5,1
> 0,-60,0.9
> 0,-57.5,0.9
> 0,-55,1
> 0,-52.5,1
> 0,-50,0.6
> 0,-47.5,0.5
> 0,-45,1
> 0,-42.5,1
> 0,-40,1
> 0,-37.5,0.9
> 0,-35,0.5
> 0,-32.5,0.7
> 0,-30,0.6
> 0,-27.5,0.5
> 0,-25,0.6
> 0,-22.5,0.5
> 0,-20,0.5
> 0,-17.5,0.3
> 0,-15,0.2
> 0,-12.5,0.2
> 0,-10,0.2
> 0,-7.5,0.1
> 0,-5,0.2
> 0,-2.5,0.5
> 0,0,0.4
> 0,2.5,0.4
> 0,5,0.4
> 0,7.5,0.4
> 0,10,0.4
> 0,12.5,0.7
> 0,15,0.6
> 0,17.5,0.3
> 0,20,0.2
> 0,22.5,0.1
> 0,25,0
> 0,27.5,0
> 0,30,0
> 0,32.5,0
> 0,35,0
> 0,37.5,0
> 0,40,0.3
> 0,42.5,0.5
> 0,45,0.6
> 0,47.5,0.3
> 0,50,0.1
> 0,52.5,0
> 0,55,0.5
> 0,57.5,0.6
> 0,60,0.5
> 0,62.5,0.7
> 0,65,0.8
> 0,67.5,0.7
> 0,70,0
> 15,-70,0
> 15,-67.5,1
> 15,-65,1
> 15,-62.5,1
> 15,-60,0.8
> 15,-57.5,0.8
> ....
>
> To process CSV file and create a contour I wrote
>
> PRO CSVCONTOUR
> path="E:\work\"
> csvfile = DIALOG_PICKFILE(FILTER='*.csv',PATH=path)
> Result = READ_CSV(csvfile)
> ;get coordinates
> lon=result.FIELD1
> lat=result.FIELD2
> ;get values
> value=result.FIELD3
> count=N_ELEMENTS(lat)
> latLimit=MAX(lat)
> PRINT,"count=",count," latLimit=",latLimit
>
> ;need a map proj. Also add a colorbar to contour
> m = MAP('Mercator')
> ct = COLORTABLE(72,/REVERSE)
> c = CONTOUR(value, lon, lat, /FILL, OVERPLOT=m, GRID_UNITS='degrees', $ RGB_TABLE=ct, TITLE='Prob')
> mc = MAPCONTINENTS()
> cb = COLORBAR(TITLE='Probability')
> END
>
>
> Then I run a program, i got the following messages and only map grid is showing
>
> count= 1425 latLimit= 70.000000
> % GRIDDATA: Triangle 484 not in counterclockwise order.
> % GRIDDATA: Triangle 586 not in counterclockwise order.
> % GRIDDATA: Triangle 588 not in counterclockwise order.
> % GRIDDATA: Triangle 589 not in counterclockwise order.
> % GRIDDATA: Triangle 1814 not in counterclockwise order.
> % GRIDDATA: Triangle 1815 not in counterclockwise order.
> % GRIDDATA: Triangle 2223 not in counterclockwise order.
> % GRIDDATA: Triangle 2440 not in counterclockwise order.
> % CONTOUR: GRIDDATA: Triangle 2441 not in counterclockwise order.
>
> So, how to fix that to get a contour ? What does that mean by "Triangle not in counterclockwise order" ? Any problem with CSV's data ?
>
> Thanks at advance

It is using GRIDDATA to grid the irregularly-spaced data before contouring. See the CONTOUR documentation. Also from the CONTOUR documentation:

"Depending upon the dataset, the automatic gridding may fail or may produce displeasing results. In this case you should do the gridding yourself, perhaps using a different gridding method to GRIDDATA."

-Jeremy.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: MWRFITS not writing header
Next Topic: YRAANGE

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

Current Time: Wed Oct 08 11:24:24 PDT 2025

Total time taken to generate the page: 0.84161 seconds