But, when there is no wind, there is no "average direction." You could calculate the average compass direction, but that would be meaningless. For example, if you just dumbly average compass directions 10° and 350° you get 180°, but what you probably want is zero.
Another option would be, if the wind speed is zero, take the "last" value of wind direction during the archive period. The extractor for that would look something like (NOT TESTED): def extract_wind(self, record, obs_type): """Extract wind values from myself, and put in a record.""" # Wind records must be flattened into the separate categories: record['windSpeed'] = self[obs_type].avg record['windDir'] = self[obs_type].vec_dir if self[obs_type].sum else self[obs_type].last[1] record['windGust'] = self[obs_type].max record['windGustDir'] = self[obs_type].max_dir Tell us what you want mathematically, and maybe we can find an appropriate extractor. -tk On Sun, Oct 1, 2017 at 11:50 AM, jahfly1000 <jah...@msn.com> wrote: > thank you to tom for having resolved this defect but now my problem is > that the computation of the wind direction is done by vector wind and so if > I have no wind my direction is 90 ° (East). > I prefer that the calculation is done rather on the average direction of > wind received by LOOP > > if i change: > > def extract_wind (self, record, obs_type): > "" "Extract wind from a record." "" > # Wind records must be flattened into the separate categories: > record ['windSpeed'] = self [obs_type] .avg > record ['windDir'] = self [obs_type] .vec_dir > record ['windGust'] = self [obs_type] .max > record ['windGustDir'] = self [obs_type] .max_dir > by > > > def extract_wind (self, record, obs_type): > "" "Extract wind from a record." "" > # Wind records must be flattened into the separate categories: > record ['windSpeed'] = self [obs_type] .avg > record ['windDir'] = self.dirsumtime > record ['windGust'] = self [obs_type] .max > record ['windGustDir'] = self [obs_type] .max_dir > > it's good? > > thank you in advance and your patience > > -- > You received this message because you are subscribed to the Google Groups > "weewx-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to weewx-user+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.