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.
|