To get the weather-radar data from x-plane, turn on the CONTROL PAD output in the net output screen, and expect this data to be sent by UDP:

 

if(puff15)
	{
		static xint lon_deg=-1;
		static xint lat_deg=-1;
		static xint lat_min=-1;

		if(++lat_min>=61)
		{
			lat_min=-1;
			if(++lon_deg>2)
			{
				lon_deg=-2;
				if(++lat_deg>1)
				{
					lat_deg=-1;
				}
			}
		}
		
		struct wxr_line_struct	// we send a scanline of 61 vertices of weather, spaced 1 minute x 1 minute of lon/lat! cool!
		{						// 61 to get both edges of the degree, since this is vertex-centered not cell-centered
			xint lon_deg_wes;	// vertex-centered not cell-centered is needed to plot radar without it looking blocky
			xint lat_deg_sou;
			xint lat_min_sou;
			xbyt storm_07[61];
		};
		wxr_line_struct wxr_line;

		wxr_line.lon_deg_wes=flt[p0].dat_lon+lon_deg;
		wxr_line.lat_deg_sou=flt[p0].dat_lat+lat_deg;
		wxr_line.lat_min_sou=				 lat_min;

		for(xint lon_min=0;lon_min<61;lon_min++) { xflt cloud_rat=0.0; xflt storm_rat=0.0; wxr_region_threaded_access->get_num_puffs(ct_radar_precip							,"X-IOS-gen",
															(xflt)wxr_line.lon_deg_wes+(xflt)lon_min/60.0	,
															(xflt)wxr_line.lat_deg_sou+(xflt)lat_min/60.0	,
															0.0												,0,NULL,&cloud_rat,&storm_rat);

			wxr_line.storm_07[lon_min]=intlim(storm_rat*9,0,9);	// we have 9 clear plus levels of precip in X-IOS
		}

		inet.inet_send("xRAD",(xchr*)&wxr_line,sizeof(wxr_line),en);
	}

9 comments on “Weather Radar Data

  1. Would it be possible to explain the meaning of “vertex-centered” and “cell-centered” in the following code comment?

    // we send a scanline of 61 vertices of weather, spaced 1 minute x 1 minute of lon/lat! cool!
    // 61 to get both edges of the degree, since this is vertex-centered not cell-centered
    // vertex-centered not cell-centered is needed to plot radar without it looking blocky

    I’m trying to extract weather data and show it on an external weather display. What would be the practical implications of this comment? Does it mean we have an offset of half a minute in lat/lon?

  2. Would it be possible to explain the following comment in the code?

    // we send a scanline of 61 vertices of weather, spaced 1 minute x 1 minute of lon/lat! cool!
    // 61 to get both edges of the degree, since this is vertex-centered not cell-centered
    // vertex-centered not cell-centered is needed to plot radar without it looking blocky

    I’m trying to extract weather data and show it on an external display. What’s the meaning of “vertex-centered” and “cell-centered”?
    Does it mean we have an offset of half a minute for each transmitted value?

    1. It’s quite a late answer, but here is my interpretation.

      Imagine a lattice grid covering the space to plot the weather data . The eyes of the lattice are called cells and the nodes are vertices. Since x-plane divides the weather scan space into 60 cells, the total number of vertices is 61. The weather data can be stored either at the vertices or at the cell centres. X-plane chose to store the data at the vertices to avoid a blocky weather radar graphics.

  3. Hello,
    I am confused by provided snipped of X-Plane code as it unfortunately disagree with what is written in X-plane included “documentation” Exchanging Data with X-Plane.rtfd.

    This snippet above producer xRAD message while by docs you shall get RADR message both in different radar data format.

    So there is either discrepancy in documentation, or there are two different methods to get radar data, in which case it would be nice to get some comparison/explanation.

  4. Hi,
    How can I get the positions of lighting strikes in order do develop a custom stormscope. Is there a way I can do that?

  5. I have implemented this in my B737 external glass cockpit and it works fine.
    However, I now realize that I can only send the WXR data to a single IP (which currently is the rasperry driving my captain NAV display).

    Would it be possible to add the possibility to send the WXR data to multiple IP’s? I could then send it also to the first officer NAV display (on another rasperry pi)?

    Or even simpler: would it be possible to access the 61×61 WXR returns from a char array dataref (having 3721 elements) plus the lon/lat location of the upper left corner?

    Reto

  6. I am searching for which weather radar is being used in xplane and how to use that to show bad weather condition on EFIS display. If there is any document and complete information can you please share to us.

  7. I am developing a new version of Concorde Performance System which will include Colimata Concorde addon.
    I need to get weather at departure (METAR), destination (METAR) and enroute until 59000 ft.
    Would you tell me how to do that please?
    I’m using Delphi for information.
    Regards
    Pierre

Leave a Reply

Your email address will not be published. Required fields are marked *

Please do not report bugs in the blog comments.
Only bugs reported via the X-Plane Bug Reporter are tracked.

Meta

Topic:

  • Weather

Article type:

  • Guide