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

Changeset 167

Show
Ignore:
Timestamp:
05/13/08 14:10:05
Author:
haines
Message:

read and process directional wave data from 2-d spectra

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • raw2proc/trunk/raw2proc/bogue_config_20060918.py

    r147 r167  
    2727    'adcpwaves' : {'id' : 'adcpwaves', 
    2828                   'description' : 'Directional wave data', 
    29                    'raw_dir' : '/seacoos/data/nccoos/level0/bogue/adcp_bLogData', 
    30                    'raw_file_glob' : '*', 
     29                   'raw_dir' : '/seacoos/data/nccoos/level0/bogue/adcp_cSpecData', 
     30                   'raw_file_glob' : 'DSpec*', 
    3131                   'proc_dir' : '/seacoos/data/nccoos/level1/bogue/adcpwaves', 
    32                    'process_module' : 'proc_rdi_logdata_dw', 
    33                    'utc_offset' : 4,       # hours offset to utc 
     32                   'process_module' : 'proc_rdi_dspec_dw', 
     33                   'utc_offset' : 4,  # hours offset to utc 
     34                   'ndir' : 90., 
     35                   'nfreq' : 128., 
    3436                   }, 
    3537    } 
  • raw2proc/trunk/raw2proc/bogue_config_20070224.py

    r166 r167  
    2727    'adcpwaves' : {'id' : 'adcpwaves', 
    2828                   'description' : 'Directional wave data', 
    29                    'raw_dir' : '/seacoos/data/nccoos/level0/bogue/adcp_bLogData', 
    30                    'raw_file_glob' : '*', 
     29                   'raw_dir' : '/seacoos/data/nccoos/level0/bogue/adcp_cSpecData', 
     30                   'raw_file_glob' : 'DSpec*', 
    3131                   'proc_dir' : '/seacoos/data/nccoos/level1/bogue/adcpwaves', 
    32                    'process_module' : 'proc_rdi_logdata_dw', 
     32                   'process_module' : 'proc_rdi_dspec_dw', 
    3333                   'utc_offset' : 4,  # hours offset to utc 
     34                   'ndir' : 90., 
     35                   'nfreq' : 128., 
    3436                   }, 
    3537    } 
  • raw2proc/trunk/raw2proc/bogue_config_20080430.py

    r166 r167  
    2727    'adcpwaves' : {'id' : 'adcpwaves', 
    2828                   'description' : 'Directional wave data', 
    29                    'raw_dir' : '/seacoos/data/nccoos/level0/bogue/adcp_bLogData', 
    30                    'raw_file_glob' : '*', 
     29                   'raw_dir' : '/seacoos/data/nccoos/level0/bogue/adcp_cSpecData', 
     30                   'raw_file_glob' : 'DSpec*', 
    3131                   'proc_dir' : '/seacoos/data/nccoos/level1/bogue/adcpwaves', 
    32                    'process_module' : 'proc_rdi_logdata_dw', 
     32                   'process_module' : 'proc_rdi_dspec_dw', 
    3333                   'utc_offset' : 4,  # hours offset to utc 
     34                   'ndir' : 90., 
     35                   'nfreq' : 128., 
    3436                   }, 
    3537    } 
  • raw2proc/trunk/raw2proc/procutil.py

    r144 r167  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2008-03-25 10:51:00 jcleary
     2# Last modified:  Time-stamp: <2008-05-08 16:11:36 haines
    33"""Utilities to help data processing  
    44 
     
    280280    return str 
    281281 
     282def copy_loop_sequence(src, dst, fn_glob, numFiles=24): 
     283    """ """ 
     284    # src = '/seacoos/data/nccoos/level3/bogue/adcpwaves/dspec/'+this_month.strftime("%Y_%m") 
     285    # dst = '/home/haines/rayleigh/loop/' 
     286    # fn_glob = 'bogue_dspec_plot*' 
     287 
    282288# unit conversions  
    283289def meters2feet(meters): 
  • raw2proc/trunk/raw2proc/raw2proc.py

    r124 r167  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2008-03-20 09:49:13 haines> 
     2# Last modified:  Time-stamp: <2008-05-07 13:03:19 haines> 
    33"""Process raw data to monthly netCDF data files 
    44 
     
    3131 
    3232# define config file location to run under cron 
    33 defconfigs='/home/haines/nccoos/raw2proc
     33defconfigs='/home/haines/nccoos/test/r2p
    3434 
    3535import numpy 
     
    356356    for fn in raw_files: 
    357357        # sys.stdout.write('... %s ... ' % fn) 
     358        # attach file name to sensor info so parser can use it, if needed 
     359        si['fn'] = fn 
    358360        lines = load_data(fn) 
    359         data = parse(pi, si, lines) 
    360         # determine which index of data is within the specified timeframe (usually the month) 
    361  
    362         # initial code 
    363         # data['in'] =  data['dt']>si['proc_start_dt'] and data['dt']<=si['proc_end_dt'] 
    364   
    365         # new code         
    366         n = len(data['dt']) 
    367         data['in'] = numpy.array([False for i in range(n)]) 
    368         for index, val in enumerate(data['dt']): 
    369             if val>si['proc_start_dt'] and val<=si['proc_end_dt']: 
    370                 data['in'][index] = True 
    371         # end new code         
    372  
    373         # if any records are in the month then write to netcdf 
    374         if data['in'].any(): 
    375             sys.stdout.write('... %s ... ' % fn) 
    376             sys.stdout.write('%d\n' % len(data['in'])) 
    377             ofn = os.path.join(si['proc_dir'], si['proc_filename']) 
    378             # update or create netcdf  
    379             if os.path.exists(ofn): 
    380                 ut = update(pi,si,data) 
    381                 nc_update(ofn, ut) 
    382             else: 
    383                 ct = create(pi,si,data) 
    384                 nc_create(ofn, ct) 
    385  
    386  
    387          
     361        if lines: 
     362            data = parse(pi, si, lines) 
     363            # determine which index of data is within the specified timeframe (usually the month) 
     364            n = len(data['dt']) 
     365            data['in'] = numpy.array([False for i in range(n)]) 
     366            for index, val in enumerate(data['dt']): 
     367                if val>si['proc_start_dt'] and val<=si['proc_end_dt']: 
     368                    data['in'][index] = True 
     369                     
     370            # if any records are in the month then write to netcdf 
     371            if data['in'].any(): 
     372                sys.stdout.write('... %s ... ' % fn) 
     373                sys.stdout.write('%d\n' % len(data['in'])) 
     374                ofn = os.path.join(si['proc_dir'], si['proc_filename']) 
     375                # update or create netcdf  
     376                if os.path.exists(ofn): 
     377                    ut = update(pi,si,data) 
     378                    nc_update(ofn, ut) 
     379                else: 
     380                    ct = create(pi,si,data) 
     381                    nc_create(ofn, ct) 
     382        else: 
     383            # if no lines, file was empty 
     384            print " ... skipping file %s" % (fn,) 
     385 
    388386     
    389387# globals