Re: Lat/Lon to Polar

Hi Kevin,

> I have a basic netCDF file with data:
> (Latitude, Longitude) -> Altitude.

This is incorrect. Plain reads your file with MathType:

  ((Longitude, Latitude) -> Altitude)

> The output in this format looks like this:
> Using the BoM package's Radar2DCoordinateSystem, I want to change the
> domain of the netCDF file from (Latitude, Longitude) to (Azimuth, Range)
> for easier overall computation.
> I realize that the output from the
> Radar2DCoordinateSystem.fromReference() method is in (Range, Azimuth).
> Additionally, I found out that when obtaining the DomainSet samples from
> the original netCDF files, they actually come as (Longitude, Latitude)
> and I have rearranged these for input to the Radar2DCoordinateSystem method.
> When I do this, my output looks like this:
> and when displaying the coordinates by clicking the middle mouse button,
> I find that the 0 degree azimuth is along the right side of the display.
>   This makes some sense as the image appears to be "flipped over" and
> rotated 90 degreesclockwise.
> My code is attached below and I have been trying almost anything I can
> think of to correct this problem.  I would greatly appreciate any help
> on this!  If you want to run the script, the netCDF file can be found at:
> (Shift + Right Click the link below)

Thanks for the test program and data set. There were two problems:

1. You were constructing your new domain Set as:

  Gridded2DSet azRanSet
    new Gridded2DSet(azRanTT, azRanDomain, azRanDomain[0].length);

which has manifold dimension = 1. This is why your second GIF
image had those weird lines. If you zoom way in you'll see the
whole image is just one long line (the weird lines are like a
TV's return sweep). The new domain Set should be:

  Gridded2DSet azRanSet = new Gridded2DSet(azRanTT, azRanDomain,
    dset.getLength(0), dset.getLength(1), null, null, null, false, false );


  Gridded2DSet dset = (Gridded2DSet) terrainData_ff.getDomainSet();

The second 'false' tells it not to test the sample topology - a
Cartesian grid makes an invalid grid in polar coordinates, which
would hurt if you tried to resample() from this new Gridded2DSet
(but you don't, so its OK not to test).

2. The azimuth in Radar2DCoordinateSystem doesn't align with
Longitude - they have different angular conventions. To align
them in the display, add:

  azMap.setRange(90.0, -270.0);

Note that Radar2DCoordinateSystem is intended to take a radar
grid sampled in (range, azimuth) coordinates and transform it
into (Latitude, Longitude) coordinates. You are using it
differently than intended. That's OK, but expect problems (in
this case, the fact that azimuth and Longitude use different
angular conventions).

Good luck,

  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: