Add convenience generators to loop over soundings
This commit is contained in:
		
							parent
							
								
									4b5b69ca21
								
							
						
					
					
						commit
						d51c61dd5e
					
				
					 1 changed files with 14 additions and 0 deletions
				
			
		|  | @ -216,6 +216,16 @@ class RawinsChunk(): | |||
|         if obs is not None: | ||||
|             yield obs | ||||
| 
 | ||||
|     def each_sounding(self): | ||||
|         for obs in self.each_obs(): | ||||
|             if obs.kind == 'TTAA': | ||||
|                 sounding = obs.parse_ttaa() | ||||
| 
 | ||||
|                 if sounding is None or len(sounding.samples) == 0: | ||||
|                     continue | ||||
| 
 | ||||
|                 yield sounding | ||||
| 
 | ||||
| class RawinsReader(): | ||||
|     """ | ||||
|     A reader for the global `Current.rawins` file provided by UCAR: | ||||
|  | @ -297,3 +307,7 @@ class RawinsReader(): | |||
|     def each_obs(self): | ||||
|         for chunk in self.each_chunk(): | ||||
|             yield from chunk.each_obs() | ||||
| 
 | ||||
|     def each_sounding(self): | ||||
|         for chunk in self.each_chunk(): | ||||
|             yield from chunk.each_sounding() | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue