Re: Getting back on the coding horse - does anyone have any idea why IDL gives syntax errors on compile here? [message #94755] |
Thu, 28 September 2017 14:42 |
Lajos Foldy
Messages: 176 Registered: December 2011
|
Senior Member |
|
|
On Thursday, September 28, 2017 at 11:02:49 PM UTC+2, Peter Thorne wrote:
> After quite some time out managing projects I'm trying and failing to help my PhD student. I've written a little code to try to help interpolate values from regular grid to point.
>
> Why in the following does IDL consistently give syntax errors on compile ...
>
> FOR x=0,2 DO BEGIN ; Outer loop iterates across the three lons
> IF lon_vals(x) GE 180. THEN lon_vals(x)=lon_vals(x)-360
> FOR y=0,2 DO BEGIN ; Inner loop iterates across the three lats
> ; This calls the map_2points and result should hold the great arc distance in metres
> distance_in_metres=MAP_2POINTS(stationlon,stationlat,lon_val s(x),lat_vals(y),/metres)
> ; Place the distance in metres in the distances_to_use array
> distances_to_use(x,y) = distance_in_metres
> ENDFOR
> ENDFOR
>
> The syntax errors occur at second line: lon_vals point at the 'lo' but if I change the variable name it consistently points at the first two characters of this occurence whatever I name it. Then again at di in distances_to_use.
>
> These are not reserved names. Everything is defined and the code prior is simple and seemingly clean. So, I'm utterly flummoxed. I can move the commands around, put it in its own loops etc. and it still fails at exactly same point. Is this the GUI of IDL playing tricks? If so, its doing it across two machines. Am I missing something blindingly obvious?
Compiles for me without any error. Do you have a function called 'lon_vals' somewhere on your !PATH? Try with brackets for subscripting.
regards,
Lajos
|
|
|