Changeset 218
- Timestamp:
- 01/07/09 18:09:33
- Files:
-
- raw2proc/trunk/raw2proc/morgan_config_20080701.py (modified) (2 diffs)
- raw2proc/trunk/raw2proc/proc_avp_ascii_met.py (modified) (3 diffs)
- raw2proc/trunk/raw2proc/proc_avp_ysi_6600_v2.py (deleted)
- raw2proc/trunk/raw2proc/proc_avp_ysi_6600_v2_CDL2.py (added)
- raw2proc/trunk/raw2proc/procutil.py (modified) (4 diffs)
- raw2proc/trunk/raw2proc/raw2proc.py (modified) (2 diffs)
- raw2proc/trunk/raw2proc/stones_config_20080701.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
raw2proc/trunk/raw2proc/morgan_config_20080701.py
r211 r218 2 2 'id' : 'morgan', 3 3 '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', 8 9 'institution' : 'nccoos', 9 10 # … … 19 20 'raw_file_glob' : '*.dat', 20 21 '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', 22 23 'utc_offset' : 5., # hours offset to Eastern Standard 23 24 'bin_size' : 0.1, # meters 24 'nbins' : 40, # for now, water_depth (MSL) divided by bin_size25 '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 profile 26 # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 27 # 'latest_vars' : ('time','lat','lon','z','wtemp','salin'), 27 28 }, 28 29 'met' : { 'id' : 'met', raw2proc/trunk/raw2proc/proc_avp_ascii_met.py
r211 r218 1 1 #!/usr/bin/env python 2 # Last modified: Time-stamp: <2008-1 0-01 12:46:26haines>2 # Last modified: Time-stamp: <2008-11-13 11:55:34 haines> 3 3 """ 4 4 how to parse data, and assert what data and info goes into … … 244 244 # dimension names use tuple so order of initialization is maintained 245 245 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) 250 250 ) 251 251 … … 256 256 var_inits = ( 257 257 # 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',)), 262 262 # 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',)), 269 269 ) 270 270 raw2proc/trunk/raw2proc/procutil.py
r213 r218 1 1 #!/usr/bin/env python 2 # Last modified: Time-stamp: <2008-1 0-23 11:30:48haines>2 # Last modified: Time-stamp: <2008-12-17 16:49:11 haines> 3 3 """Utilities to help data processing 4 4 … … 289 289 # fn_glob = 'bogue_dspec_plot*' 290 290 291 def 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 291 321 # unit conversions 292 322 def meters2feet(meters): 293 323 """Convert meters to feet: <feet> = <meters>*3.28084 """ 294 324 return meters*3.28084 295 325 326 def feet2meters(feet): 327 """Convert feet to meters: <meters> = <feet>*0.3048 """ 328 return feet*0.3048 296 329 297 330 def millibar2inches_Hg(millibar): … … 299 332 return millibar*0.0295301 300 333 301 302 334 def celsius2fahrenheit(celsius): 303 335 """Convert deg Celsius to deg Fahrenheit: <fahrenheit> = ((1.8*<celsius>)+32) """ 304 336 return (1.8*celsius)+32 305 337 306 307 338 def millimeters2inches(millimeters): 308 339 """ Convert millimeter to inches: <inches> = <millimeters>*0.0393700787) """ 309 340 return millimeters*0.0393700787 310 341 342 def inches2millimeters(inches): 343 """ Convert <mm> = <inches>*25.4 """ 344 return inches*25.4 311 345 312 346 def meters_sec2knots(meters_sec): … … 314 348 return meters_sec*1.94384449 315 349 316 317 350 def wind_vector2u(wind_speed, wind_from_direction): 318 351 """ Convert wind vector to U (east) component: <u> = <wind_speed>*sine(<wind_from_direction>*pi/180) """ 319 352 return wind_speed*math.sin(wind_from_direction*math.pi/180) 320 353 321 322 354 def wind_vector2v(wind_speed, wind_from_direction): 323 355 """ Convert wind vector to V (north) component: <v> = <wind_speed>*cosine(<wind_from_direction>*pi/180) """ 324 356 return wind_speed*math.cos(wind_from_direction*math.pi/180) 325 357 326 327 358 def proc2latest(pi, si, yyyy_mm): 328 359 """Select specific variables and times from current monthly netCDF raw2proc/trunk/raw2proc/raw2proc.py
r213 r218 1 1 #!/usr/bin/env python 2 # Last modified: Time-stamp: <200 8-10-23 11:05:43haines>2 # Last modified: Time-stamp: <2009-01-07 17:12:01 haines> 3 3 """Process raw data to monthly netCDF data files 4 4 … … 402 402 403 403 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']: 405 405 data['in'][index] = True 406 406 raw2proc/trunk/raw2proc/stones_config_20080701.py
r211 r218 2 2 'id' : 'stones', 3 3 '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', 8 9 'institution' : 'nccoos', 9 10 # … … 19 20 'raw_file_glob' : '*.dat', 20 21 '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', 22 23 'utc_offset' : 5., # hours offset to Eastern Standard 23 24 'bin_size' : 0.1, # meters 24 'nbins' : 40, # for now, water_depth (MSL) divided by bin_size25 '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 profile 26 # 'latest_dir' : '/seacoos/data/nccoos/latest_v2.0', 27 # 'latest_vars' : ('time','lat','lon','z','wtemp','salin'), 27 28 }, 28 29 'met' : { 'id' : 'met',