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

Changeset 448

Show
Ignore:
Timestamp:
09/19/11 17:41:14
Author:
cbc
Message:

Add new Billy Mitchell configs.

Files:

Legend:

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

    r320 r448  
    77    'institution' : 'nccoos', 
    88    'config_start_date' : '2009-06-23 00:00:00', 
    9     'config_end_date' : None, # None or yyyy-mm-dd HH:MM:SS 
     9    'config_end_date' : '2010-09-02 00:00:00', # None or yyyy-mm-dd HH:MM:SS 
    1010    'packages' : ('sfas',), 
    1111    } 
     
    2323               'altitude_interval' : 5,  # meters 
    2424               'num_altitudes' : 39, 
    25                'sensor_elevation' : 0,   # meters 
     25               'sensor_elevation' : 0,   # meters (runway elev is at 5.2 m) 
    2626               'plot_module' : 'billymitchell_sodar_plot',  
    2727               'plot_names' : ('timeseries', 'wind_vectors', 'wind_barbs'),  
  • raw2proc/trunk/raw2proc/bogue_config_20090915.py

    r320 r448  
    2323               'nbins' : 20, 
    2424               'bin_size' : 0.5,      # meters 
    25                'transducer_ht' : 0.5, # meters above the bottom 
    26                # 'blanking_ht' : 0.41,  # meters above transducer 
    27                'blanking_ht' : 0.4,  # meters above transducer 
     25               'transducer_ht' : 0.75, # meters above the bottom 
     26               'blanking_ht' : 0.9,  # meters above transducer 
    2827               'plot_module' : 'bogue_adcp_plot',  
    2928               'plot_names' : ('timeseries',),  
  • raw2proc/trunk/raw2proc/crow_config_20090122.py

    r320 r448  
    2727               'plot_module' : 'crow_flow_plot',  
    2828               'plot_names' : ('timeseries',),  
     29               'csv_dir' : '/seacoos/data/nccoos/latest_csv', 
     30               'csv_vars' : ('time', 'rain','sontek_flow','sontek_wl'), 
    2931               # 'nbins' : 69, 
    3032               # 'bin_size' : 0.5,      # meters 
     
    4143            'plot_module' : 'crow_wq_plot',  
    4244            'plot_names' : ('timeseries',),  
     45            'csv_dir' : '/seacoos/data/nccoos/latest_csv', 
     46            'csv_vars' : ('time', 'wtemp','cond','do_sat', 'do_mg', 'ph', 'turb', 'battvolts'), 
    4347                   }, 
    4448    } 
  • raw2proc/trunk/raw2proc/hampton_config_20080930.py

    r336 r448  
    88            # 
    99            'config_start_date' : '2008-09-30 00:00:00', 
    10             'config_end_date' : None, # None or yyyy-mm-dd HH:MM:SS 
     10            'config_end_date' : '2010-10-19 00:00:00', # None or yyyy-mm-dd HH:MM:SS 
    1111            'packages' : ('avp', 'met'), 
    1212            } 
  • raw2proc/trunk/raw2proc/morgan_config_20080701.py

    r336 r448  
    2020              'raw_file_glob' : '*.[Dd][Aa][Tt]', 
    2121              'proc_dir' : '/seacoos/data/nccoos/level1/morgan/avp/', 
    22               'process_module' : 'proc_avp_ysi_6600_v2_CDL2', 
     22              'process_module' : 'proc_avp_ysi_6600_v2_moving_point', 
    2323              'utc_offset' : 5.,     # hours offset to Eastern Standard 
    2424              'bin_size' : 0.1,      # meters 
  • raw2proc/trunk/raw2proc/ncutil.py

    r336 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2010-07-30 13:00:15 haines> 
     2# Last modified:  Time-stamp: <2011-05-05 15:31:37 haines> 
    33""" 
    44Create, update and load utilities for netcdf files 
  • raw2proc/trunk/raw2proc/proc_avp_ascii_met.py

    r233 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2009-01-26 11:23:09 haines> 
     2# Last modified:  Time-stamp: <2010-12-09 16:15:23 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    5757    # get sample datetime from filename 
    5858    fn = sensor_info['fn'] 
    59     sample_dt_start = filt_datetime(fn)[0] 
     59    sample_dt_start = filt_datetime(fn) 
    6060 
    6161    # if line has weird ascii chars -- remove it 
     
    254254                       'long_name': 'Number of wind samples in sample period', 
    255255                       'standard_name': 'number_of_samples', 
    256                        'units': 'm s-1', 
     256                       'units': '', 
    257257                       }, 
    258258                 
     
    290290                ('lat',  platform_info['lat']), 
    291291                ('lon', platform_info['lon']), 
    292                 ('z', 1), 
     292                ('z', sensor_info['anemometer_height']), 
    293293                # 
    294294                ('time', data['time'][i]), 
  • raw2proc/trunk/raw2proc/proc_avp_ysi_6600_v1_CDL2.py

    r336 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2010-05-12 11:19:45 haines> 
     2# Last modified:  Time-stamp: <2010-12-09 16:15:11 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    101101    # get sample datetime from filename 
    102102    fn = sensor_info['fn'] 
    103     sample_dt_start = filt_datetime(fn)[0] 
     103    sample_dt_start = filt_datetime(fn) 
    104104 
    105105    # how many profiles in one file, count number of "Profile Time:" in lines 
  • raw2proc/trunk/raw2proc/proc_avp_ysi_6600_v2_CDL2.py

    r336 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2010-05-26 14:26:42 haines> 
     2# Last modified:  Time-stamp: <2011-02-24 11:00:27 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    9090    # get sample datetime from filename 
    9191    fn = sensor_info['fn'] 
    92     sample_dt_start = filt_datetime(fn)[0] 
     92    sample_dt_start = filt_datetime(fn) 
    9393 
    9494    # how many profiles in one file, count number of "Profile Time:" in lines 
     
    145145        # if line has weird ascii chars -- skip it and iterate to next line 
    146146        if re.search(r"[\x1a]", line): 
    147             print 'skipping bad data line ... ' + str(line) 
     147            # print 'skipping bad data line ... ' + str(line) 
    148148            continue 
    149149             
  • raw2proc/trunk/raw2proc/proc_codar_totals.py

    r336 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2010-07-30 12:57:22 haines> 
     2# Last modified:  Time-stamp: <2010-09-20 12:32:19 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    9090            nrow = int(v) 
    9191 
    92     if nrow
     92    if nrow>2
    9393        # read data from string of lines but make it behave like a file object with StringIO 
    9494        s = StringIO(''.join(lines)) 
     
    9696        d = numpy.loadtxt(s, comments='%') 
    9797        # lat, lon, u, v = numpy.loadtxt(s, usecols=(0,1,2,3), comments='%', unpack=True) 
     98         
    9899        if 'TOT4' in ftype: 
    99100            lon = d[:,0] 
     
    118119            s6 = d[:,19] 
    119120 
    120             uim = griddata(lon, lat, wu, xi, yi) 
    121             vim = griddata(lon, lat, wv, xi, yi) 
    122             # returned masked array as an ndarray with masked values filled with fill_value 
    123             ui = uim.filled(fill_value=numpy.nan) 
    124             vi = vim.filled(fill_value=numpy.nan) 
     121            try:  
     122                uim = griddata(lon, lat, wu, xi, yi) 
     123                vim = griddata(lon, lat, wv, xi, yi) 
     124                # returned masked array as an ndarray with masked values filled with fill_value 
     125                ui = uim.filled(fill_value=numpy.nan) 
     126                vi = vim.filled(fill_value=numpy.nan) 
     127                # print ui.shape 
     128            except IndexError: 
     129                print "raw2proc:  IndexError in griddata() -- skipping data" 
    125130 
    126131    # --------------------------------------------------------------- 
    127  
    128132    i = 0 
    129133    data['dt'][i] =  sample_dt #  
     
    132136    data['lat'] = yi # new latitude grid 
    133137 
    134     if nrow
     138    if nrow and nrow>2
    135139        # use transpose so order is (time, x, y) for netcdf convention 
    136140        data['u'][i] = ui.T # u-component of water velocity (cm/s) 
  • raw2proc/trunk/raw2proc/proc_cr1000_flow.py

    r320 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2009-12-07 14:32:39 haines> 
     2# Last modified:  Time-stamp: <2010-12-09 16:14:55 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    6262    # get sample datetime from filename 
    6363    fn = sensor_info['fn'] 
    64     sample_dt_start = filt_datetime(fn)[0] 
     64    sample_dt_start = filt_datetime(fn) 
    6565 
    6666    # how many samples (don't count header 4 lines) 
  • raw2proc/trunk/raw2proc/proc_cr1000_wq.py

    r320 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2009-12-15 08:31:52 haines> 
     2# Last modified:  Time-stamp: <2010-12-09 16:14:48 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    5656    # get sample datetime from filename 
    5757    fn = sensor_info['fn'] 
    58     sample_dt_start = filt_datetime(fn)[0] 
     58    sample_dt_start = filt_datetime(fn) 
    5959 
    6060    # how many samples (don't count header 4 lines) 
  • raw2proc/trunk/raw2proc/proc_cr10x_flow_v1.py

    r320 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2009-12-07 15:02:51 haines> 
     2# Last modified:  Time-stamp: <2010-12-09 16:14:39 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    7474    # get sample datetime from filename 
    7575    fn = sensor_info['fn'] 
    76     sample_dt_start = filt_datetime(fn)[0] 
     76    sample_dt_start = filt_datetime(fn) 
    7777 
    7878    # how many samples 
  • raw2proc/trunk/raw2proc/proc_cr10x_flow_v2.py

    r320 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2009-12-07 15:03:02 haines> 
     2# Last modified:  Time-stamp: <2010-12-09 16:14:26 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    9292    # get sample datetime from filename 
    9393    fn = sensor_info['fn'] 
    94     sample_dt_start = filt_datetime(fn)[0] 
     94    sample_dt_start = filt_datetime(fn) 
    9595 
    9696    # how many samples 
  • raw2proc/trunk/raw2proc/proc_cr10x_wq_v1.py

    r320 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2009-12-15 08:32:19 haines> 
     2# Last modified:  Time-stamp: <2010-12-09 16:14:19 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    5252    # get sample datetime from filename 
    5353    fn = sensor_info['fn'] 
    54     sample_dt_start = filt_datetime(fn)[0] 
     54    sample_dt_start = filt_datetime(fn) 
    5555 
    5656    # how many samples 
  • raw2proc/trunk/raw2proc/proc_cr10x_wq_v2.py

    r320 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2009-12-15 08:32:33 haines> 
     2# Last modified:  Time-stamp: <2010-12-09 16:14:11 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    8989    # get sample datetime from filename 
    9090    fn = sensor_info['fn'] 
    91     sample_dt_start = filt_datetime(fn)[0] 
     91    sample_dt_start = filt_datetime(fn) 
    9292 
    9393    # how many samples 
  • raw2proc/trunk/raw2proc/proc_nortek_wds_dw.py

    r320 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2009-10-28 17:27:56 haines> 
     2# Last modified:  Time-stamp: <2010-12-09 16:13:56 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    9292    # get sample datetime from filename 
    9393    fn = sensor_info['fn'] 
    94     sample_dt_start = filt_datetime(fn)[0] 
     94    sample_dt_start = filt_datetime(fn) 
    9595 
    9696    # try getting sample date/times from .wap 
  • raw2proc/trunk/raw2proc/proc_nortek_wpa_adcp.py

    r320 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2010-01-22 12:11:55 haines> 
     2# Last modified:  Time-stamp: <2010-12-09 16:13:37 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    7373    # get sample datetime from filename 
    7474    fn = sensor_info['fn'] 
    75     sample_dt_start = filt_datetime(fn)[0] 
     75    sample_dt_start = filt_datetime(fn) 
    7676 
    7777    nbins = sensor_info['nbins']  # Number of bins in data 
     
    108108    # Nortek awac beam angle is fixed at 25 deg 
    109109    # adjustment is cos(25 deg) (which is  approx .90*height) 
    110     bin_habs =  (bin_habs*numpy.cos(25.*numpy.pi/180)) 
     110    # ------------------- 
     111    # bin_habs =  (bin_habs*numpy.cos(25.*numpy.pi/180)) 
     112    # ------------------- 
     113    # commented out by SH -- 18 Aug 2010 
     114    # This does not apply to habs provided in .wpa.  They 
     115    # are adjusted for beam angle in ascii output. 
    111116    iaboveblank = bin_habs > th+bh+(bin_size) 
    112117 
     
    168173            bin_number = wpa[0] 
    169174            j = wpa[0]-1 
    170             print j 
     175            # print j 
    171176            hab[j] = wpa[1] 
    172177             
  • raw2proc/trunk/raw2proc/proc_rdi_dspec_dw.py

    r211 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2008-10-01 12:47:26 haines> 
     2# Last modified:  Time-stamp: <2010-12-09 16:13:21 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    7878    # print " ... %s" % (fn,) 
    7979    if  sensor_info['utc_offset']: 
    80         sample_dt = filt_datetime(fn)[0] + \ 
     80        sample_dt = filt_datetime(fn) + \ 
    8181                    timedelta(hours=sensor_info['utc_offset']) 
    8282    else: 
    83         sample_dt = filt_datetime(fn)[0] 
     83        sample_dt = filt_datetime(fn) 
    8484 
    8585    # extract header (first 6 lines) 
  • raw2proc/trunk/raw2proc/procutil.py

    r336 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2010-07-30 14:10:56 haines> 
     2# Last modified:  Time-stamp: <2010-12-15 09:32:53 haines> 
    33"""Utilities to help data processing  
    44 
     
    1313from datetime import datetime, timedelta, tzinfo 
    1414from dateutil.tz import tzlocal, tzutc 
     15from dateutil.parser import parse 
    1516import time 
    1617import math 
     
    3839     
    3940        cn = os.path.splitext(os.path.basename(config))[0] 
    40         cndt = filt_datetime(os.path.basename(config))[0] 
     41        cndt = filt_datetime(os.path.basename(config)) 
    4142        pi = get_config(cn+'.platform_info') 
    4243        if pi['config_start_date']: 
    43             config_start_dt = filt_datetime(pi['config_start_date'])[0] 
     44            config_start_dt = filt_datetime(pi['config_start_date']) 
    4445        elif pi['config_start_date'] == None: 
    4546            config_start_dt = now_dt 
    4647        if pi['config_end_date']: 
    47             config_end_dt = filt_datetime(pi['config_end_date'])[0] 
     48            config_end_dt = filt_datetime(pi['config_end_date']) 
    4849        elif pi['config_end_date'] == None: 
    4950            config_end_dt = now_dt 
     
    9596        this_month = dt 
    9697    elif type(year) == str : 
    97         dt = filt_datetime(year)[0] 
     98        dt = filt_datetime(year) 
    9899        this_month = dt 
    99100    # 
     
    138139    return dt 
    139140 
    140 def filt_datetime(input_string, remove_ext=True): 
     141def filt_datetime_test(input_string, remove_ext=True): 
    141142    """ 
    142143    Following the template, (YY)YYMMDDhhmmss 
     
    145146    return its datetime object. 
    146147    """ 
     148 
     149    from dateutil.parser import parse 
    147150 
    148151    # remove any trailing filename extension 
     
    152155        (s, e) = splitext(input_string) 
    153156        input_string = s 
     157 
     158    try: 
     159        dt = parse(input_string, fuzzy=True) 
     160    except ValueError, e: 
     161        print 'filt_datetime: Could not parse date. No date found in ', input_string 
     162        dt = None 
     163    else: 
     164        return dt 
     165 
     166 
     167 
     168 
     169def filt_datetime(input_string, gran=False, remove_ext=True): 
     170    """ 
     171    Following the template, (YY)YYMMDDhhmmss 
     172    and versions with of this with decreasing time precision, 
     173    find the most precise, reasonable string match and 
     174    return its datetime object. 
     175 
     176    gran=False don't return granularity number 
     177     
     178     
     179    """ 
     180 
     181    # remove any trailing filename extension 
     182    from os.path import splitext 
     183    import re 
     184    if remove_ext: 
     185        (s, e) = splitext(input_string) 
     186        input_string = s 
    154187     
    155188    # YYYYMMDDhhmmss and should handle most cases of the stamp 
     
    161194 
    162195    case1_regex = r""" 
    163     # case 1: (YY)YYMMDDhhmmss  
    164     (\d{4}|\d{2})     # 2- or 4-digit YEAR (e.g. '07' or '2007') 
     196    # case 1: YYYYMMDDhhmmss  
     197    (\d{4})     # 2- or 4-digit YEAR (e.g. '07' or '2007') 
    165198    \D?               # optional 1 character non-digit separator (e.g. ' ' or '-') 
    166199    (\d{2})           # 2-digit MONTH (e.g. '12') 
     
    176209 
    177210    case2_regex = r""" 
    178     # case 2: (YY)YYMMDDhhmm (no seconds)  
    179     (\d{4}|\d{2})     # 2- or 4-digit YEAR  
     211    # case 2: YYYYMMDDhhmm (no seconds)  
     212    (\d{4})     # 2- or 4-digit YEAR  
    180213    \D?               # optional 1 character non-digit separator (e.g. ' ' or '-') 
    181214    (\d{2})           # 2-digit MONTH  
     
    189222 
    190223    case3_regex = r""" 
    191     # case 3: (YY)YYMMDDhh (no seconds, no minutes) 
    192     (\d{4}|\d{2})     # 2- or 4-digit YEAR  
     224    # case 3: YYYYMMDDhh (no seconds, no minutes) 
     225    (\d{4})     # 2- or 4-digit YEAR  
    193226    \D?               # optional 1 character non-digit separator (e.g. ' ' or '-') 
    194227    (\d{2})           # 2-digit MONTH  
     
    200233 
    201234    case4_regex = r""" 
    202     # case 4: (YY)YYMMDD (no time values, just date) 
    203     (\d{4}|\d{2})     # 2- or 4-digit YEAR  
     235    # case 4: YYYYMMDD (no time values, just date) 
     236    (\d{4})     # 2- or 4-digit YEAR  
    204237    \D?               # optional 1 character non-digit separator (e.g. ' ' or '-') 
    205238    (\d{2})           # 2-digit MONTH  
     
    209242 
    210243    case5_regex = r""" 
    211     # case 5: (YY)YYMM (no time values, just month year) 
    212     (\d{4}|\d{2})     # 2- or 4-digit YEAR  
     244    # case 5: YYYYMM (no time values, just month year) 
     245    (\d{4})     # 2- or 4-digit YEAR  
     246    \D?               # optional 1 character non-digit separator (e.g. ' ' or '-') 
     247    (\d{2})           # 2-digit MONTH  
     248    """ 
     249 
     250    case6_regex = r""" 
     251    # case 6: YYMMDDhhmmss  
     252    (\d{2})     # 2- or 4-digit YEAR (e.g. '07' or '2007') 
     253    \D?               # optional 1 character non-digit separator (e.g. ' ' or '-') 
     254    (\d{2})           # 2-digit MONTH (e.g. '12') 
     255    \D?               # optional 1 character non-digit separator 
     256    (\d{2})           # 2-digit DAY of month (e.g. '10') 
     257    \D?               # optional 1 character non-digit separator (e.g. ' ' or 'T') 
     258    (\d{2})           # 2-digit HOUR (e.g. '10') 
     259    \D?               # optional 1 character non-digit separator (e.g. ' ' or ':') 
     260    (\d{2})           # 2-digit MINUTE (e.g. '10') 
     261    \D?               # optional 1 character non-digit separator (e.g. ' ' or ':') 
     262    (\d{2})           # 2-digit SECOND (e.g. '10') 
     263    """ 
     264 
     265    case7_regex = r""" 
     266    # case 7: YYMMDDhhmm (no seconds)  
     267    (\d{2})     # 2- or 4-digit YEAR  
     268    \D?               # optional 1 character non-digit separator (e.g. ' ' or '-') 
     269    (\d{2})           # 2-digit MONTH  
     270    \D?               # optional 1 character non-digit separator 
     271    (\d{2})           # 2-digit DAY  
     272    \D?               # optional 1 character non-digit separator (e.g. ' ' or 'T') 
     273    (\d{2})           # 2-digit HOUR  
     274    \D?               # optional 1 character non-digit separator (e.g. ' ' or ':') 
     275    (\d{2})           # 2-digit MINUTE  
     276    """ 
     277 
     278    case8_regex = r""" 
     279    # case 8: YYMMDDhh (no seconds, no minutes) 
     280    (\d{2})     # 2- or 4-digit YEAR  
     281    \D?               # optional 1 character non-digit separator (e.g. ' ' or '-') 
     282    (\d{2})           # 2-digit MONTH  
     283    \D?               # optional 1 character non-digit separator 
     284    (\d{2})           # 2-digit DAY  
     285    \D?               # optional 1 character non-digit separator (e.g. ' ' or 'T') 
     286    (\d{2})           # 2-digit HOUR  
     287    """ 
     288 
     289    case9_regex = r""" 
     290    # case 9: YYMMDD (no time values, just date) 
     291    (\d{2})     # 2- or 4-digit YEAR  
     292    \D?               # optional 1 character non-digit separator (e.g. ' ' or '-') 
     293    (\d{2})           # 2-digit MONTH  
     294    \D?               # optional 1 character non-digit separator 
     295    (\d{2})           # 2-digit DAY  
     296    """ 
     297 
     298    case10_regex = r""" 
     299    # case 10: YYMM (no time values, just month year) 
     300    (\d{2})     # 2- or 4-digit YEAR  
    213301    \D?               # optional 1 character non-digit separator (e.g. ' ' or '-') 
    214302    (\d{2})           # 2-digit MONTH  
     
    219307 
    220308    # cases are ordered from precise to more coarse resolution of time 
    221     cases = [case1_regex, case2_regex, case3_regex, case4_regex, case5_regex
     309    cases = [case1_regex, case2_regex, case3_regex, case4_regex, case5_regex, case6_regex, case7_regex, case8_regex, case9_regex
    222310    patterns = [re.compile(c, re.VERBOSE) for c in cases] 
    223311    matches = [p.search(input_string) for p in patterns] 
     
    255343                daysdiff = abs(z.days) 
    256344                # if this date unreasonable (>10 years*365), throw it out 
    257                 # something parsed wrong 
    258                 if daysdiff > 3650: 
     345                # garbage was parsed 
     346                if daysdiff > 3600: 
    259347                    dt = None                 
    260348        else: 
    261349            dt = None 
    262  
    263350        # place datetime object or None within sequence of matches 
    264351        matches[ind] = dt 
     
    275362    else: 
    276363       dt = matches[ind] 
    277        return dt,ind  
     364       if gran: 
     365           return dt,ind 
     366       else: 
     367           return dt 
    278368 
    279369def display_time_diff(diff): 
     
    341431        new_dt = numpy.insert(numpy.array(dt), igap+1, dt_insert) 
    342432        # insert NaN value at the gaps (insert placed just before obs) 
    343         new_data = numpy.insert(numpy.array(data), igap+1, numpy.nan, axis=0) 
     433        new_data = numpy.insert(numpy.array(data, dtype=float), igap+1, numpy.nan, axis=0) 
    344434        # if all the data is NaN, then autoscale crocks.  This prevents 
    345435        # throwing an error (but be careful if using for anything other than grafs) 
     
    625715            val = vd[-1] 
    626716 
    627         # if can take the length of val 
    628         # probably a list, tuple 
     717        # if can take the length of val, val is probably a list, tuple of profile data 
    629718        # there will be more than one value of which we want a mean (ignoring NaN') 
    630719        if bool('__len__' in dir(val)): 
    631             val = numpy.mean(numpy.ma.masked_where(numpy.isnan(val), val))                 
     720            val = numpy.mean(numpy.ma.masked_where(numpy.isnan(val), val)) 
     721            var_name_str = 'Depth Averaged '+var_name_str 
    632722 
    633723        # to metric 
     
    640730                valunits_from = 'degC' 
    641731            valunits_to = 'degC' 
    642         elif 'velocity' in sn
     732        elif 'velocity' in sn or 'speed' in sn or 'current' in sn
    643733            valunits_to = 'm s-1' 
    644734        elif 'flux' in sn or sn in ('discharge',): 
     
    679769                valunits_from = 'degC' 
    680770            valunits_to = 'degF' 
    681         elif 'velocity' in sn
     771        elif 'velocity' in sn or 'speed' in sn or 'current' in sn
    682772            valunits_to = 'knots' 
    683773        elif 'flux' in sn or sn in ('discharge',): 
     
    716806        if vn=='time': 
    717807            f.write('"**%s:** %s", ""\n' % ('Sample Time', last_dt_str)) 
     808        elif vn=='blank': 
     809             f.write('"%s", "%s", "%s"\n' % (' ', ' ', ' ')) 
    718810        else: 
    719811            f.write('"%s", "%s", "%s"\n' % (var_name_str, metric_str, english_str)) 
  • raw2proc/trunk/raw2proc/raw2proc.py

    r320 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2009-12-05 21:32:18 haines> 
     2# Last modified:  Time-stamp: <2011-02-17 10:57:48 haines> 
    33"""Process raw data to monthly netCDF data files 
    44 
     
    109109        # datetime from filename  
    110110        cn = os.path.splitext(os.path.basename(config))[0] 
    111         cndt = filt_datetime(os.path.basename(config))[0] 
     111        cndt = filt_datetime(os.path.basename(config)) 
    112112        pi = get_config(cn+'.platform_info') 
    113113        if pi['config_start_date']: 
    114             config_start_dt = filt_datetime(pi['config_start_date'])[0] 
     114            config_start_dt = filt_datetime(pi['config_start_date']) 
    115115        elif pi['config_start_date'] == None: 
    116116            config_start_dt = now_dt 
    117117        if pi['config_end_date']: 
    118             config_end_dt = filt_datetime(pi['config_end_date'])[0] 
     118            config_end_dt = filt_datetime(pi['config_end_date']) 
    119119        elif pi['config_end_date'] == None: 
    120120            config_end_dt = now_dt 
     
    144144        # datetime from filename  
    145145        cn = os.path.splitext(os.path.basename(config))[0] 
    146         cndt = filt_datetime(os.path.basename(config))[0] 
     146        cndt = filt_datetime(os.path.basename(config)) 
    147147        pi = get_config(cn+'.platform_info') 
    148148        if pi['config_end_date'] == None: 
     
    180180    # compute datetime for each file 
    181181    for fn in all_raw_files: 
    182         # JC changes 
    183         fndt_tuple = filt_datetime(os.path.basename(fn)) 
    184         fndt = fndt_tuple[0]  
     182        (fndt, granularity) = filt_datetime(os.path.basename(fn), gran=True) 
    185183 
    186184        # "ind" var from filt_datetime() - what level of granularity was used 
    187         granularity = fndt_tuple[1] 
    188185        if granularity == 4: 
    189186            # change dt_start to before monthly filename filt_datetime() date  
    190187            dt_start = si['proc_start_dt']-timedelta(days=31) 
    191188            # print dt_start 
    192         # end JC changes 
     189 
    193190        if fndt: 
    194191            if dt_start <= fndt <= dt_end or m: 
     
    203200    now_dt.replace(microsecond=0) 
    204201    if pi['config_start_date']: 
    205         config_start_dt = filt_datetime(pi['config_start_date'])[0] 
     202        config_start_dt = filt_datetime(pi['config_start_date']) 
    206203    elif pi['config_start_date'] == None: 
    207204        config_start_dt = now_dt 
    208205 
    209206    if pi['config_end_date']: 
    210         config_end_dt = filt_datetime(pi['config_end_date'])[0] 
     207        config_end_dt = filt_datetime(pi['config_end_date']) 
    211208    elif pi['config_end_date'] == None: 
    212209        config_end_dt = now_dt 
  • raw2proc/trunk/raw2proc/spin/spin_morgan_avp.py

    r330 r448  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2009-12-16 12:41:39 haines> 
     2# Last modified:  Time-stamp: <2011-02-16 16:55:15 haines> 
    33"""Spin processing of raw data to monthly netCDF data files""" 
    44 
    55from raw2proc import * 
     6 
     7raw2proc('manual', 'morgan', 'avp', '2010_12') 
     8raw2proc('manual', 'morgan', 'avp', '2010_11') 
     9raw2proc('manual', 'morgan', 'avp', '2010_10') 
     10raw2proc('manual', 'morgan', 'avp', '2010_09') 
     11raw2proc('manual', 'morgan', 'avp', '2010_08') 
     12raw2proc('manual', 'morgan', 'avp', '2010_07') 
     13raw2proc('manual', 'morgan', 'avp', '2010_06') 
     14raw2proc('manual', 'morgan', 'avp', '2010_05') 
     15raw2proc('manual', 'morgan', 'avp', '2010_04') 
     16raw2proc('manual', 'morgan', 'avp', '2010_03') 
     17raw2proc('manual', 'morgan', 'avp', '2010_02') 
     18raw2proc('manual', 'morgan', 'avp', '2010_01') 
    619 
    720raw2proc('manual', 'morgan', 'avp', '2009_12')