Hi VisAD people,
I am using the visad.bom.Radar2DCoordinateSystem to resample and
visualize some radar data.
As we can see in the picture "radar_Linear2DSet.png", the data are not in polar
representation.
This is happening because I might be using the method Linear2DSet.
What is the correct way to make the representation in polar coordinates?
The Application Unidata IDV (see picture "radar_polar_IDV.png") is the
representation of data from radars in polar coordinates equal to I want to do. How?
Following excerpt from my source code:
/*********************************/
setRadar = new Linear2DSet(domain_tuple, radarlimites[2], radarlimites[3],
800, radarlimites[0], radarlimites[1],
360);
latMap.setRange(radarlimites[2], radarlimites[3]);
lonMap.setRange(radarlimites[0], radarlimites[1]);
vals_ff = getFieldPolar((int) srf.getNumero_BINS_ou_Linhas(),
(int) srf.getNumero_Raios_ou_Colunas(),
(float) srf.getLatitude(), (float) srf.getLongitude(),
srf.getTamanho_Bin_ou_celula(), srf.getDados());
vals_ff = (FlatField) vals_ff.resample(setRadar, visad.Data.NEAREST_NEIGHBOR,
visad.Data.NO_ERRORS);
radarMap.setRange(0, 72);
ColorAlphaControl rgbControl = (ColorAlphaControl) radarMap.getControl();
cores = new float[][]{{0f, 0.98f, 0f}, {0f, 0.81f, 0f}, {0f, 0.7f, 0f}, {0f,
0.59f, 0f}, {0f, 0.47f, 0f}, {0f, 0.33f, 0f}, {0f, 0.22f, 0f}, {0.98f, 0.95f,
0f}, {0.96f, 0.88f, 0f}, {0.96f, 0.82f, 0f}, {0.95f, 0.76f, 0f}, {0.91f, 0.55f,
0f}, {0.9f, 0.48f, 0f}, {0.98f, 0f, 0f}, {0.87f, 0f, 0f}, {0.78f, 0f, 0f},
{0.72f, 0f, 0f}, {0.65f, 0f, 0f}, {1f, 0.62f, 1f}, {0.98f, 0.13f, 0.98f},
{0.88f, 0.13f, 0.88f}, {0.80f, 0.13f, 0.92f}, {0.69f, 0.16f, 0.86f}, {0.63f,
0.17f, 0.84f}, {0.57f, 0.17f, 0.80f}};
//Seta a escala de cores
rgbControl.setTable(RadarCalculos.getCoresVisad(cores));
//Toca plotar
if (radarRef == null) {
radarRef = new DataReferenceImpl("radarref");
displayImpl.addReference(radarRef);
}
radarRef.setData(vals_ff);
/*********************************/
method getFieldPolar
/*********************************/
private FlatField getFieldPolar(int beans, int rays, final float lat,
final float lon, final float dist, final float[][] data) {
try {
reflection1 = RealType.getRealType("reflection");
azimuth = RealType.getRealType("azimuth", CommonUnit.degree, null);
range = RealType.getRealType("range", CommonUnit.meter, null);
polarCoords = new Radar2DCoordinateSystem(lat, lon, dist, dist, 0f,
1.003f);
polarTuple = new RealTupleType(new RealType[]{range, azimuth},
polarCoords, null);
polarFunc = new FunctionType(polarTuple, reflection);
latLonTuple = new RealTupleType(RealType.Latitude,
RealType.Longitude);
latLonFunc = new FunctionType(latLonTuple, reflection);
//Copia os dados para uma matriz com um raio a mais (361 - rays + 1)
//O Visad exige que o último raio seja igual ao primeiro
float[][] dados = new float[1][(rays + 1) * beans];
for (int i = 0; i < rays + 1; i++) {
for (int j = 0; j < beans; j++) {
if (i != rays) {
dados[0][i * beans + j] = data[0][i * beans + j];
} else {
dados[0][i * beans + j] = data[0][0 * beans + j];
}
if (Float.isNaN(dados[0][i * beans + j])) {
dados[0][i * beans + j] = -999.9f;
}
}
}
Set set = new Integer2DSet(polarTuple, beans, rays + 1);//rays+1
para termos 361 raios
FlatField flatField = new FlatField(polarFunc, set);
flatField.setSamples(dados, true);
return flatField;
} catch (RemoteException ex) {
Logger.getLogger(DisplayVisad.class.getName()).log(Level.SEVERE,
null, ex);
} catch (VisADException ex) {
Logger.getLogger(DisplayVisad.class.getName()).log(Level.SEVERE,
null, ex);
}
return null;
}
/*********************************/
Thanks
Marco Aurélio Silva Neto