コード例 #1
0
 else:
     dlon_set[i]=dr_points['lon']; dlat_set[i]=dr_points['lat']; dtime[i]=dr_points['time']
     print 'Drifter points: ',len(dlon_set[i])
     mstart_time = dr_points['time'][-1]
     check_drifter = start_time-mstart_time
     if check_drifter.seconds > 10800: # 3*3600
         mlon_set[i]=dlon_set[i]; mlat_set[i]=dlat_set[i]; mtime[i]=dtime[i]
         continue
     #mend_time = dr_points['time'][-1] + timedelta(track_days)
     
     if track_way=='backward':
         end_time = mstart_time 
         mstart_time = end_time - timedelta(track_days)  #''' 
         
     if MODEL in GRIDS:
         get_obj =  get_fvcom(MODEL)
         print dr_points['time'][-1]
         url_fvcom = get_obj.get_url(mstart_time,end_time)
         b_points = get_obj.get_data(url_fvcom) # b_points is model boundary points.
         point,num = get_obj.get_track(dr_points['lon'][-1],dr_points['lat'][-1],depth,track_way)
         
     if MODEL=='ROMS':        
         get_obj = get_roms()
         url_roms = get_obj.get_url(mstart_time,end_time)
         get_obj.get_data(url_roms)
         point = get_obj.get_track(dr_points['lon'][-1],dr_points['lat'][-1],depth,track_way)#,DEPTH
         if len(point['lon'])==1:
             print 'Start point on the land or out of Model area.'
             sys.exit('Invalid point')
             
     mlon_set[i]=point['lon']; mlat_set[i]=point['lat'];mtime[i]=point['time']
コード例 #2
0
    drifter = get_drifter(drifter_ID, INPUT_DATA)
    dr_points = drifter.get_track(start_time, track_days)
    drifter_points['lon'].extend(dr_points['lon'])
    drifter_points['lat'].extend(dr_points['lat'])
    print "drifter points: ", len(
        dr_points['lon']
    ), '\nlast point(', dr_points['lat'][-1], ',', dr_points['lon'][-1], ')'
    #np.savez('drifter_points.npz',lon=drifter_points['lon'],lat=drifter_points['lat'])
    start_time = dr_points['time'][-1]
    end_time = dr_points['time'][-1] + timedelta(track_days)
    if track_way == 'backward':
        end_time = start_time
        start_time = end_time - timedelta(track_days)  #'''
    if MODEL in GRIDS:
        get_obj = get_fvcom(MODEL)
        print dr_points['time'][-1]
        url_fvcom = get_obj.get_url(start_time, end_time)
        b_points = get_obj.get_data(
            url_fvcom)  # b_points is model boundary points.
        point, num = get_obj.get_track(dr_points['lon'][-1],
                                       dr_points['lat'][-1], depth, track_way)

    if MODEL == 'ROMS':
        end_time = dr_points['time'][-1] + timedelta(track_days)
        get_obj = get_roms()
        url_roms = get_obj.get_url(dr_points['time'][-1], end_time)
        get_obj.get_data(url_roms)
        point = get_obj.get_track(dr_points['lon'][-1], dr_points['lat'][-1],
                                  depth, track_way)  #,DEPTH
        if len(point['lon']) == 1:
コード例 #3
0
ファイル: getuv.py プロジェクト: jamespatrickmanning/pyocean
import pytz
import netCDF4
from datetime import datetime, timedelta
import sys
sys.path.append('../webtrack/Track_alisan')
from track_functions import get_drifter,get_fvcom,get_roms,draw_basemap,uniquecolors
GRID='30yr'
point1 = (41.9188, -70.2207)
model_days=3
start_time = datetime(2013,11,17,0,0,0,0,pytz.UTC) 
end_time = start_time + timedelta(model_days)
get_obj = get_fvcom(GRID)
url_fvcom = get_obj.get_url(start_time,end_time)
lons,lats,lonc,latc,b_points,h,siglay = get_obj.get_data(url_fvcom)
u,v = get_obj.get_uv(url_fvcom1)

コード例 #4
0
 dr_points = drifter.get_track(
     begin_time, 1)  # gets drifter track beginning at begin_time
 dr_set['lons'].extend(dr_points['lon'])
 dr_set['lats'].extend(dr_points['lat'])
 for h in zip(dr_points['lat'], dr_points['lon']):
     d_file.write('%f,%f\n' % h)  #saves drifter specified data to file
 st_point = (dr_points['lon'][0], dr_points['lat'][0]
             )  # to be used later to start the model
 start_time = dr_points['time'][0]  # start time of the MODEL
 end_time = start_time + timedelta(
     1)  # assumes you are only stepping through one day
 a[i] = len(dr_set['lats'])
 an[i] = start_time.strftime('%m/%d-%H:%M')  #
 print 'Drifter points', a[i], an[i]
 if MODEL in ('FVCOM', 'BOTH'):
     get_obj = get_fvcom(GRID)
     url_fvcom = get_obj.get_url(start_time, end_time)
     point = get_obj.get_track(
         st_point[0], st_point[1], DEPTH,
         url_fvcom)  # where "point" output is a dictionary result
 if MODEL in ('ROMS', 'BOTH'):
     get_obj = get_roms()
     url_roms = get_obj.get_url(start_time, end_time)
     point = get_obj.get_track(st_point[0], st_point[1], DEPTH,
                               url_roms)  #includes start point
 #print len(point['lon'])
 n = len(dr_points['lat'])  # Quantity of one-day's drifter points
 #save the the same quantity of drifter
 fc_set['lons'].extend(point['lon'][:n])
 fc_set['lats'].extend(point['lat'][:n])
 for h in zip(point['lat'][:n], point['lon'][:n]):