NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

Changeset 190

Show
Ignore:
Timestamp:
09/05/08 17:55:49
Author:
cbc
Message:

Finished version of proc_remtech_rawdata_pa0.py

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sodar/branches/raw2proc-dev/proc_remtech_rawdata_pa0.py

    r189 r190  
    1313import math 
    1414import numpy as n 
    15 from datetime import timedelta 
    16 from procutil import scanf_datetime, dt2es 
     15import pycdf 
     16import datetime 
     17import procutil 
    1718 
    1819INVALID       = '-9999' 
    19 BLOCKNUMBER   = 'BL#' 
    20 MONTH         = 'MONTH' 
    21 DAY           = 'DAY' 
    22 YEAR          = 'YEAR' 
    23 HOUR          = 'HOUR' 
    24 MINUTE        = 'MIN' 
    25 VALIDATIONS1  = 'VAL1' 
    26 VALIDATIONS2  = 'VAL2' 
    27 VALIDATIONS3  = 'VAL3' 
    28 VALIDATIONS4  = 'VAL4' 
    29 PROBABILITY1  = 'SPU1' 
    30 PROBABILITY2  = 'SPU2' 
    31 PROBABILITY3  = 'SPU3' 
    32 PROBABILITY4  = 'SPU4' 
    33 AMBIENTNOISE1 = 'NOIS1' 
    34 AMBIENTNOISE2 = 'NOIS2' 
    35 AMBIENTNOISE3 = 'NOIS3' 
    36 AMBIENTNOISE4 = 'NOIS4' 
    37 CLUTTER       = 'FEMAX' 
    38 SOFTWARE      = 'SOFTW' 
    39 FREQUENCIES11 = 'FE11' 
    40 FREQUENCIES12 = 'FE12' 
    41 FREQUENCIES21 = 'FE21' 
    42 FREQUENCIES22 = 'FE22' 
    43 SIGNALNOISE1  = 'SNR1' 
    44 SIGNALNOISE2  = 'SNR2' 
    45 SIGNALNOISE3  = 'SNR3' 
    46 SIGNALNOISE4  = 'SNR4' 
    47 REFERENCE     = 'CHECK' 
    48 JAM           = 'JAM' 
    49 ALTITUDE      = 'ALT' 
    50 ECHO          = 'CT' 
    51 RADIAL        = 'SPEED' 
    52 THETA         = 'DIR' 
    53 VERTICAL      = 'W' 
     20 
     21nowDt = datetime.datetime.utcnow().replace(microseconds=0) 
    5422 
    5523def parser(platform_info, sensor_info, lines): 
     
    11381        sampleIndex = rawDataObject.index(sample) 
    11482         
    115         data['block'][sampleIndex] = int(sample[BLOCKNUM]) 
     83        data['block'][sampleIndex] = int(sample['BL#']) 
    11684                                
    117         dt = {'month' : int(sample[MONTH]), 
    118               'day'   : int(sample[DAY]), 
    119               'year'  : int(sample[YEAR]), 
    120               'hour'  : int(sample[HOUR]), 
    121               'min'   : int(sample[MINUTE]), 
     85        dt = {'month' : int(sample['MONTH']), 
     86              'day'   : int(sample['DAY']), 
     87              'year'  : int(sample['YEAR']), 
     88              'hour'  : int(sample['HOUR']), 
     89              'min'   : int(sample['MIN']), 
    12290            } 
    12391        dt = '%(month)02d-%(day)02d-%(year)04d %(hour)02d:%02d(min)' % dt 
    124         dt = scanf_datetime(dt, fmt='%m-%d-%Y %H:%M') 
     92        dt = procutil.scanf_datetime(dt, fmt='%m-%d-%Y %H:%M') 
    12593        if sensor_info['utc_offset']: 
    126             dt = dt + timedelta(hours=sensor_info['utc_offset']) 
     94            dt = dt + datetime.timedelta(hours=sensor_info['utc_offset']) 
    12795        data['dt'][sampleIndex] = dt 
    12896         
    129         data['es'][sampleIndex] = dt2es(dt) 
    130          
    131         data['val1'][sampleIndex] = int(sample[VALIDATIONS1]) 
    132         data['val2'][sampleIndex] = int(sample[VALIDATIONS2]) 
    133         data['val3'][sampleIndex] = int(sample[VALIDATIONS3]) 
    134         data['val4'][sampleIndex] = int(sample[VALIDATIONS4]) 
    135          
    136         data['spu1'][sampleIndex] = int(sample[PROBABILITY1]) 
    137         data['spu2'][sampleIndex] = int(sample[PROBABILITY2]) 
    138         data['spu3'][sampleIndex] = int(sample[PROBABILITY]) 
    139         data['spu4'][sampleIndex] = int(sample[PROBABILITY4]) 
    140          
    141         data['nois1'][sampleIndex] = int(sample[AMBIENTNOISE1]) 
    142         data['nois2'][sampleIndex] = int(sample[AMBIENTNOISE2]) 
    143         data['nois3'][sampleIndex] = int(sample[AMBIENTNOISE3]) 
    144         data['nois4'][sampleIndex] = int(sample[AMBIENTNOISE4]) 
    145  
    146         data['femax'][sampleIndex] = int(sample[CLUTTER]) 
    147         data['softw'][sampleIndex] = int(sample[SOFTWARE]) 
    148          
    149         data['fe11'][sampleIndex] = int(sample[FREQUENCIES11]) 
    150         data['fe12'][sampleIndex] = int(sample[FREQUENCIES12]) 
    151         data['fe21'][sampleIndex] = int(sample[FREQUENCIES21]) 
    152         data['fe22'][sampleIndex] = int(sample[FREQUENCIES22]) 
    153          
    154         data['snr1'][sampleIndex] = int(sample[SIGNALNOISE1]) 
    155         data['snr2'][sampleIndex] = int(sample[SIGNALNOISE2]) 
    156         data['snr3'][sampleIndex] = int(sample[SIGNALNOISE3]) 
    157         data['snr4'][sampleIndex] = int(sample[SIGNALNOISE4]) 
    158  
    159         data['check'][sampleIndex] = int(sample[REFERENCE]) 
    160         data['jam'][sampleIndex]   = int(sample[JAM]) 
     97        data['time'][sampleIndex] = procutil.dt2es(dt) 
     98         
     99        data['val1'][sampleIndex] = int(sample['VAL1']) 
     100        data['val2'][sampleIndex] = int(sample['VAL2']) 
     101        data['val3'][sampleIndex] = int(sample['VAL3']) 
     102        data['val4'][sampleIndex] = int(sample['VAL4']) 
     103         
     104        data['spu1'][sampleIndex] = int(sample['SPU1']) 
     105        data['spu2'][sampleIndex] = int(sample['SPU2']) 
     106        data['spu3'][sampleIndex] = int(sample['SPU3']) 
     107        data['spu4'][sampleIndex] = int(sample['SPU4']) 
     108         
     109        data['nois1'][sampleIndex] = int(sample['NOIS1']) 
     110        data['nois2'][sampleIndex] = int(sample['NOIS2']) 
     111        data['nois3'][sampleIndex] = int(sample['NOIS3']) 
     112        data['nois4'][sampleIndex] = int(sample['NOIS4']) 
     113         
     114        data['femax'][sampleIndex] = int(sample['FEMAX']) 
     115        data['softw'][sampleIndex] = int(sample['SOFTW']) 
     116         
     117        data['fe11'][sampleIndex] = int(sample['FE11']) 
     118        data['fe12'][sampleIndex] = int(sample['FE12']) 
     119        data['fe21'][sampleIndex] = int(sample['FE21']) 
     120        data['fe22'][sampleIndex] = int(sample['FE22']) 
     121         
     122        data['snr1'][sampleIndex] = int(sample['SNR1']) 
     123        data['snr2'][sampleIndex] = int(sample['SNR2']) 
     124        data['snr3'][sampleIndex] = int(sample['SNR3']) 
     125        data['snr4'][sampleIndex] = int(sample['SNR4']) 
     126         
     127        data['check'][sampleIndex] = int(sample['CHECK']) 
     128        data['jam'][sampleIndex]   = int(sample['JAM']) 
    161129         
    162130        for altitude,alttitudeIndex in zip(altitudes, range(len(altitudes))): 
    163             echo   = sample[altitude][ECHO
    164             radial = sample[altitude][RADIAL
    165             theta  = sample[altitude][THETA
    166             vertical = sample[altitude][VERTICAL
     131            echo   = sample[altitude]['CT'
     132            radial = sample[altitude]['SPEED'
     133            theta  = sample[altitude]['DIR'
     134            vertical = sample[altitude]['W'
    167135             
    168136            if radial != INVALID and theta != INVALID: 
     
    191159        'metadata_url' : 'http://nccoos.unc.edu', 
    192160        'references' : 'http://nccoos.unc.edu', 
    193         'contact' : 'Sara Haines (haines@email.unc.edu)', 
     161        'contact' : 'cbc (cbc@unc.edu)', 
    194162        #  
    195163        'source' : 'fixed-profiler (acoustic doppler) observation', 
    196         'history' : 'Data processed by NCCOOS'
    197         'comment' : 'File created using pycdf'+pycdfVersion()+' and numpy '+pycdfArrayPkg(), 
     164        'history' : 'raw2proc using ' + sensor_info['process_module']
     165        'comment' : 'File created using pycdf'+pycdf.pycdfVersion()+' and numpy '+pycdf.pycdfArrayPkg(), 
    198166        # conventions 
    199167        'Conventions' : 'CF-1.0; SEACOOS-CDL-v2.0', 
    200168        # SEACOOS CDL codes 
    201169        'format_category_code' : 'fixed-profiler', 
    202         'institution_code' : platform_info['instituion'], 
     170        'institution_code' : platform_info['institution'], 
    203171        'platform_code' : platform_info['id'], 
    204172        'package_code' : sensor_info['id'], 
     
    207175        'project_url' : 'http://nccoos.unc.edu', 
    208176        # timeframe of data contained in file yyyy-mm-dd HH:MM:SS 
    209         'start_date' : data['sample_dt'].strftime("%Y-%m-%d %H:%M:%S"), 
    210         'end_date' : data['sample_dt'].strftime("%Y-%m-%d %H:%M:%S"),  
    211         'release_date' : now.strftime("%Y-%m-%d %H:%M:%S"), 
     177        # first date in monthly file 
     178        'start_date' : data['dt'][0].strftime("%Y-%m-%d %H:%M:%S"), 
     179        # last date in monthly file 
     180        'end_date' : data['dt'][-1].strftime("%Y-%m-%d %H:%M:%S"),  
     181        'release_date' : nowDt.strftime("%Y-%m-%d %H:%M:%S"), 
    212182        # 
    213         'creation_date' : now.strftime("%Y-%m-%d %H:%M:%S"), 
    214         'modification_date' : now.strftime("%Y-%m-%d %H:%M:%S"), 
     183        'creation_date' : nowDt.strftime("%Y-%m-%d %H:%M:%S"), 
     184        'modification_date' : nowDt.strftime("%Y-%m-%d %H:%M:%S"), 
    215185        'process_level' : 'level1', 
    216186        # 
     
    247217               'standard_name': 'height', 
    248218               'reference':'zero at sea-surface', 
     219               'positive' : 'up', 
    249220               'units': 'm', 
    250221               'axis': 'Z', 
    251222               }, 
    252223        # data variables 
    253         'u': {'long_name': 'East/West Component of Current', 
    254               'standard_name': 'eastward_current', 
    255               'units': 'm s-1', 
    256               'reference': 'clockwise from True East', 
    257               }, 
    258         'v': {'long_name': 'North/South Component of Current', 
    259               'standard_name': 'northward_current',                           
    260               'units': 'm s-1', 
    261               'reference': 'clockwise from True North', 
    262               }, 
    263         'w': {'long_name': 'Upward/Downward Component of Current', 
    264               'standard_name': 'upward_current',                           
    265               'units': 'm s-1', 
    266               'positive': 'up', 
    267               }, 
    268         'back_scatter':{'long_name': 'Backscatter', 
    269                         'standard_name': 'back_scatter',                     
    270                         'units': 'decibels', 
     224        'u': {'short_name' : 'u', 
     225              'long_name': 'East/West Component of Wind', 
     226              'standard_name': 'eastward_wind', 
     227              'units': 'cm s-1', 
     228              }, 
     229        'v': {'short_name' : 'v', 
     230              'long_name': 'North/South Component of Wind', 
     231              'standard_name': 'northward_wind',                           
     232              'units': 'cm s-1', 
     233              }, 
     234        'w': {'short_name' : 'w', 
     235              'long_name': 'Vertical Component of Wind', 
     236              'standard_name': 'upward_wind',                           
     237              'units': 'cm s-1', 
     238              }, 
     239        'echo': {'short_name' : 'echo', 
     240                 'long_name': 'Echo Stength', 
     241                 'standard_name': 'echo_strenth', 
     242                 }, 
     243        'block' : {'short_name': 'block', 
     244                   'long_name': 'Block Number', 
     245                   'standard_name': 'block_number' 
     246                   }, 
     247        'val1': {'short_name' : 'val1', 
     248                 'long_name': 'Number of Beam Validations 1', 
     249                 'standard_name': 'validations_1', 
     250                 }, 
     251        'val2': {'short_name' : 'val2', 
     252                 'long_name': 'Number of Beam Validations 2', 
     253                 'standard_name': 'validations_2', 
     254                 }, 
     255        'val3': {'short_name' : 'val3', 
     256                 'long_name': 'Number of Beam Validations 3', 
     257                 'standard_name': 'validations_3', 
     258                 }, 
     259        'val4': {'short_name' : 'val4', 
     260                 'long_name': 'Number of Beam Validations 4', 
     261                 'standard_name': 'validations_4', 
     262                 }, 
     263        'spu1': {'short_name' : 'spu1', 
     264                 'long_name': 'Normalized Probability of False Signal 1', 
     265                 'standard_name': 'probability_1', 
     266                 }, 
     267        'spu2': {'short_name' : 'spu2', 
     268                 'long_name': 'Normalized Probability of False Signal 1', 
     269                 'standard_name': 'probability_2', 
     270                 }, 
     271        'spu3': {'short_name' : 'spu3', 
     272                 'long_name': 'Normalized Probability of False Signal 3', 
     273                 'standard_name': 'probability_3', 
     274                 }, 
     275        'spu4': {'short_name' : 'spu4', 
     276                 'long_name': 'Normalized Probability of False Signal 4', 
     277                 'standard_name': 'probability_4', 
     278                 }, 
     279        'nois1': {'short_name' : 'nois1', 
     280                  'long_name': 'Environmental Noise 1', 
     281                  'standard_name': 'ambient_1', 
     282                  'units': 'dB', 
     283              }, 
     284        'nois2': {'short_name' : 'nois2', 
     285                  'long_name': 'Environmental Noise 2', 
     286                  'standard_name': 'ambient_2', 
     287                  'units': 'dB', 
     288              }, 
     289        'nois3': {'short_name' : 'nois3', 
     290                  'long_name': 'Environmental Noise 3', 
     291                  'standard_name': 'ambient_3', 
     292                  'units': 'dB', 
     293              }, 
     294        'nois4': {'short_name' : 'nois4', 
     295                  'long_name': 'Environmental Noise 4', 
     296                  'standard_name': 'ambient_4', 
     297                  'units': 'dB', 
     298              }, 
     299        'femax': {'short_name': 'femax', 
     300                  'long_name': 'Maximum Ground Clutter', 
     301                  'standard_name': 'max_clutter', 
     302                  }, 
     303        'softw': {'short_name': 'softw', 
     304                        'long_name': 'Software Version', 
     305                        'standard_name': 'software', 
    271306                        }, 
    272         'wtemp': {'long_name': 'Water Temperature', 
    273                   'standard_name': 'water_temperature', 
    274                   'units': 'degrees Celsius', 
    275                   }, 
     307        'fe11': {'short_name': 'fe11', 
     308                 'long_name': 'Number of Frequencies Emitted 11', 
     309                 'standard_name': 'frequencies_11', 
     310                 }, 
     311        'fe12': {'short_name': 'fe12', 
     312                 'long_name': 'Number of Frequencies Emitted 12', 
     313                 'standard_name': 'frequencies_12', 
     314                 }, 
     315        'fe21': {'short_name': 'fe21', 
     316                 'long_name': 'Number of Frequencies Emitted 21', 
     317                 'standard_name': 'frequencies_21', 
     318                 }, 
     319        'fe22': {'short_name': 'fe22', 
     320                 'long_name': 'Number of Frequencies Emitted 22', 
     321                 'standard_name': 'frequencies_22', 
     322                 }, 
     323        'snr1': {'short_name' : 'snr1', 
     324                 'long_name': 'Average Signal To Noise Ratio 1', 
     325                 'standard_name': 'signal_to_noise_1', 
     326                 'units': 'dB', 
     327                 }, 
     328        'snr1': {'short_name' : 'snr2', 
     329                 'long_name': 'Average Signal To Noise Ratio 2', 
     330                 'standard_name': 'signal_to_noise_2', 
     331                 'units': 'dB', 
     332                 }, 
     333        'snr1': {'short_name' : 'snr3', 
     334                 'long_name': 'Average Signal To Noise Ratio 3', 
     335                 'standard_name': 'signal_to_noise_3', 
     336                 'units': 'dB', 
     337                 }, 
     338        'snr4': {'short_name' : 'snr4', 
     339                 'long_name': 'Average Signal To Noise Ratio 4', 
     340                 'standard_name': 'signal_to_noise_4', 
     341                 'units': 'dB', 
     342                 }, 
    276343        } 
    277344 
    278  
    279     # integer values  
    280     ntime=NC.UNLIMITED 
    281     nlat=1 
    282     nlon=1 
    283     nz=sensor_info['nbins'] 
    284      
    285345    # dimension names use tuple so order of initialization is maintained 
    286     dimensions = ('ntime', 'nlat', 'nlon', 'nz') 
     346    dim_inits = ( 
     347        ('ntime', pycdf.NC.UNLIMITED), 
     348        ('nlat', 1), 
     349        ('nlon', 1), 
     350        ('nz', sensor_info['num_altitudes']) 
     351        ) 
    287352     
    288353    # using tuple of tuples so order of initialization is maintained 
     
    292357    var_inits = ( 
    293358        # coordinate variables 
    294         ('time', NC.INT, ('ntime',)), 
    295         ('lat', NC.FLOAT, ('nlat',)), 
    296         ('lon', NC.FLOAT, ('nlon',)), 
    297         ('z',  NC.FLOAT, ('nz',)), 
     359        ('time', pycdf.NC.INT,  ('ntime',)), 
     360        ('lat',   pycdf.NC.FLOAT, ('nlat',)), 
     361        ('lon',   pycdf.NC.FLOAT, ('nlon',)), 
     362        ('z',     pycdf.NC.FLOAT, ('nz',)), 
    298363        # data variables 
    299         ('u', NC.FLOAT, ('ntime', 'nz')), 
    300         ('v', NC.FLOAT, ('ntime', 'nz')), 
    301         ('w', NC.FLOAT, ('ntime', 'nz')), 
    302         ('back_scatter', NC.FLOAT, ('ntime', 'nz')), 
    303         ('wtemp', NC.FLOAT, ('ntime',)), 
     364        ('u',     pycdf.NC.FLOAT, ('ntime', 'nz')), 
     365        ('v',     pycdf.NC.FLOAT, ('ntime', 'nz')), 
     366        ('w',     pycdf.NC.FLOAT, ('ntime', 'nz')), 
     367        ('echo',  pycdf.NC.FLOAT, ('ntime', 'nz')), 
     368        ('block', pycdf.NC.INT,   ('ntime',)), 
     369        ('val1',  pycdf.NC.INT,   ('ntime',)), 
     370        ('val2',  pycdf.NC.INT,   ('ntime',)), 
     371        ('val3',  pycdf.NC.INT,   ('ntime',)), 
     372        ('val4',  pycdf.NC.INT,   ('ntime',)), 
     373        ('spu1',  pycdf.NC.INT,   ('ntime',)), 
     374        ('spu2',  pycdf.NC.INT,   ('ntime',)), 
     375        ('spu3',  pycdf.NC.INT,   ('ntime',)), 
     376        ('spu4',  pycdf.NC.INT,   ('ntime',)), 
     377        ('nois1', pycdf.NC.INT,   ('ntime',)), 
     378        ('nois2', pycdf.NC.INT,   ('ntime',)), 
     379        ('nois3', pycdf.NC.INT,   ('ntime',)), 
     380        ('nois4', pycdf.NC.INT,   ('ntime',)), 
     381        ('femax', pycdf.NC.INT,   ('ntime',)), 
     382        ('softw', pycdf.NC.INT,   ('ntime',)), 
     383        ('fe11',  pycdf.NC.INT,   ('ntime',)), 
     384        ('fe12',  pycdf.NC.INT,   ('ntime',)), 
     385        ('fe21',  pycdf.NC.INT,   ('ntime',)), 
     386        ('fe22',  pycdf.NC.INT,   ('ntime',)), 
     387        ('snr1',  pycdf.NC.INT,   ('ntime',)), 
     388        ('snr2',  pycdf.NC.INT,   ('ntime',)), 
     389        ('snr3',  pycdf.NC.INT,   ('ntime',)), 
     390        ('snr4',  pycdf.NC.INT,   ('ntime',)), 
    304391        ) 
     392 
     393    # subset data only to month being processed (see raw2proc.process()) 
     394    i = data['in'] 
    305395     
    306396    # var data  
    307397    var_data = ( 
    308         ('lat',  platform_info['lat']), 
    309         ('lon', platform_info['lon']), 
    310         ('z', []), 
    311         ('u', []), 
    312         ('v', []), 
    313         ('w', []), 
    314         ('back_scatter', []), 
    315         ('wtemp', []), 
     398        ('time',  data['time'][i]), 
     399        ('lat',   platform_info['lat']), 
     400        ('lon',   platform_info['lon']), 
     401        ('z',     data['z']), 
     402        ('u',     data['u'][i]), 
     403        ('v',     data['v'][i]), 
     404        ('w',     data['w'][i]), 
     405        ('echo',  data['echo'][i]), 
     406        ('block', data['block'][i]), 
     407        ('val1',  data['val1'][i]), 
     408        ('val2',  data['val1'][i]), 
     409        ('val3',  data['val1'][i]), 
     410        ('val4',  data['val1'][i]), 
     411        ('spu1',  data['spu1'][i]), 
     412        ('spu2',  data['spu2'][i]), 
     413        ('spu3',  data['spu3'][i]), 
     414        ('spu4',  data['spu4'][i]), 
     415        ('nois1', data['nois1'][i]), 
     416        ('nois2', data['nois2'][i]), 
     417        ('nois3', data['nois3'][i]), 
     418        ('nois4', data['nois4'][i]), 
     419        ('femax', data['femax'][i]), 
     420        ('softw', data['softw'][i]), 
     421        ('fe11',  data['fe11'][i]), 
     422        ('fe12',  data['fe12'][i]), 
     423        ('fe21',  data['fe21'][i]), 
     424        ('fe22',  data['fe22'][i]), 
     425        ('snr1',  data['snr1'][i]), 
     426        ('snr2',  data['snr2'][i]), 
     427        ('snr3',  data['snr3'][i]), 
     428        ('snr4',  data['snr4'][i]), 
    316429        ) 
    317430 
    318     return (global_atts, dimensions, var_inits, var_data) 
     431    return (global_atts, var_atts, dim_inits, var_inits, var_data) 
    319432 
    320433def updater(platform_info, sensor_info, data): 
    321434    # 
    322435    global_atts = {  
    323         # timeframe of data contained in file yyyy-mm-dd HH:MM:SS 
    324         'end_date' : data['sample_dt'].strftime("%Y-%m-%d %H:%M:%S"),  
    325         'release_date' : now.strftime("%Y-%m-%d %H:%M:%S"), 
     436        # update times of data contained in file (yyyy-mm-dd HH:MM:SS) 
     437        # last date in monthly file 
     438        'end_date' : data['dt'][-1].strftime("%Y-%m-%d %H:%M:%S"),  
     439        'release_date' : nowDt.strftime("%Y-%m-%d %H:%M:%S"), 
    326440        # 
    327         'creation_date' : now.strftime("%Y-%m-%d %H:%M:%S"), 
    328         'modification_date' : now.strftime("%Y-%m-%d %H:%M:%S"), 
     441        'modification_date' : nowDt.strftime("%Y-%m-%d %H:%M:%S"), 
    329442        } 
    330     # var data  
     443 
     444    # data variables 
     445    # update any variable attributes like range, min, max 
     446    var_atts = {} 
     447     
     448    # subset data only to month being processed (see raw2proc.process()) 
     449    i = data['in'] 
     450 
     451    # data  
    331452    var_data = ( 
    332         ('u', data['u']), 
    333         ('v', data['v']), 
    334         ('w',  data['w']), 
    335         ('back_scatter', data['back_scatter']), 
    336         ('wtemp', data['wtemp']), 
     453        ('time',  data['time'][i]), 
     454        ('u',     data['u'][i]), 
     455        ('v',     data['v'][i]), 
     456        ('w',     data['w'][i]), 
     457        ('echo',  data['echo'][i]), 
     458        ('block', data['block'][i]), 
     459        ('val1',  data['val1'][i]), 
     460        ('val2',  data['val1'][i]), 
     461        ('val3',  data['val1'][i]), 
     462        ('val4',  data['val1'][i]), 
     463        ('spu1',  data['spu1'][i]), 
     464        ('spu2',  data['spu2'][i]), 
     465        ('spu3',  data['spu3'][i]), 
     466        ('spu4',  data['spu4'][i]), 
     467        ('nois1', data['nois1'][i]), 
     468        ('nois2', data['nois2'][i]), 
     469        ('nois3', data['nois3'][i]), 
     470        ('nois4', data['nois4'][i]), 
     471        ('femax', data['femax'][i]), 
     472        ('softw', data['softw'][i]), 
     473        ('fe11',  data['fe11'][i]), 
     474        ('fe12',  data['fe12'][i]), 
     475        ('fe21',  data['fe21'][i]), 
     476        ('fe22',  data['fe22'][i]), 
     477        ('snr1',  data['snr1'][i]), 
     478        ('snr2',  data['snr2'][i]), 
     479        ('snr3',  data['snr3'][i]), 
     480        ('snr4',  data['snr4'][i]), 
    337481        ) 
    338     return (global_atts, var_data) 
    339 
    340  
     482 
     483    return (global_atts, var_atts, var_data)