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);
	}

2 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?

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.