Changeset 488
- Timestamp:
- 04/24/12 12:33:22
- Files:
-
- raw2proc/trunk/raw2proc/b1_config_20111112.py (modified) (4 diffs)
- raw2proc/trunk/raw2proc/b2_config_20111005.py (modified) (4 diffs)
- raw2proc/trunk/raw2proc/proc_codar_totals.py (modified) (1 diff)
- raw2proc/trunk/raw2proc/proc_cr1000_ctd.py (added)
- raw2proc/trunk/raw2proc/proc_cr1000_met.py (modified) (4 diffs)
- raw2proc/trunk/raw2proc/proc_cr1000_wind.py (modified) (6 diffs)
- raw2proc/trunk/raw2proc/procutil.py (modified) (2 diffs)
- raw2proc/trunk/raw2proc/raw2proc.py (modified) (10 diffs)
- raw2proc/trunk/raw2proc/scr_read_avp_ysi_6600_v2_fixed_profiler.py (deleted)
- raw2proc/trunk/raw2proc/scr_read_avp_ysi_6600_v2_moving_point.py (deleted)
- raw2proc/trunk/raw2proc/test_codar.py (deleted)
- raw2proc/trunk/raw2proc/test_proc_codar_totals.py (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
raw2proc/trunk/raw2proc/b1_config_20111112.py
r478 r488 7 7 'altitude': 0., # (approx.) station altitude 8 8 'altitude_units' : 'm', 9 'altitude_reference' : ' above_sea_level',9 'altitude_reference' : 'sea_surface', 10 10 # 11 11 'mean_water_depth': -32.0, … … 15 15 'config_start_date' : '2011-11-13 00:00:00', 16 16 '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', 18 33 } 19 34 … … 28 43 'barometer_height' : 1.5, # meters 29 44 'temperature_height' : 1.5, # meters 45 'height_units' : 'm', 46 'height_reference' : 'sea_surface', 30 47 # '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', 32 51 }, 33 52 'wind' : { 'id' : 'wind', … … 41 60 'anemometer2_height' : 3.35, # meters (11 ft above sea surface) 42 61 'height_units' : 'm', 43 'height_reference' : ' above_sea_level',62 'height_reference' : 'sea_surface', 44 63 # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 45 64 # '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', 46 97 }, 47 98 } raw2proc/trunk/raw2proc/b2_config_20111005.py
r478 r488 7 7 'altitude': 0., # (approx.) station altitude 8 8 'altitude_units' : 'm', 9 'altitude_reference' : ' above_sea_level',9 'altitude_reference' : 'sea_surface', 10 10 # 11 11 'mean_water_depth': -29.2, # meters (96 feet) … … 16 16 'config_end_date' : None, # None or yyyy-mm-dd HH:MM:SS 17 17 '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', 18 33 } 19 34 … … 29 44 'temperature_height' : 1.5, # meters 30 45 'height_units' : 'm', 31 'height_reference' : ' above_sea_level',46 'height_reference' : 'sea_surface', 32 47 # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 33 48 # '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', 34 51 }, 35 52 'wind' : { 'id' : 'wind', … … 43 60 'anemometer2_height' : 3.35, # meters (11 ft above sea surface) 44 61 'height_units' : 'm', 45 'height_reference' : ' above_sea_level',62 'height_reference' : 'sea_surface', 46 63 # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 47 64 # 'latest_vars' : ('time','lat','lon','z','u', 'v', 'wspd', 'wdir'), 48 65 }, 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 }, 49 98 } raw2proc/trunk/raw2proc/proc_codar_totals.py
r448 r488 1 1 #!/usr/bin/env python 2 # Last modified: Time-stamp: <201 0-09-20 12:32:19haines>2 # Last modified: Time-stamp: <2012-04-17 13:56:34 haines> 3 3 """ 4 4 how to parse data, and assert what data and info goes into raw2proc/trunk/raw2proc/proc_cr1000_met.py
r478 r488 1 1 #!/usr/bin/env python 2 # Last modified: Time-stamp: <201 1-12-16 14:10:43haines>2 # Last modified: Time-stamp: <2012-04-23 14:12:38 haines> 3 3 """ 4 4 how to parse data, and assert what data and info goes into … … 145 145 # 146 146 # 147 # subset data only to month being processed (see raw2proc.process()) 148 i = data['in'] 149 147 150 title_str = sensor_info['description']+' at '+ platform_info['location'] 148 global_atts = { 151 global_atts = { 149 152 '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'], 156 159 # 157 'source' : 'buoy station',160 'source' : platform_info['source']+' '+sensor_info['source'], 158 161 'history' : 'raw2proc using ' + sensor_info['process_module'], 159 162 'comment' : 'File created using pycdf'+pycdfVersion()+' and numpy '+pycdfArrayPkg(), 160 163 # conventions 161 'Conventions' : 'CF-1.0; SEACOOS-CDL-v2.0',164 'Conventions' : platform_info['conventions'], 162 165 # 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'], 165 168 'platform_code' : platform_info['id'], 166 169 'package_code' : sensor_info['id'], 167 170 # 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'], 170 173 # 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"), 173 178 'release_date' : now_dt.strftime("%Y-%m-%d %H:%M:%S"), 174 179 # … … 330 335 def updater(platform_info, sensor_info, data): 331 336 # 337 # subset data only to month being processed (see raw2proc.process()) 338 i = data['in'] 339 332 340 global_atts = { 333 341 # update times of data contained in file (yyyy-mm-dd HH:MM:SS) 334 342 # 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"), 336 344 'release_date' : now_dt.strftime("%Y-%m-%d %H:%M:%S"), 337 345 # … … 351 359 # } 352 360 353 # subset data only to month being processed (see raw2proc.process())354 i = data['in']355 356 361 # data 357 362 var_data = ( raw2proc/trunk/raw2proc/proc_cr1000_wind.py
r478 r488 1 1 #!/usr/bin/env python 2 # Last modified: Time-stamp: <201 1-12-16 14:36:47haines>2 # Last modified: Time-stamp: <2012-04-23 14:13:36 haines> 3 3 """ 4 4 how to parse data, and assert what data and info goes into … … 146 146 # 147 147 # 148 # subset data only to month being processed (see raw2proc.process()) 149 i = data['in'] 150 148 151 title_str = sensor_info['description']+' at '+ platform_info['location'] 149 global_atts = { 152 global_atts = { 150 153 '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'], 157 160 # 158 'source' : 'buoy station',161 'source' : platform_info['source']+' '+sensor_info['source'], 159 162 'history' : 'raw2proc using ' + sensor_info['process_module'], 160 163 'comment' : 'File created using pycdf'+pycdfVersion()+' and numpy '+pycdfArrayPkg(), 161 164 # conventions 162 'Conventions' : 'CF-1.0; SEACOOS-CDL-v2.0',165 'Conventions' : platform_info['conventions'], 163 166 # 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'], 166 169 'platform_code' : platform_info['id'], 167 170 'package_code' : sensor_info['id'], 168 171 # 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'], 171 174 # 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"), 174 179 'release_date' : now_dt.strftime("%Y-%m-%d %H:%M:%S"), 175 180 # … … 181 186 '_FillValue' : -99999., 182 187 } 188 183 189 184 190 var_atts = { … … 313 319 ) 314 320 315 # subset data only to month being processed (see raw2proc.process())316 i = data['in']317 318 321 # var data 319 322 var_data = ( … … 338 341 def updater(platform_info, sensor_info, data): 339 342 # 343 # subset data only to month being processed (see raw2proc.process()) 344 i = data['in'] 345 340 346 global_atts = { 341 347 # update times of data contained in file (yyyy-mm-dd HH:MM:SS) 342 348 # 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"), 344 350 'release_date' : now_dt.strftime("%Y-%m-%d %H:%M:%S"), 345 351 # … … 359 365 # } 360 366 361 # subset data only to month being processed (see raw2proc.process())362 i = data['in']363 364 367 # data 365 368 var_data = ( raw2proc/trunk/raw2proc/procutil.py
r478 r488 1 1 #!/usr/bin/env python 2 # Last modified: Time-stamp: <201 1-12-16 15:18:49haines>2 # Last modified: Time-stamp: <2012-04-17 12:09:47 haines> 3 3 """Utilities to help data processing 4 4 … … 128 128 # e.g. month 1...12, something parsed wrong 129 129 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 out135 # something parsed wrong136 if daysdiff > 3650:137 dt = None130 # 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 138 138 139 139 return dt raw2proc/trunk/raw2proc/raw2proc.py
r478 r488 1 1 #!/usr/bin/env python 2 # Last modified: Time-stamp: <201 1-12-16 17:05:08haines>2 # Last modified: Time-stamp: <2012-04-17 13:22:05 haines> 3 3 """Process raw data to monthly netCDF data files 4 4 … … 182 182 for fn in all_raw_files: 183 183 (fndt, granularity) = filt_datetime(os.path.basename(fn), gran=True) 184 185 # "ind" var from filt_datetime() - what level of granularity was used186 184 if granularity == 4: 187 185 # change dt_start to before monthly filename filt_datetime() date … … 191 189 dt_start = si['proc_start_dt']-timedelta(days=31) 192 190 # print dt_start 193 194 191 if fndt: 195 192 if dt_start <= fndt <= dt_end or m: … … 213 210 config_end_dt = now_dt 214 211 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 224 219 225 220 new_list = [raw_files[i] for i in range(len(raw_files)) \ … … 296 291 297 292 """ 293 now_dt = datetime.utcnow() 294 now_dt.replace(microsecond=0) 295 298 296 yyyy_mm = this_month() 299 297 months = find_months(yyyy_mm) … … 309 307 asi = get_config(cn+'.sensor_info') 310 308 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 311 317 # for each sensor package 312 318 for package in asi.keys(): … … 357 363 which raw files 358 364 """ 359 # determine when month starts and ends 365 now_dt = datetime.utcnow() 366 now_dt.replace(microsecond=0) 367 360 368 months = find_months(yyyy_mm) 361 369 month_start_dt = months[1] … … 370 378 print ' ... config file : %s' % cn 371 379 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 372 388 # month start and end dt to pi info 373 389 asi = get_config(cn+'.sensor_info') … … 381 397 ofn = os.path.join(si['proc_dir'], si['proc_filename']) 382 398 (raw_files, raw_dts) = find_raw(si, yyyy_mm) 383 print raw_files384 print raw_dts399 # print raw_files 400 # print raw_dts 385 401 raw_files = which_raw(pi, raw_files, raw_dts) 386 print raw_files387 print raw_dts402 # print raw_files 403 # print raw_dts 388 404 # remove any previous netcdf file (platform_package_yyyy_mm.nc) 389 405 if index==0 and os.path.exists(ofn): … … 423 439 424 440 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']: 426 442 data['in'][index] = True 427 443