# Re: Lat/Lon to Polar: Revisited

```Hi Kevin,

> Hmmm.  The error I am getting does not appear to be related to a zero
> radius.   Here is the output of the consistency check:
>
> Samples[0][1] = 564688.6 Samples[0][0] = 565236.0 Samples[1][LengthX+1]
> = 314.9523 Samples[1][1] = 315.0188
> Samples[1][1] = 315.0188 Samples[1][0] = 314.96332 Samples[0][LengthX+1]
> = 564034.06 Samples[0][1] = 564688.6
> v00[]=Samples[][516] v10[]=Samples[][517] v01[]=Samples[][1549]
> v11[]=Samples[][1550]
> Pos = true
> 1st = -333234.62 2nd = -333234.38 3rd = -333223.12 4th = -333223.38
> not form a valid grid (516,0)
> . . .
> LengthX: 1033, LengthY: 863

I see you uncommented the print statements that are already
in the consistency test of the Gridded2DSet constructor, and
unfortunately most of that information is not useful (don't
recall if I or someone else wrote these print statements, but
note that values of the Samples array are printed for indices
other than those used to compute v00, v01, v10 and v11).

But one useful piece of information is "(516,0)". Note that
516 is about half of LengthX = 1033, so the offending grid
box is at the haflway point along X. In fact, the offending
grid box from X=516 to X=517 exactly straddles 1033/2.

If X is your azimuth coordinate, is there an error in
computing angles halfway around the circle? One possibility
is that angles increase from X=0 to X=516, then there is a
decrease from X=516 to X=517, then they increase again.
there a similar error in computing radius halfway out, at
X=516?

> >Actually, you may want to define the grid for each radar
> >on a different RealTuple (range_i, azimuth_i), each with
> >a different Radar2DCoordinateSystem to the
> >(Latitude, Longitude) reference RealTuple. Then just use
> >the ScalarMaps of Latitude and Longitude to XAxis and
> >YAxis.
>
> Assuming that I'll process one netCDF file at a time (with a single
> corresponding radar location), I would then define my RealTypes "range"
> and "azimuth" and map them to XAxis and YAxis?

If you are just looking at one radar at a time, then you
can either do your original suggestion, with ScalarMaps