Beispiel #1
0
              ### 
              #lat.append(lat_dd[z])
              #lon.append(lon_dd[z])  
              lat.append(lat_dd)
              lon.append(lon_dd)  
   samesites=samesites0
   ave_temp=ave_temp0
   
   
   
   
   
   
  # plot more colors with function "uniquecolors"    
   n=int(len(samesites))+2 #how many colors
   (rgbcolors)=colors(n)

   fig = plt.figure()
   ax = fig.add_subplot(111)
  # data in same site, plot in one line
   time11=[]
 
   for k in range(len(samesites)):
      #According samesites, get bottom depth
      depth_b_same=[]
      for u in range(len(sites2)):     
        if sites2[u]==samesites[k]:
            #depth_b_same.append(depth_b[u])
            depth_b_same.append(depth_b)
   
      #when sensor close to bottom of sea
input_time=[dt.datetime(2012,1,30,0,0,0,0,pytz.UTC),dt.datetime(2012,9,1,0,0,0,0,pytz.UTC)] # start time and end time
gbox=[-68.0,-72.0,45.0,38.0] #  maxlon, minlon,maxlat,minlat
id=[] # id list, if you are not clear dedicated id, let id=[]
#'125450842''125450841'
#↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑Input values↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑#

#fig = plt.figure()
#ax = fig.add_subplot(111)  
ask_input=input_time[0]
plot_getsst(ask_input,utc,sorted(gbox))    # get sst data and polt it

if id==[]:
    
    time,ids,lats,lons=getobs_drift_byrange(gbox,input_time)
    id=list(set(ids))
    rgbcolors=colors(len(id))   # set different colors to different drifter
    for k in range(len(id)):
        time,ids,lat_d,lon_d=getobs_drift_byidrange(id[k],gbox,input_time)   #get drifters' data
        plt.plot(lon_d[0],lat_d[0],'.',markersize=30,color=rgbcolors[k+1],label=str(id[k]))
        plt.plot(np.reshape(lon_d,np.size(lon_d)),np.reshape(lat_d,np.size(lat_d)),color=rgbcolors[k+1]) #plot
else:
    lats,lons=[],[]
    rgbcolors=colors(len(id))  # set different colors to different drifter
    for m in range(len(id)):
        time,ids,lat_d,lon_d=getobs_drift_byid(id[m],input_time)  #get drifters' data by id
        plt.plot(lon_d[0],lat_d[0],'.',markersize=30,color=rgbcolors[m+1],label=str(id[m]))
        plt.plot(np.reshape(lon_d,np.size(lon_d)),np.reshape(lat_d,np.size(lat_d)),color=rgbcolors[m+1])
        for n in range(len(lat_d)):  
            lats.append(lat_d[n])
            lons.append(lon_d[n])
    
import pytz
from hx import getobs_drift_byrange,colors,getobs_drift_byidrange,getobs_drift_byid

###############################################
inputfilename='./getcodar_bydrifter_ctl.txt'
#################Input values#############################################
input_time=[dt.datetime(2013,1,1,0,0,0,0,pytz.UTC),dt.datetime(2013,7,1,0,0,0,0,pytz.UTC)] # start time and end time
gbox=[-70.0,-72.0,42.0,40.0] #  maxlon, minlon,maxlat,minlat
id=[134410701] # id list, if you are not clear dedicated id, let id=[]
#'125450842''125450841'
#↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑Input values↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑#
if id==[]:
    
    time,ids,lats,lons=getobs_drift_byrange(gbox,input_time)
    id=list(set(ids))
    rgbcolors=colors(len(id))
    mymap = pygmaps.maps(np.mean(lats), np.mean(lons), 12)
    for k in range(len(id)):
        time,ids,lat,lon=getobs_drift_byidrange(id[k],gbox,input_time)
        
        path=[]
        for i in range(len(lat)):
          path.append((lat[i],lon[i]))
          mymap.addpoint(lat[i],lon[i],'black')
  #mymap.addradpoint(drifter_data[lat][0],drifter_data[1][0], 95, "#FF0000","my-location")
        mymap.addradpoint(lat[0],lon[0], 295, "red")
        mymap.addradpoint(lat[-1],lon[-1], 295, "blue")
        mymap.addpath(path,rgbcolors[k])#00FF00
  #mymap.coloricon
  #mymap.getcycle
  #mymap.zoom    
Beispiel #4
0
          yrday01.append(yrday301[p])
          temp1.append(temp31[p])
          sites1.append(sites31[p])
          depth.append(depth_i[p])
      (sites32,depth_b1,lat_dd,lon_dd)=getemolt_depth(b_mindepth,b_maxdepth,lat_max,lon_max,lat_min,lon_min,site1)
      for q in range(len(sites32)):
          sites2.append(sites32[q])
          depth_b.append(depth_b1[q])

 
 
 
  (samesites,ave_temp,lat,lon)=samesites_data(sites1,sites2,temp1,lat_dd,lon_dd) #get samesites and average temp, latlon for point
  # plot more colors with function "uniquecolors"    
  n=int(len(samesites))+2 #how many colors
  (rgbcolors)=colors(n)

  fig = plt.figure()
  ax = fig.add_subplot(111)
  # data in same site, plot in one line
  time11=[]
 
  for k in range(len(samesites)):
      #According samesites, get bottom depth
      depth_b_same=[]
      for u in range(len(sites2)):     
        if sites2[u]==samesites[k]:
            depth_b_same.append(depth_b[u])
   
      #when sensor close to bottom of sea
      temp11,yrday011,sites11,yrday0111,temp111,depth11=[],[],[],[],[],[]