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

Changeset 218

Show
Ignore:
Timestamp:
01/07/09 18:09:33
Author:
haines
Message:

AVP fixed profiler CDL2 implemented

Files:

Legend:

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

    r211 r218  
    22            'id' : 'morgan', 
    33            'location' : 'Morgan Bay, New River, NC', 
    4             'lat' : 34.7037,         # degrees true (-) south, (+) north 
    5             'lon' : -77.4022,         # degrees true (-) west, (+) east 
    6             'mvar' : -9.42,          # degrees (-) west, (+) east 
    7             'water_depth': 4.0,      # nominal depth in meters (should be MSL) 
     4            'lat' : 34.7037,  # degrees true (-) south, (+) north 
     5            'lon' : -77.4022, # degrees true (-) west, (+) east 
     6            'mvar' : -9.42,   # degrees (-) west, (+) east 
     7            'mean_water_depth': -4.0,      # nominal depth in meters (should be MSL) 
     8            'mean_water_depth_time_period': 'Not determined', 
    89            'institution' : 'nccoos', 
    910            # 
     
    1920              'raw_file_glob' : '*.dat', 
    2021              'proc_dir' : '/seacoos/data/nccoos/level1/morgan/avp/', 
    21               'process_module' : 'proc_avp_ysi_6600_v2', 
     22              'process_module' : 'proc_avp_ysi_6600_v2_CDL2', 
    2223              'utc_offset' : 5.,     # hours offset to Eastern Standard 
    2324              'bin_size' : 0.1,      # meters 
    24               'nbins' : 40,          # for now, water_depth (MSL) divided by bin_siz
    25               'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 
    26               'latest_vars' : ('time','lat','lon','z','wtemp','salin'), 
     25              'nbins' : 150,          # max number of samples in profil
     26              # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 
     27              # 'latest_vars' : ('time','lat','lon','z','wtemp','salin'), 
    2728              }, 
    2829    'met' : { 'id' : 'met', 
  • raw2proc/trunk/raw2proc/proc_avp_ascii_met.py

    r211 r218  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2008-10-01 12:46:26 haines> 
     2# Last modified:  Time-stamp: <2008-11-13 11:55:34 haines> 
    33""" 
    44how to parse data, and assert what data and info goes into 
     
    244244        # dimension names use tuple so order of initialization is maintained 
    245245        dim_inits = ( 
    246                 ('ntime', NC.UNLIMITED), 
    247                 ('nlat', 1), 
    248                 ('nlon', 1), 
    249                 ('nz', 1) 
     246                ('time', NC.UNLIMITED), 
     247                ('lat', 1), 
     248                ('lon', 1), 
     249                ('z', 1) 
    250250                ) 
    251251 
     
    256256        var_inits = ( 
    257257                # coordinate variables 
    258                 ('time', NC.INT, ('ntime',)), 
    259                 ('lat', NC.FLOAT, ('nlat',)), 
    260                 ('lon', NC.FLOAT, ('nlon',)), 
    261                 ('z',  NC.FLOAT, ('nz',)), 
     258                ('time', NC.INT, ('time',)), 
     259                ('lat', NC.FLOAT, ('lat',)), 
     260                ('lon', NC.FLOAT, ('lon',)), 
     261                ('z',  NC.FLOAT, ('z',)), 
    262262                # data variables 
    263                 ('wspd', NC.FLOAT, ('ntime',)), 
    264                 ('wdir', NC.FLOAT, ('ntime',)), 
    265                 ('cdir', NC.FLOAT, ('ntime',)), 
    266                 ('u', NC.FLOAT, ('ntime',)), 
    267                 ('v', NC.FLOAT, ('ntime',)), 
    268                 ('nwnd', NC.FLOAT, ('ntime',)), 
     263                ('wspd', NC.FLOAT, ('time',)), 
     264                ('wdir', NC.FLOAT, ('time',)), 
     265                ('cdir', NC.FLOAT, ('time',)), 
     266                ('u', NC.FLOAT, ('time',)), 
     267                ('v', NC.FLOAT, ('time',)), 
     268                ('nwnd', NC.FLOAT, ('time',)), 
    269269                ) 
    270270 
  • raw2proc/trunk/raw2proc/procutil.py

    r213 r218  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2008-10-23 11:30:48 haines> 
     2# Last modified:  Time-stamp: <2008-12-17 16:49:11 haines> 
    33"""Utilities to help data processing  
    44 
     
    289289    # fn_glob = 'bogue_dspec_plot*' 
    290290 
     291def addnan(dt, data): 
     292    # dt to be only 1-dimension and data to be 1- or 2-dimensional 
     293     
     294    from matplotlib.dates import date2num, num2date 
     295 
     296    # print dt.shape 
     297    # print data.shape 
     298     
     299    dn = date2num(dt) 
     300    delta = numpy.diff(dn) 
     301    sample_interval = numpy.median(delta) 
     302    maxdelta = 1.5*sample_interval 
     303    # print maxdelta 
     304    igap = (delta > maxdelta).nonzero()[0] 
     305    ngap = len(igap) 
     306    if not ngap: 
     307        return (dt, data) 
     308    else: 
     309        # convert sample interval to dt object 
     310        sample_interval = timedelta(0.5*sample_interval) 
     311        # for each gap in data create NaN 
     312        data_insert = [numpy.nan for gap in igap] 
     313        # for each gap in time create datetime value 
     314        dt_insert = [dt[gap]+sample_interval for gap in igap] 
     315        # insert new sample times at indices of the gaps 
     316        new_dt = numpy.insert(numpy.array(dt), igap+1, dt_insert) 
     317        # insert NaN data at the indices that match the above times 
     318        new_data = numpy.insert(numpy.array(data), igap+1, data_insert, axis=0) 
     319        return (new_dt, new_data) 
     320 
    291321# unit conversions  
    292322def meters2feet(meters): 
    293323    """Convert meters to feet: <feet> = <meters>*3.28084 """ 
    294324    return meters*3.28084 
    295  
     325         
     326def feet2meters(feet): 
     327    """Convert feet to meters: <meters> = <feet>*0.3048 """ 
     328    return feet*0.3048 
    296329         
    297330def millibar2inches_Hg(millibar): 
     
    299332    return millibar*0.0295301 
    300333 
    301  
    302334def celsius2fahrenheit(celsius): 
    303335    """Convert deg Celsius to deg Fahrenheit: <fahrenheit> = ((1.8*<celsius>)+32) """ 
    304336    return (1.8*celsius)+32 
    305337 
    306  
    307338def millimeters2inches(millimeters): 
    308339    """ Convert millimeter to inches: <inches> = <millimeters>*0.0393700787) """ 
    309340    return millimeters*0.0393700787 
    310341 
     342def inches2millimeters(inches): 
     343    """ Convert <mm> = <inches>*25.4 """ 
     344    return inches*25.4 
    311345 
    312346def meters_sec2knots(meters_sec): 
     
    314348    return meters_sec*1.94384449 
    315349 
    316  
    317350def wind_vector2u(wind_speed, wind_from_direction): 
    318351    """ Convert wind vector to U (east) component: <u> = <wind_speed>*sine(<wind_from_direction>*pi/180) """ 
    319352    return wind_speed*math.sin(wind_from_direction*math.pi/180) 
    320353 
    321  
    322354def wind_vector2v(wind_speed, wind_from_direction): 
    323355    """ Convert wind vector to V (north) component: <v> = <wind_speed>*cosine(<wind_from_direction>*pi/180) """ 
    324356    return wind_speed*math.cos(wind_from_direction*math.pi/180) 
    325357 
    326                                                  
    327358def proc2latest(pi, si, yyyy_mm): 
    328359    """Select specific variables and times from current monthly netCDF 
  • raw2proc/trunk/raw2proc/raw2proc.py

    r213 r218  
    11#!/usr/bin/env python 
    2 # Last modified:  Time-stamp: <2008-10-23 11:05:43 haines> 
     2# Last modified:  Time-stamp: <2009-01-07 17:12:01 haines> 
    33"""Process raw data to monthly netCDF data files 
    44 
     
    402402 
    403403            for index, val in enumerate(data['dt']): 
    404                 if val>si['proc_start_dt'] and val<=si['proc_end_dt']: 
     404                if val>=si['proc_start_dt'] and val<=si['proc_end_dt']: 
    405405                    data['in'][index] = True 
    406406                     
  • raw2proc/trunk/raw2proc/stones_config_20080701.py

    r211 r218  
    22            'id' : 'stones', 
    33            'location' : 'Stones Bay, New River, NC', 
    4             'lat' : 34.5962,         # degrees true (-) south, (+) north 
    5             'lon' : -77.4120,         # degrees true (-) west, (+) east 
    6             'mvar' : -9.38,          # degrees (-) west, (+) east 
    7             'water_depth': 4.0,      # nominal depth in meters (should be MSL) 
     4            'lat' : 34.5962,   # degrees true (-) south, (+) north 
     5            'lon' : -77.4120,  # degrees true (-) west, (+) east 
     6            'mvar' : -9.38,    # degrees (-) west, (+) east 
     7            'mean_water_depth': -4.0, 
     8            'mean_water_depth_time_period': 'Not determined', 
    89            'institution' : 'nccoos', 
    910            # 
     
    1920              'raw_file_glob' : '*.dat', 
    2021              'proc_dir' : '/seacoos/data/nccoos/level1/stones/avp', 
    21               'process_module' : 'proc_avp_ysi_6600_v2', 
     22              'process_module' : 'proc_avp_ysi_6600_v2_CDL2', 
    2223              'utc_offset' : 5.,      # hours offset to Eastern Standard 
    2324              'bin_size' : 0.1,      # meters 
    24               'nbins' : 40,          # for now, water_depth (MSL) divided by bin_siz
    25               'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 
    26               'latest_vars' : ('time','lat','lon','z','wtemp','salin'), 
     25              'nbins' : 150,          # max number of samples in profil
     26              # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 
     27              # 'latest_vars' : ('time','lat','lon','z','wtemp','salin'), 
    2728              }, 
    2829    'met' : { 'id' : 'met',