Handle missing wind data; ensure samples by height are included
This commit is contained in:
		
							parent
							
								
									1046b1c22d
								
							
						
					
					
						commit
						b8903a69f8
					
				
					 1 changed files with 15 additions and 2 deletions
				
			
		| 
						 | 
					@ -92,8 +92,15 @@ class BUFRSounding(Sounding):
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    sample = sounding.sample_by_pressure(pressure)
 | 
					                    sample = sounding.sample_by_pressure(pressure)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                sample.wind_speed = item.getNumber('wsMan')
 | 
					                    if height != -9999.0:
 | 
				
			||||||
                sample.wind_dir   = item.getNumber('wdMan')
 | 
					                        sample.height = height
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                wind_dir   = item.getNumber('wsMan')
 | 
				
			||||||
 | 
					                wind_speed = item.getNumber('wdMan')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if wind_dir != -9999.0 and wind_speed != -9999.0:
 | 
				
			||||||
 | 
					                    sample.wind_speed = wind_dir
 | 
				
			||||||
 | 
					                    sample.wind_dir   = wind_speed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if set(params) & BUFRSounding.BUFR_PARAMS_SIGT:
 | 
					            if set(params) & BUFRSounding.BUFR_PARAMS_SIGT:
 | 
				
			||||||
                pressure = item.getNumber('prSigT') / 100.0
 | 
					                pressure = item.getNumber('prSigT') / 100.0
 | 
				
			||||||
| 
						 | 
					@ -111,10 +118,16 @@ class BUFRSounding(Sounding):
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    sample = sounding.sample_by_pressure(pressure)
 | 
					                    sample = sounding.sample_by_pressure(pressure)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if height != -9999.0:
 | 
				
			||||||
 | 
					                        sample.height = height
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                sample.wind_speed = item.getNumber('wsSigW')
 | 
					                sample.wind_speed = item.getNumber('wsSigW')
 | 
				
			||||||
                sample.wind_dir   = item.getNumber('wdSigW')
 | 
					                sample.wind_dir   = item.getNumber('wdSigW')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for pressure in sorted(sounding.samples_by_pressure.keys(), reverse=True):
 | 
					        for pressure in sorted(sounding.samples_by_pressure.keys(), reverse=True):
 | 
				
			||||||
            sounding.samples.append(sounding.samples_by_pressure[pressure])
 | 
					            sounding.samples.append(sounding.samples_by_pressure[pressure])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        for height in sorted(sounding.samples_by_height.keys()):
 | 
				
			||||||
 | 
					            sounding.samples.append(sounding.samples_by_height[height])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return sounding
 | 
					        return sounding
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue