Location>code7788 >text

MeteoInfo-Java parsing and mapping tutorial (X)_JAVA plotting radar PPI map

Popularity:586 ℃/2024-12-17 21:53:06

There are many basic elements of weather radar, especially dual-polarized radar, but the business scenarios are often used for the basic reflectivity, the basic speed of these two elements

Next, we take the basic reflectivity as an example, and the other elements are the same, one pass, one pass.

First of all, we do the basic reflectivity map need to determine which elevation angle layer, because the radar body scanning mode scanning is a different elevation angle scanning, conventional radar is generally 9 elevation angle

Following the picture above it's obvious what a body scan mode scan looks like

Since the basic elements of a radar are radial data, let's look at how radial data is plotted graphically.

It can be seen that the element product is composed of n radial data, and all the radial data from point O form a perfect circle according to the azimuthal angle and the distance.

So if we draw a layer of elevation, we need distance, azimuth, and value.

Now we will plot the radial data of the first layer of the basic reflectance, i.e., 0.5 degree elevation angle.

MeteoDataInfo meteoDataInfo = new MeteoDataInfo();
("D:\\tls\\\\Z_RADR_I_Site_20220407233130_O_DOR_CC_CAP_FMT.bin");
CMARadarBaseDataInfo info = (CMARadarBaseDataInfo) ();
//Chromatic color
int[][] cols = {
        {255, 255, 255},
        {102, 255, 255},
        {102, 255, 255},
        {0, 162, 232},
        {86, 225, 250},
        {3, 207, 14},
        {26, 152, 7},
        {255, 242, 0},
        {217, 172, 113},
        {255, 147, 74},
        {255, 0, 0},
        {204, 0, 0},
        {155, 0, 0},
        {236, 21, 236},
        {130, 11, 130},
        {184, 108, 208}
};
//Color scale value
double[] levs = new double[]{Integer.MIN_VALUE,0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70,Integer.MAX_VALUE};
//Returns a Color object based on RGB
Color[] colors = (cols);
//Generate color gradations for plotting based on values and colors
LegendScheme ls = (levs,colors, );
List<String> list = new ArrayList<>();
//Prepare the required elements in advance
//reflectivity
("dBZ");
//azimuth
("azimuthR");
//gap
("distanceR");
//azimuth
("elevationR");
//Plot the corresponding data from the base data into a layer
VectorLayer layer = (info,list,0,ls);
MapView view = new MapView();
(layer);
//Export Images
(view,1200,"D:/tls/");
It's a very simple method.,I wrapped it up randomly.,Just to satisfy the needs of the people who, according toRGBcome (or go) backColorboyfriend,So the code will not be published
Rather, it's the core of the value taken,Let's get specific.
public static VectorLayer getRadarArray(CMARadarBaseDataInfo info, List<String> pros, int i, LegendScheme ls) throws Exception {
        //site latitude
        Attribute lat = ("StationLatitude");
        //Station Longitude
        Attribute lon = ("StationLongitude");
        //altitude
        Attribute high = ("AntennaHeight");
        List<String> names = ();
        if (!(pros)) {
            return null;
        }
        //Read radial data of the desired element from the base data.
        Array ay = ((0));
        Array[] arrays = new Array[4];
        //Get the number of radial data, i.e. the number of azimuths.
        int azimuthNum = ()[1];
        //Get the number of data blocks in a radial data row
        int dataBlockNum = ()[2];
        //--------- to get the radial data of layer i, the format layout is Z*Y*X
//Setting the starting position for reading data
        int[] origin = new int[]{i, 0, 0};
        //Setting the number of data read
        int[] size = new int[]{1, azimuthNum, dataBlockNum};
        //Setting the step size for reading data
        int[] stride = new int[]{1, 1, 1};
        //Taking out the single layer of radial data of an element
        arrays[0] = ((0), origin, size, stride);
        //--------- to get the azimuth of layer i
        origin = new int[]{i, 0};
        size = new int[]{1, azimuthNum};
        stride = new int[]{1, 1};
        //Taking out the azimuth of a single layer
        arrays[1] = ((1), origin, size, stride);
        //----------- to get the distance of the i-layer data block
        origin = new int[]{0};
        size = new int[]{dataBlockNum};
        stride = new int[]{1};
        arrays[2] = ((2), origin, size, stride);
        //------------ Get elevation data for layer i
        origin = new int[]{i, 0};
        size = new int[]{1, azimuthNum};
        stride = new int[]{1, 1};
        arrays[3] = ((3), origin, size, stride);
        //------------ Get the required data end--------------
//Converting azimuth and elevation angles from angles to radians
        Array azi = (arrays[1]);
        Array ele = (arrays[3]);
        //Create a two-dimensional matrix using distances and azimuths (radians), this step is more important in order to apply the
        Array[] a = (arrays[2], azi);
        Array dis = a[0];
        azi = a[1];
        List<Integer> list = new ArrayList<Integer>();
        (()[1]).
        Reorganize the object format
        ele= (new int[]{azimuthNum, 1});
        //Stuff the data in.
        ele = (ele, list, 1);
        int h = (().toString().trim());
        //Antenna coordinates converted to Cartesian coordinates
        Array[] aa = (dis, azi, ele, h);
        String projection = ("+proj=aeqd  +lon_0=%s  +lat_0=%s",
                (().toString().trim()),
                (().toString().trim()));
        //Determine the projection to facilitate the subsequent addition of maps or geographic information.
        ProjectionInfo projectionInfo = factory(new CRSFactory().createFromParameters("custom",
                projection));
        //coordinate reprojection
        Array[] xy = (aa[0], aa[1], projectionInfo, LONG_LAT);
        //Drawing Layers
        VectorLayer layer = (xy[0], xy[1], arrays[0], ls);
        return layer;
    }

 

This method is the most complex and slow, but at the same time is not lose any data method, the next section we change the use of interpolation method of drawing, the use of interpolation, the performance and speed has been greatly improved!