Weather Radar Data

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);
	}
  • Facebook
  • Reddit
  • StumbleUpon
  • Twitter
  • Google Buzz
  • LinkedIn