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

Changeset 488

Show
Ignore:
Timestamp:
04/24/12 12:33:22
Author:
haines
Message:

removed test_ and scr_ files not necessary for SVN

Files:

Legend:

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

    r478 r488  
    77            'altitude': 0.,   # (approx.) station altitude 
    88            'altitude_units' : 'm', 
    9             'altitude_reference' : 'above_sea_level', 
     9            'altitude_reference' : 'sea_surface', 
    1010            # 
    1111            'mean_water_depth': -32.0, 
     
    1515            'config_start_date' : '2011-11-13 00:00:00', 
    1616            'config_end_date' : None, # None or yyyy-mm-dd HH:MM:SS 
    17             'packages' : ('met', 'wind', ), 
     17            'packages' : ('met', 'wind', 'ctd1', 'ctd2'), 
     18            # Required by CF 
     19            'institution' : 'Unversity of North Carolina at Chapel Hill (UNC-CH)', 
     20            'institution_url' : 'http://nccoos.org', 
     21            'institution_dods_url' : 'http://nccoos.org', 
     22            'contact' : 'Sara Haines (haines@email.unc.edu)', 
     23            'conventions' : 'CF-1.0; SEACOOS-CDL-v2.0', 
     24            # Required by Scout 
     25            'format_category_code' : 'fixed-point', 
     26            'institution_code' : 'nccoos', 
     27            # Recommended 
     28            'project' : 'North Carolina Coastal Ocean Observing System (NCCOOS)', 
     29            'project_url' : 'http://nccoos.org',             
     30            'metadata_url' : 'http://nccoos.org', 
     31            'references' : 'http://nccoos.org', 
     32            'source': 'Buoy CR1000 Datalogger', 
    1833            } 
    1934 
     
    2843              'barometer_height'   : 1.5,   # meters 
    2944              'temperature_height' : 1.5,   # meters  
     45              'height_units' : 'm', 
     46              'height_reference' : 'sea_surface', 
    3047              # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 
    31               # 'latest_vars' : ('time','lat','lon','z','u', 'v', 'wspd', 'wdir'), 
     48              # 'latest_vars' : ('time','lat','lon','z','atemp', 'baro', 'rh', 'rain', 'psp', 'pir'), 
     49              # Recommended 
     50              'source': 'Heise Baro, Rotronics Temp/RH, RM Young Precip, Eppley PSP/PIR', 
    3251             }, 
    3352    'wind' : { 'id' : 'wind', 
     
    4160              'anemometer2_height' : 3.35,  # meters (11 ft above sea surface) 
    4261              'height_units' : 'm', 
    43               'height_reference' : 'above_sea_level', 
     62              'height_reference' : 'sea_surface', 
    4463              # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 
    4564              # 'latest_vars' : ('time','lat','lon','z','u', 'v', 'wspd', 'wdir'), 
     65              # Recommended 
     66              'source': 'RM Young Marine Wind Monitor 5106', 
     67             }, 
     68    'ctd1' : { 'id' : 'ctd1', 
     69              'description' : 'Near-surface CTD Data each sample period', 
     70              'raw_dir' : '/seacoos/data/nccoos/level0/b1/ctd1/', 
     71              'raw_file_glob' : '*.dat', 
     72              'proc_dir' : '/seacoos/data/nccoos/level1/b1/ctd1/', 
     73              'process_module' : 'proc_cr1000_ctd', 
     74              'utc_offset' : 0,  # hours offset to utc of sampling time 
     75              'nominal_depth' : -2.0,  # meters  
     76              'depth_units' : 'm', 
     77              'depth_reference' : 'sea_surface', 
     78              # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 
     79              # 'latest_vars' : ('time','lat','lon','z','depth', 'wtemp', 'cond', 'salin', 'density'), 
     80              # Recommended 
     81              'source': 'Seabird (SBE) 37 IMP', 
     82             }, 
     83    'ctd2' : { 'id' : 'ctd2', 
     84               'description' : 'Mid-level CTD Data each sample period', 
     85              'raw_dir' : '/seacoos/data/nccoos/level0/b1/ctd2/', 
     86              'raw_file_glob' : '*.dat', 
     87              'proc_dir' : '/seacoos/data/nccoos/level1/b1/ctd2/', 
     88              'process_module' : 'proc_cr1000_ctd', 
     89              'utc_offset' : 0,  # hours offset to utc of sampling time 
     90              'nominal_depth' : -15.0,  # meters  
     91              'depth_units' : 'm', 
     92              'depth_reference' : 'sea_surface', 
     93              # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 
     94              # 'latest_vars' : ('time','lat','lon','z','depth', 'wtemp', 'cond', 'salin', 'density'), 
     95              # Recommended 
     96              'source': 'Seabird (SBE) 37 IMP', 
    4697             }, 
    4798    } 
  • raw2proc/trunk/raw2proc/b2_config_20111005.py

    r478 r488  
    77            'altitude': 0.,   # (approx.) station altitude 
    88            'altitude_units' : 'm', 
    9             'altitude_reference' : 'above_sea_level', 
     9            'altitude_reference' : 'sea_surface', 
    1010            # 
    1111            'mean_water_depth': -29.2, # meters (96 feet) 
     
    1616            'config_end_date' : None, # None or yyyy-mm-dd HH:MM:SS 
    1717            'packages' : ('met', 'wind',), 
     18            # Required by CF 
     19            'institution' : 'Unversity of North Carolina at Chapel Hill (UNC-CH)', 
     20            'institution_url' : 'http://nccoos.org', 
     21            'institution_dods_url' : 'http://nccoos.org', 
     22            'contact' : 'Sara Haines (haines@email.unc.edu)', 
     23            'conventions' : 'CF-1.0; SEACOOS-CDL-v2.0', 
     24            # Required by Scout 
     25            'format_category_code' : 'fixed-point', 
     26            'institution_code' : 'nccoos', 
     27            # Recommended 
     28            'project' : 'North Carolina Coastal Ocean Observing System (NCCOOS)', 
     29            'project_url' : 'http://nccoos.org',             
     30            'metadata_url' : 'http://nccoos.org', 
     31            'references' : 'http://nccoos.org', 
     32            'source': 'Buoy CR1000 Datalogger', 
    1833            } 
    1934 
     
    2944              'temperature_height' : 1.5,   # meters  
    3045              'height_units' : 'm', 
    31               'height_reference' : 'above_sea_level', 
     46              'height_reference' : 'sea_surface', 
    3247              # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 
    3348              # 'latest_vars' : ('time','lat','lon','z','u', 'v', 'wspd', 'wdir'), 
     49              # Recommended 
     50              'source': 'Heise Baro, Rotronics Temp/RH, RM Young Precip, Eppley PSP/PIR', 
    3451             }, 
    3552    'wind' : { 'id' : 'wind', 
     
    4360              'anemometer2_height' : 3.35,  # meters (11 ft above sea surface) 
    4461              'height_units' : 'm', 
    45               'height_reference' : 'above_sea_level', 
     62              'height_reference' : 'sea_surface', 
    4663              # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 
    4764              # 'latest_vars' : ('time','lat','lon','z','u', 'v', 'wspd', 'wdir'), 
    4865             }, 
     66              # Recommended 
     67              'source': 'RM Young Marine Wind Monitor 5106', 
     68    'ctd1' : { 'id' : 'ctd1', 
     69              'description' : 'Near-surface CTD Data each sample period', 
     70              'raw_dir' : '/seacoos/data/nccoos/level0/b2/ctd1/', 
     71              'raw_file_glob' : '*.dat', 
     72              'proc_dir' : '/seacoos/data/nccoos/level1/b2/ctd1/', 
     73              'process_module' : 'proc_cr1000_ctd', 
     74              'utc_offset' : 0,  # hours offset to utc of sampling time 
     75              'nominal_depth' : -2.0,  # meters  
     76              'depth_units' : 'm', 
     77              'depth_reference' : 'sea_surface', 
     78              # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 
     79              # 'latest_vars' : ('time','lat','lon','z','depth', 'wtemp', 'cond', 'salin', 'density'), 
     80              # Recommended 
     81              'source': 'Seabird (SBE) 37 IMP', 
     82             }, 
     83    'ctd2' : { 'id' : 'ctd2', 
     84               'description' : 'Mid-level CTD Data each sample period', 
     85              'raw_dir' : '/seacoos/data/nccoos/level0/b2/ctd2/', 
     86              'raw_file_glob' : '*.dat', 
     87              'proc_dir' : '/seacoos/data/nccoos/level1/b2/ctd2/', 
     88              'process_module' : 'proc_cr1000_ctd', 
     89              'utc_offset' : 0,  # hours offset to utc of sampling time 
     90              'nominal_depth' : -15.0,  # meters  
     91              'depth_units' : 'm', 
     92              'depth_reference' : 'sea_surface', 
     93              # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 
     94              # 'latest_vars' : ('time','lat','lon','z','depth', 'wtemp', 'cond', 'salin', 'density'), 
     95              # Recommended 
     96              'source': 'Seabird (SBE) 37 IMP', 
     97             }, 
    4998    } 
  • raw2proc/trunk/raw2proc/proc_codar_totals.py

    r448 r488  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2010-09-20 12:32:19 haines> 
     2# Last modified:  Time-stamp: <2012-04-17 13:56:34 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
  • raw2proc/trunk/raw2proc/proc_cr1000_met.py

    r478 r488  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2011-12-16 14:10:43 haines> 
     2# Last modified:  Time-stamp: <2012-04-23 14:12:38 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    145145    # 
    146146    #  
     147    # subset data only to month being processed (see raw2proc.process()) 
     148    i = data['in'] 
     149 
    147150    title_str = sensor_info['description']+' at '+ platform_info['location'] 
    148     global_atts = {  
     151    global_atts = { 
    149152        'title' : title_str, 
    150         'institution' : 'University of North Carolina at Chapel Hill (UNC-CH)'
    151         'institution_url' : 'http://nccoos.org'
    152         'institution_dods_url' : 'http://nccoos.org'
    153         'metadata_url' : 'http://nccoos.org'
    154         'references' : 'http://nccoos.org'
    155         'contact' : 'Sara Haines (haines@email.unc.edu)'
     153        'institution' : platform_info['institution']
     154        'institution_url' : platform_info['institution_url']
     155        'institution_dods_url' : platform_info['institution_dods_url']
     156        'metadata_url' : platform_info['metadata_url']
     157        'references' : platform_info['references']
     158        'contact' : platform_info['contact']
    156159        #  
    157         'source' : 'buoy station'
     160        'source' : platform_info['source']+' '+sensor_info['source']
    158161        'history' : 'raw2proc using ' + sensor_info['process_module'], 
    159162        'comment' : 'File created using pycdf'+pycdfVersion()+' and numpy '+pycdfArrayPkg(), 
    160163        # conventions 
    161         'Conventions' : 'CF-1.0; SEACOOS-CDL-v2.0'
     164        'Conventions' : platform_info['conventions']
    162165        # SEACOOS CDL codes 
    163         'format_category_code' : 'fixed-point'
    164         'institution_code' : platform_info['institution'], 
     166        'format_category_code' : platform_info['format_category_code']
     167        'institution_code' : platform_info['institution_code'], 
    165168        'platform_code' : platform_info['id'], 
    166169        'package_code' : sensor_info['id'], 
    167170        # institution specific 
    168         'project' : 'North Carolina Coastal Ocean Observing System (NCCOOS)'
    169         'project_url' : 'http://nccoos.org'
     171        'project' : platform_info['project']
     172        'project_url' : platform_info['project_url']
    170173        # timeframe of data contained in file yyyy-mm-dd HH:MM:SS 
    171         'start_date' : data['dt'][0].strftime("%Y-%m-%d %H:%M:%S"), 
    172         'end_date' : data['dt'][-1].strftime("%Y-%m-%d %H:%M:%S"),  
     174        # first date in monthly file 
     175        'start_date' : data['dt'][i][0].strftime("%Y-%m-%d %H:%M:%S"), 
     176        # last date in monthly file 
     177        'end_date' : data['dt'][i][-1].strftime("%Y-%m-%d %H:%M:%S"),  
    173178        'release_date' : now_dt.strftime("%Y-%m-%d %H:%M:%S"), 
    174179        # 
     
    330335def updater(platform_info, sensor_info, data): 
    331336    # 
     337    # subset data only to month being processed (see raw2proc.process()) 
     338    i = data['in'] 
     339 
    332340    global_atts = {  
    333341        # update times of data contained in file (yyyy-mm-dd HH:MM:SS) 
    334342        # last date in monthly file 
    335         'end_date' : data['dt'][-1].strftime("%Y-%m-%d %H:%M:%S"),  
     343        'end_date' : data['dt'][i][-1].strftime("%Y-%m-%d %H:%M:%S"),  
    336344        'release_date' : now_dt.strftime("%Y-%m-%d %H:%M:%S"), 
    337345        # 
     
    351359    #    } 
    352360     
    353     # subset data only to month being processed (see raw2proc.process()) 
    354     i = data['in'] 
    355  
    356361    # data  
    357362    var_data = ( 
  • raw2proc/trunk/raw2proc/proc_cr1000_wind.py

    r478 r488  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2011-12-16 14:36:47 haines> 
     2# Last modified:  Time-stamp: <2012-04-23 14:13:36 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    146146    # 
    147147    #  
     148    # subset data only to month being processed (see raw2proc.process()) 
     149    i = data['in'] 
     150 
    148151    title_str = sensor_info['description']+' at '+ platform_info['location'] 
    149     global_atts = {  
     152    global_atts = { 
    150153        'title' : title_str, 
    151         'institution' : 'University of North Carolina at Chapel Hill (UNC-CH)'
    152         'institution_url' : 'http://nccoos.org'
    153         'institution_dods_url' : 'http://nccoos.org'
    154         'metadata_url' : 'http://nccoos.org'
    155         'references' : 'http://nccoos.org'
    156         'contact' : 'Sara Haines (haines@email.unc.edu)'
     154        'institution' : platform_info['institution']
     155        'institution_url' : platform_info['institution_url']
     156        'institution_dods_url' : platform_info['institution_dods_url']
     157        'metadata_url' : platform_info['metadata_url']
     158        'references' : platform_info['references']
     159        'contact' : platform_info['contact']
    157160        #  
    158         'source' : 'buoy station'
     161        'source' : platform_info['source']+' '+sensor_info['source']
    159162        'history' : 'raw2proc using ' + sensor_info['process_module'], 
    160163        'comment' : 'File created using pycdf'+pycdfVersion()+' and numpy '+pycdfArrayPkg(), 
    161164        # conventions 
    162         'Conventions' : 'CF-1.0; SEACOOS-CDL-v2.0'
     165        'Conventions' : platform_info['conventions']
    163166        # SEACOOS CDL codes 
    164         'format_category_code' : 'fixed-point'
    165         'institution_code' : platform_info['institution'], 
     167        'format_category_code' : platform_info['format_category_code']
     168        'institution_code' : platform_info['institution_code'], 
    166169        'platform_code' : platform_info['id'], 
    167170        'package_code' : sensor_info['id'], 
    168171        # institution specific 
    169         'project' : 'North Carolina Coastal Ocean Observing System (NCCOOS)'
    170         'project_url' : 'http://nccoos.org'
     172        'project' : platform_info['project']
     173        'project_url' : platform_info['project_url']
    171174        # timeframe of data contained in file yyyy-mm-dd HH:MM:SS 
    172         'start_date' : data['dt'][0].strftime("%Y-%m-%d %H:%M:%S"), 
    173         'end_date' : data['dt'][-1].strftime("%Y-%m-%d %H:%M:%S"),  
     175        # first date in monthly file 
     176        'start_date' : data['dt'][i][0].strftime("%Y-%m-%d %H:%M:%S"), 
     177        # last date in monthly file 
     178        'end_date' : data['dt'][i][-1].strftime("%Y-%m-%d %H:%M:%S"),  
    174179        'release_date' : now_dt.strftime("%Y-%m-%d %H:%M:%S"), 
    175180        # 
     
    181186        '_FillValue' : -99999., 
    182187        } 
     188 
    183189 
    184190    var_atts = { 
     
    313319        ) 
    314320 
    315     # subset data only to month being processed (see raw2proc.process()) 
    316     i = data['in'] 
    317      
    318321    # var data  
    319322    var_data = ( 
     
    338341def updater(platform_info, sensor_info, data): 
    339342    # 
     343    # subset data only to month being processed (see raw2proc.process()) 
     344    i = data['in'] 
     345 
    340346    global_atts = {  
    341347        # update times of data contained in file (yyyy-mm-dd HH:MM:SS) 
    342348        # last date in monthly file 
    343         'end_date' : data['dt'][-1].strftime("%Y-%m-%d %H:%M:%S"),  
     349        'end_date' : data['dt'][i][-1].strftime("%Y-%m-%d %H:%M:%S"),  
    344350        'release_date' : now_dt.strftime("%Y-%m-%d %H:%M:%S"), 
    345351        # 
     
    359365    #    } 
    360366     
    361     # subset data only to month being processed (see raw2proc.process()) 
    362     i = data['in'] 
    363  
    364367    # data  
    365368    var_data = ( 
  • raw2proc/trunk/raw2proc/procutil.py

    r478 r488  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2011-12-16 15:18:49 haines> 
     2# Last modified:  Time-stamp: <2012-04-17 12:09:47 haines> 
    33"""Utilities to help data processing  
    44 
     
    128128        # e.g. month 1...12, something parsed wrong 
    129129        dt = None 
    130     else: 
    131         # absolute difference in days from now (UTC) 
    132         z = dt - datetime.utcnow() 
    133         daysdiff = abs(z.days) 
    134         # if this date unreasonable (>10 years*365), throw it out 
    135         # something parsed wrong 
    136         if daysdiff > 3650: 
    137             dt = None                 
     130    # else: 
     131    #    # absolute difference in days from now (UTC) 
     132    #     z = dt - datetime.utcnow() 
     133    #     daysdiff = abs(z.days) 
     134    #     # if this date unreasonable (>10 years*365), throw it out 
     135    #     # something parsed wrong 
     136    #     if daysdiff > 3650: 
     137    #         dt = None                 
    138138 
    139139    return dt 
  • raw2proc/trunk/raw2proc/raw2proc.py

    r478 r488  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2011-12-16 17:05:08 haines> 
     2# Last modified:  Time-stamp: <2012-04-17 13:22:05 haines> 
    33"""Process raw data to monthly netCDF data files 
    44 
     
    182182    for fn in all_raw_files: 
    183183        (fndt, granularity) = filt_datetime(os.path.basename(fn), gran=True) 
    184  
    185         # "ind" var from filt_datetime() - what level of granularity was used 
    186184        if granularity == 4: 
    187185            # change dt_start to before monthly filename filt_datetime() date 
     
    191189            dt_start = si['proc_start_dt']-timedelta(days=31) 
    192190            # print dt_start 
    193  
    194191        if fndt: 
    195192            if dt_start <= fndt <= dt_end or m: 
     
    213210        config_end_dt = now_dt 
    214211 
    215     # # check if raw_files are monthly (granularity == 4)  
    216     #     for idx, fn in enumerate(raw_files): 
    217     #         (fndt, granularity) = filt_datetime(os.path.basename(fn), gran=True) 
    218     #   # "ind" var from filt_datetime() - what level of granularity was used 
    219     #         if granularity == 4: 
    220     #             if fndt < config_start_dt: 
    221     #                 dts[idx] = fndt + timedelta(days=31) 
    222     #             if fndt > config_end_dt: 
    223     #                 dts[idx] = fndt - timedelta(days=31) 
     212    for idx, fn in enumerate(raw_files): 
     213        (fndt, granularity) = filt_datetime(os.path.basename(fn), gran=True) 
     214        if granularity == 4: 
     215            if fndt < config_start_dt: 
     216                dts[idx] = config_start_dt  
     217            if fndt > config_end_dt: 
     218                dts[idx] = config_end_dt 
    224219 
    225220    new_list = [raw_files[i] for i in range(len(raw_files)) \ 
     
    296291            
    297292    """ 
     293    now_dt = datetime.utcnow() 
     294    now_dt.replace(microsecond=0) 
     295 
    298296    yyyy_mm = this_month() 
    299297    months = find_months(yyyy_mm) 
     
    309307            asi = get_config(cn+'.sensor_info') 
    310308            platform = pi['id'] 
     309            if pi['config_start_date']: 
     310                pi['config_start_dt'] = filt_datetime(pi['config_start_date']) 
     311            elif pi['config_start_date'] == None: 
     312                pi['config_start_dt'] = now_dt 
     313            if pi['config_end_date']: 
     314                pi['config_end_dt'] = filt_datetime(pi['config_end_date']) 
     315            elif pi['config_end_date'] == None: 
     316                pi['config_end_dt'] = now_dt 
    311317            # for each sensor package 
    312318            for package in asi.keys(): 
     
    357363               which raw files 
    358364    """ 
    359      # determine when month starts and ends 
     365    now_dt = datetime.utcnow() 
     366    now_dt.replace(microsecond=0) 
     367 
    360368    months = find_months(yyyy_mm) 
    361369    month_start_dt = months[1] 
     
    370378            print ' ... config file : %s' % cn 
    371379            pi = get_config(cn+'.platform_info') 
     380            if pi['config_start_date']: 
     381                pi['config_start_dt'] = filt_datetime(pi['config_start_date']) 
     382            elif pi['config_start_date'] == None: 
     383                pi['config_start_dt'] = now_dt 
     384            if pi['config_end_date']: 
     385                pi['config_end_dt'] = filt_datetime(pi['config_end_date']) 
     386            elif pi['config_end_date'] == None: 
     387                pi['config_end_dt'] = now_dt 
    372388            # month start and end dt to pi info 
    373389            asi = get_config(cn+'.sensor_info') 
     
    381397                ofn = os.path.join(si['proc_dir'], si['proc_filename']) 
    382398                (raw_files, raw_dts) = find_raw(si, yyyy_mm) 
    383                 print raw_files 
    384                 print raw_dts 
     399                # print raw_files 
     400                # print raw_dts 
    385401                raw_files = which_raw(pi, raw_files, raw_dts) 
    386                 print raw_files 
    387                 print raw_dts 
     402                # print raw_files 
     403                # print raw_dts 
    388404                # remove any previous netcdf file (platform_package_yyyy_mm.nc) 
    389405                if index==0  and os.path.exists(ofn): 
     
    423439 
    424440            for index, val in enumerate(data['dt']): 
    425                 if val>=si['proc_start_dt'] and val<=si['proc_end_dt']: 
     441                if val>=pi['config_start_dt'] and val>=si['proc_start_dt'] and val<=si['proc_end_dt'] and val<=pi['config_end_dt']: 
    426442                    data['in'][index] = True 
    427443